https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ASort Module:Sort - Revision history 2025-05-27T19:37:08Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.2 https://en.wikipedia.org/w/index.php?title=Module:Sort&diff=1246724526&oldid=prev MusikBot II: Protected "Module:Sort": High-risk template or module: 27977 transclusions (more info) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)) 2024-09-20T18:00:23Z <p>Protected &quot;<a href="/wiki/Module:Sort" title="Module:Sort">Module:Sort</a>&quot;: <a href="/wiki/Wikipedia:High-risk_templates" title="Wikipedia:High-risk templates">High-risk template or module</a>: 27977 transclusions (<a href="/wiki/User:MusikBot_II/TemplateProtector" title="User:MusikBot II/TemplateProtector">more info</a>) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <tr class="diff-title" lang="en"> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 18:00, 20 September 2024</td> </tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div> </td></tr></table> MusikBot II https://en.wikipedia.org/w/index.php?title=Module:Sort&diff=1246560582&oldid=prev Ahecht: Implement Template:Sort and Template:Sortname 2024-09-19T18:06:53Z <p>Implement <a href="/wiki/Template:Sort" title="Template:Sort">Template:Sort</a> and <a href="/wiki/Template:Sortname" title="Template:Sortname">Template:Sortname</a></p> <p><b>New page</b></p><div>local getArgs = require(&#039;Module:Arguments&#039;).getArgs<br /> <br /> local p = {}<br /> <br /> local demo = function(s) return &#039;&amp;lt;&#039; .. string.sub(s,2,-8) .. &#039;&amp;lt;/span&gt;&#039; end<br /> <br /> -- Protect against sortkey nesting.<br /> -- Example: {{sort|{{dts|2013|07|07}}|{{dts|1990|12|01}}}}<br /> local encode = function(s) return (string.find(s, &quot;sortkey&quot;) or string.find(s, &quot;data-sort-value&quot;))<br /> and &quot;&quot; or mw.text.encode(s) end<br /> <br /> function p._name(args)<br /> local sortkey = encode( ((args[4] or args.sort or &#039;&#039;) ~= &#039;&#039;)<br /> and (args[4] or args.sort)<br /> or ((args[2] or args.last or &#039;{{{last}}}&#039;)..&#039;, &#039;..(args[1] or args.first or &#039;{{{first}}}&#039;)))<br /> local span = (args[1] or args.first or &#039;{{{first}}}&#039;)..&#039; &#039;..(args[2] or args.last or &#039;{{{last}}}&#039;)<br /> if ((args.nolink or &#039;&#039;) == &#039;&#039;) and ((args[1] or args.first or &#039;&#039;)..(args[2] or args.last or &#039;&#039;)..(args.dab or &#039;&#039;) ~= &#039;-&#039;) then<br /> if (args[3] or args.link or &#039;&#039;) ~= &#039;&#039; then<br /> span = (args[3] or args.link) .. &#039;|&#039; .. span <br /> elseif (args.dab or &#039;&#039;) ~= &#039;&#039; then<br /> span = span .. &#039; (&#039; .. args.dab .. &#039;)|&#039; .. span<br /> end<br /> span = &#039;[[&#039; .. span .. &#039;]]&#039;<br /> end<br /> local cat = (mw.title.getCurrentTitle().namespace == 0 and not args.demo)<br /> and &#039;[[Category:Articles with hCards]]&#039; or &#039;&#039;<br /> span = &#039;&lt;span data-sort-value=&quot;&#039; .. sortkey ..<br /> &#039;&quot;&gt;&lt;span class=&quot;vcard&quot;&gt;&lt;span class=&quot;fn&quot;&gt;&#039; .. span .. <br /> &#039;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&#039;<br /> return (args.demo and demo(span) or span) .. cat<br /> end<br /> <br /> function p._sort(args)<br /> local span = &#039;&lt;span data-sort-value=&quot;&#039; ..<br /> encode((args[1] or &#039;{{{1}}}&#039;) .. &#039; !&#039;) .. &#039;&quot;&gt;&#039; ..<br /> (args[2] or (&#039;[[&#039;..(args[1] or &#039;{{{1}}}&#039;)..&#039;]]&#039;)) .. &#039;&lt;/span&gt;&#039;<br /> return args.demo and demo(span) or span<br /> end<br /> <br /> -- {{sortname}}<br /> p.name = function (frame) return p._name( getArgs(frame, {removeBlanks = false}) ) end<br /> -- {{sort}}<br /> p.sort = function (frame) return p._sort( getArgs(frame, {removeBlanks = false}) ) end<br /> <br /> return p</div> Ahecht