--
local p =
local yesno = require('Module:Yesno') -- boolean value interpretation
--ordinal|1=|2=|sup=}} - uses the caller's parameters Parameters 1: Any number or string. 2: Set to "d" if the module should display "d" instead of "nd" and "rd". sup: Set to yes/no to toggle superscript ordinal suffix.function p.ordinal(frame) local args = frame.args if args[1]
nil then args[1] = "" end return p._ordinal(args[1], (args[2]
function p._ordinal(n, d, sup) local x = tonumber(mw.ustring.match(n, "(%d*)%W*$")) local suffix = "th" -- If tonumber(n) worked: if x then local mod10 = math.abs(x) % 10 local mod100 = math.abs(x) % 100 if mod10
2 and mod100 ~= 12 then if d then suffix = "d" else suffix = "nd" end elseif mod10
return p