Module:Ref: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 5: Line 5:
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------


--[[[
Constructs a reference with the given text, using the provided parser frame, ref
id and group.
@param object frame The current parser frame
@param string id The id to give to the reference
@param string group The group to include the reference in
@param string text The text of the reference
@return the constructed reference
]]
function makeRef( frame, id, group, text )
function makeRef( frame, id, group, text )
if text == nil or text == '' then
if utils.empty( text ) then
return utils.error(
return utils.error(
'No reference text was specified!',
'No reference text was specified!',
Line 14: Line 25:
text = tostring( text )
text = tostring( text )
local args = {}
local args = {}
if id ~= nil and id ~= '' then
if not utils.empty( id ) then
args.name = tostring( id )
args.name = tostring( id )
end
end
if group ~= nil and group ~= '' then
if not utils.empty( group ) then
args.group = tostring( group )
args.group = tostring( group )
end
end
Line 25: Line 36:


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


Line 52: Line 63:
return frame:extensionTag( 'references', '', args )
return frame:extensionTag( 'references', '', args )
end
end


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------