Module:Ref: Difference between revisions
From Halopedia, the Halo wiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local utils = require( 'Module:Utils' ) | |||
local ref = {} | local ref = {} | ||
function ref. | function ref( text, id, group ) | ||
if text == nil or text == '' then | |||
return utils.error( 'No reference text was specified!', 'ref', 'Pages with empty citations' ) | |||
end | |||
text = tostring( text ) | text = tostring( text ) | ||
local args = {} | local args = {} | ||
if id ~= nil and id ~= '' then | |||
args.name = tostring( id ) | |||
end | |||
if group ~= nil and group ~= '' then | if group ~= nil and group ~= '' then | ||
args.group = tostring( group ) | args.group = tostring( group ) | ||
end | end | ||
local frame = mw.getCurrentFrame() | local frame = mw.getCurrentFrame() | ||
return | return frame:extensionTag( 'ref', text, args ) | ||
end | |||
function ref.ref( frame ) | |||
local text = frame.args[1] | |||
local id = frame.args[2] | |||
local group = frame.args[3] | |||
return ref( text, id, group ) | |||
end | end | ||
return ref | return ref |