Fandom

Old School RuneScape Wiki

Module:Reftag

15,964pages on
this wiki
Add New Page
Discuss0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

--[[
-- 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="'..reg_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

Also on Fandom

Random Wiki