Module:Ref

From Halopedia, the Halo wiki

Revision as of 15:26, April 25, 2021 by Dab1001 (talk | contribs)
vde
Lua Module Documentation

This module provides the backend implementations of the Ref templates.

Public Functions

ref.ref

Private Functions

ref

Code

A copy of the code for this module follows:


local utils = require( 'Module:Utils' )

local 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 )
	local args = {}
	if id ~= nil and id ~= '' then
		args.name = tostring( id )
	end
	if group ~= nil and group ~= '' then
		args.group = tostring( group )
	end
	local frame = mw.getCurrentFrame()
	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

return ref