Module:Age: Difference between revisions
update from sandbox: use data-sort-value for sort keys per Module talk:Age#Sorting will use data-sort-value
(update from sandbox: Template:Death date and age now gives an error if the death date is in future by more than one day) |
(update from sandbox: use data-sort-value for sort keys per Module talk:Age#Sorting will use data-sort-value) |
||
Line 195: | Line 195: | ||
if mw.ustring.len(extra) > 1 then | if mw.ustring.len(extra) > 1 then | ||
-- Parameter "~" gives "~3" whereas "over" gives "over 3". | -- Parameter "~" gives "~3" whereas "over" gives "over 3". | ||
extra = extra .. ' ' | if extra:sub(-6, -1) ~= ' ' then | ||
extra = extra .. ' ' | |||
end | |||
end | end | ||
if flagCurrent then | if flagCurrent then | ||
Line 220: | Line 222: | ||
sortKey = string.format('%d', sortKey) .. string.format('%015.0f', math.floor(value * 10^(14-mag))) | sortKey = string.format('%d', sortKey) .. string.format('%015.0f', math.floor(value * 10^(14-mag))) | ||
end | end | ||
local | local result | ||
if sortable == 'sortable_table' then | if sortable == 'sortable_table' then | ||
result = 'data-sort-value="_SORTKEY_"|' | |||
elseif sortable == 'sortable_debug' then | |||
result = '<span data-sort-value="_SORTKEY_♠"><span style="border:1px solid">_SORTKEY_♠</span></span>' | |||
else | else | ||
result = '<span data-sort-value="_SORTKEY_♠"></span>' | |||
end | end | ||
return | return result:gsub('_SORTKEY_', sortKey) | ||
end | end | ||
end | end | ||
Line 351: | Line 351: | ||
end | end | ||
end | end | ||
return (sortKey or '') .. (result or '') | return (sortKey or '') .. makeExtra(args) .. (result or '') | ||
end | end | ||