Module:Sortkey: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>TheDJ
if the sortkey contains a sortkey, then blank. Nesting is
meta>TheDJ
mNo edit summary
Line 4: Line 4:
-- Protect against sortkey nesting.
-- Protect against sortkey nesting.
-- Example: {{sort|{{dts|2013|07|07}}|{{dts|1990|12|01}}}}
-- Example: {{sort|{{dts|2013|07|07}}|{{dts|1990|12|01}}}}
if string.find(str, "sortkey") then
if string.find(sortkey, "sortkey") then
return "";
return "";
end
end
     return mw.text.encode(frame.args[1])
     return mw.text.encode(sortkey)
end
end
return p
return p

Revision as of 21:30, 22 June 2018

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

local p = {}
function p.encode(frame)
	local sortkey = frame.args[1];
	-- Protect against sortkey nesting.
	-- Example: {{sort|{{dts|2013|07|07}}|{{dts|1990|12|01}}}}
	if string.find(sortkey, "sortkey") then
		return "";
	end
    return mw.text.encode(sortkey)
end
return p