Module:Sort list
Uiterlijk
(MediaWiki:Scribunto-doc-page-show)
- Doel
- Deze module sorteert lijsten op alfabetische volgorde.
- Gebruik
- Te gebruiken via {{Sort list}}. Zie aldaar voor de documentatie.
require[[strict]]
local p = {}
local splitLine
function p.asc(frame)
local items = splitLine( frame.args[1] );
table.sort( items );
return table.concat( items, "\n" );
end
function p.desc(frame)
local items = splitLine( frame.args[1] );
table.sort( items, function (a, b) return a > b end );
return table.concat( items, "\n" );
end
function splitLine( text )
return mw.text.split( text, "\n", true );
end
return p