Module:Sort list: Difference between revisions
Jump to navigation
Jump to search
m Protected "Module:Sort list": High-risk template or module (more info) ([Edit=Require autoconfirmed or confirmed access] (indefinite)) |
m 1 revision imported |
(No difference)
| |
Latest revision as of 15:06, 1 October 2021
- The following documentation is located at Module:Sort list/doc. [edit] Categories were auto-generated by Module:documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
A sorting module, intended to be used with {{sort list}}.
local p = {}
function p.asc(frame)
items = splitLine( frame.args[1] );
table.sort( items );
return table.concat( items, "\n" );
end
function p.desc(frame)
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