Jump to content

Module:Age: Difference between revisions

100 bytes added ,  5 years ago
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 lhs, rhs
local result
if sortable == 'sortable_table' then
if sortable == 'sortable_table' then
lhs = 'data-sort-value="'
result = 'data-sort-value="_SORTKEY_"|'
rhs = '"|'
elseif sortable == 'sortable_debug' then
result = '<span data-sort-value="_SORTKEY_♠"><span style="border:1px solid">_SORTKEY_♠</span></span>'
else
else
lhs = sortable == 'sortable_debug' and
result = '<span data-sort-value="_SORTKEY_♠"></span>'
'<span style="border:1px solid;display:inline;" class="sortkey">' or
'<span style="display:none" class="sortkey">'
rhs = '♠</span>'
end
end
return lhs .. sortKey .. rhs
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


Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.