Difference between revisions of "Template:AutoDEFAULTSORT"

From Disobiki
Jump to navigation Jump to search
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#ifeq: {{#pos:{{PAGENAME}}|A&nbsp;}} | 0 |
+
<includeonly>{{#ifeq: {{#rmatch:{{PAGENAME}}|^(A{{!}}The)\s|1}} | 1 |
  {{DEFAULTSORT:{{#replace:{{PAGENAME}}|A&nbsp;|}}, A}}
+
  {{DEFAULTSORT:{{#rreplace:{{PAGENAME}}|^(A{{!}}The) |}}}}
| }}
 
{{#ifeq: {{#pos:{{PAGENAME}}|The&nbsp;}} | 0 |
 
  {{DEFAULTSORT:{{#replace:{{PAGENAME}}|The&nbsp;|}}, 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 11:57, 25 June 2014

Usage

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

 {{AutoDEFAULTSORT}}