Модул:Sorted plain list
Документацијата за овој модул можете да ја создадете на Модул:Sorted plain list/док
-- This module generates a sorted plain list
-- It was created as a modification of [[Module:Sort]]
local p = {}
local lang = mw.getContentLanguage()
function p.asc(frame)
items = mw.text.split( frame.args[1] or '', frame.args[2] or ',', true)
if (frame.args['type'] or '') == 'number' then
table.sort( items, function (a, b) return ((lang:parseFormattedNumber(a) or math.huge) < (lang:parseFormattedNumber(b) or math.huge)) end )
else
table.sort( items )
end
return '<div class="plainlist"><ul><li>' .. table.concat( items, "</li><li>" ) .. '</li></ul></div>'
end
function p.desc(frame)
items = mw.text.split( frame.args[1] or '', frame.args[2] or ',', true)
if (frame.args['type'] or '') == 'number' then
table.sort( items, function (a, b) return ((lang:parseFormattedNumber(a) or math.huge) > (lang:parseFormattedNumber(b) or math.huge)) end )
else
table.sort( items, function (a, b) return a > b end )
end
return '<div class="plainlist"><ul><li>' .. table.concat( items, "</li><li>" ) .. '</li></ul></div>'
end
return p