Template:NameSort: Difference between revisions

From Jenny Everywhere Wiki
m (Protected "Template:NameSort": High traffic page: Breaking this page will create problems on thousands of pages ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
m (15 revisions imported)
Tags: Mobile edit Mobile web edit
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>{{DEFAULTSORT:{{#sub:{{PAGENAME}}|{{#rpos:{{PAGENAME}}| }}|7}}}}</includeonly><noinclude>[[category:coding utility templates|Name]]{{documentation}}{{lock}}</noinclude>
<includeonly>{{DEFAULTSORT:
{{#switch:{{#rpos:{{{name|{{PAGENAME}}}}}|)}}
  |-1= <!--if there are no close parentheses, then look for spaces-->
    {{#switch:{{#rpos:{{{name|{{PAGENAME}}}}}| }}
    <!--if there are no spaces, then just go by the PAGENAME-->
    |-1 = {{{name|{{PAGENAME}}}}}
    <!--if there ARE spaces, then find the last word and use the first six digits
          of it as the sort key -->
    |#default ={{#sub:{{{name|{{PAGENAME}}}}}|{{#rpos:{{{name|{{PAGENAME}}}}}| }}|7}}, {{#explode:{{{name|{{PAGENAME}}}}}| |0}}
}} <!-- first switch close-->
  <!-- If there ARE close parentheses, use the word that immediately precedes the
      open parentheses as the sort key -->
  |#default = {{#explode:{{#sub:{{{name|{{PAGENAME}}}}}|0|{{#expr:{{#rpos:{{{name|{{PAGENAME}}}}}|(}}-1}}}}| |-1}}, {{#explode:{{{name|{{PAGENAME}}}}}| |0}} {{#explode:{{{name|{{PAGENAME}}}}}|(|-1}}
 
}} <!--second switch close-->
}} <!--DEFAULTSORT close--></includeonly><noinclude>[[Category:coding utility templates|NameSort]]{{documentation}}{{lock}}</noinclude>

Latest revision as of 01:33, 13 August 2024

Template:Lock