Difference between revisions of "Template:AutoDEFAULTSORT"

From Disobiki
Jump to navigation Jump to search
Line 1: Line 1:
<includeonly>{{#ifeq: {{#rmatch:{{PAGENAME}}|^(A{{!}}The)\s|1}} | 1 |
+
<includeonly>ADS: {{PAGENAME}} / ADS: {{NAMESPACE: }}{{#ifeq: {{#rmatch:{{PAGENAME}}|^(A{{!}}The)\s|1}} | 1 |
 
   {{DEFAULTSORT:{{#if: {{{namespace|}}} | {{NAMESPACE}}: }}{{#rreplace:{{PAGENAME}}|^(A{{!}}The) |}}}}
 
   {{DEFAULTSORT:{{#if: {{{namespace|}}} | {{NAMESPACE}}: }}{{#rreplace:{{PAGENAME}}|^(A{{!}}The) |}}}}
 
| }}</includeonly><noinclude>
 
| }}</includeonly><noinclude>
Line 10: Line 10:
 
  {{AutoDEFAULTSORT|namespace=1}}
 
  {{AutoDEFAULTSORT|namespace=1}}
 
</pre>
 
</pre>
 
ADS: {{PAGENAME}}
 
 
ADS: {{NAMESPACE: }}
 
  
 
[[Category:Templates]]</noinclude>
 
[[Category:Templates]]</noinclude>

Revision as of 11:55, 25 June 2014

Usage

Given "The Sinful Dwarf", return {{DEFAULTSORT:Sinful Dwarf}}. Handles "A Fistful of Dollars" too.
If namespace=1 is passed, include the namespace (necessary for proper sorting of File: uploads, for example).

 {{AutoDEFAULTSORT}}
 {{AutoDEFAULTSORT|namespace=1}}