Module:Sortkey: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>TheDJ mNo edit summary |
meta>TheDJ No edit summary |
||
Line 1: | Line 1: | ||
local getArgs = require('Module:Arguments').getArgs | |||
local p = {} | local p = {} | ||
function p. | |||
function p._encode(sortkey) | |||
-- 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(sortkey, "sortkey") then | if string.find(sortkey, "sortkey") or string.find(sortkey, "data-sort-value") then | ||
return ""; | return ""; | ||
end | end | ||
return mw.text.encode(sortkey) | return mw.text.encode(sortkey) | ||
end | end | ||
function p.encode(frame) | |||
local args = getArgs(frame); | |||
return p._encode(args[1]) | |||
end | |||
return p | return p |
Revision as of 18:30, 27 June 2018
Documentation for this module may be created at Module:Sortkey/doc
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p._encode(sortkey)
-- Protect against sortkey nesting.
-- Example: {{sort|{{dts|2013|07|07}}|{{dts|1990|12|01}}}}
if string.find(sortkey, "sortkey") or string.find(sortkey, "data-sort-value") then
return "";
end
return mw.text.encode(sortkey)
end
function p.encode(frame)
local args = getArgs(frame);
return p._encode(args[1])
end
return p