Difference between revisions of "Template:AutoDEFAULTSORT"

From Disobiki
Jump to navigation Jump to search
 
(21 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#ifeq: {{#pos:{{PAGENAME}}|A <nowiki />|}} | 0 |
+
<includeonly>{{#ifeq: {{#rmatch:{{PAGENAME}}|^(A{{!}}The)\s|1}} | 1 |
   {{DEFAULTSORT:{{#replace:{{PAGENAME}}|A <nowiki />|}}, A}}
+
   {{DEFAULTSORT:{{#rreplace:{{PAGENAME}}|^(A{{!}}The) |}}}}
| }}
 
{{#ifeq: {{#pos:{{PAGENAME}}|The <nowiki />}} | 0 |
 
  {{DEFAULTSORT:{{#replace:{{PAGENAME}}|The <nowiki />|}}, The}}
 
 
| }}</includeonly><noinclude>
 
| }}</includeonly><noinclude>
 
==Usage==
 
==Usage==
  
Given "The Sinful Dwarf", return <code><nowiki>{{DEFAULTSORT:Sinful Dwarf, The}}</nowiki></code>. Handles "A Fistful of Dollars" too.<br />It's not perfect: if "The" or "A" (capitalized) appear elsewhere in title, it'll remove those from the DEFAULTSORT result.
+
Given "The Sinful Dwarf", return <code><nowiki>{{DEFAULTSORT:Sinful Dwarf}}</nowiki></code>. Handles "A Fistful of Dollars" too.
  
 
<pre>
 
<pre>

Latest revision as of 12:57, 25 June 2014

Usage

Given "The Sinful Dwarf", return {{DEFAULTSORT:Sinful Dwarf}}. Handles "A Fistful of Dollars" too.

 {{AutoDEFAULTSORT}}