Module:Ref

local utils = require( 'Module:Utils' )

--- PRIVATE FUNCTIONS --

function makeRef( frame, id, group, text ) if text == nil or text == '' then return utils.error(			'No reference text was specified!',			'ref',			'Pages with empty citations' ) end text = tostring( text ) local args = {} if id ~= nil and id ~= '' then args.name = tostring( id ) end if group ~= nil and group ~= '' then args.group = tostring( group ) end return frame:extensionTag( 'ref', text, args ) end

function makeGenericRef( frame, id, group ) return 'TODO: Implement this' end

function makeReuse( frame, id, group ) local args = {} if id == nil or id == '' then return utils.error(			'No id was specified for ref reuse!',			'ref',			'Pages containing missing template parameter errors' ) else args.name = tostring( id ) end if group ~= nil and group ~= '' then args.group = tostring( group ) end return frame:extensionTag( 'ref', '', args ) end

function makeList( frame, id, group ) local args = {} if group ~= nil and group ~= '' then args.group = tostring( group ) end return frame:extensionTag( 'references', '', args ) end

--- PUBLIC FUNCTIONS ---

local ref = {}

function ref.ref( frame ) local templateFrame = frame:getParent local id = templateFrame.args['Id'] or templateFrame.args['Name'] local group = templateFrame.args['Group'] local text = templateFrame.args[1] or templateFrame.args['Text'] return makeRef( frame, text, id, group ) end

function ref.list( frame ) local templateFrame = frame:getParent local group = templateFrame.args['Group'] return makeList( frame, group, colNum, colWidth, colGap ) end

function ref.generic( frame ) return 'TODO: Implement this' end

return ref