RuneScape Wiki
Advertisement

Documentation for this module may be created at Module:Reftag/doc

--[[
-- This module exists as a substitute for frame:extensionTag(), which is not in Wikia's Scribunto library
{{Helper module
|name=Reftag
|fname1={attr}
|ftype1=<code>table</code>
|fuse1=Table of attributes may include:
* <code>name</code> - A defined name for the ref
* <code>group</code> - A defined group for the ref
* <code>text</code> - The text inside the ref tags
* <code>selfClosing</code> - <code>true</code> or <code>false</code>; whether or not the tag will close itself
}}
--]]
return function(...)
	local ref_attr = ...
	local ref_tag = '<ref'
	if ref_attr.name then
		ref_tag = ref_tag..' name="'..ref_attr.name..'"'
	end
	if ref_attr.group then
		ref_tag = ref_tag..' group="'..ref_attr.group..'"'
	end
	if ref_attr.selfClosing == true then
		ref_tag = ref_tag..' />'
	else
		ref_tag = ref_tag..'>'
		if ref_attr.text then
			ref_tag = ref_tag..ref_attr.text
		end
		ref_tag = ref_tag..'</ref>'
	end
	return mw.getCurrentFrame():preprocess(ref_tag)
end
Advertisement