Difference between revisions of "Template:AutoDEFAULTSORT"

From Disobiki
Jump to navigation Jump to search
(Created page with '<includeonly>{{#ifeq: {{#pos:{{PAGENAME}}|A }} | 0 | {{DEFAULTSORT:{{#replace:{{PAGENAME}}|A |}}, A}} | }} {{#ifeq: {{#pos:{{PAGENAME}}|The }} | 0 | {{DEFAULTSORT:{{#replace:…')
 
 
(25 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#ifeq: {{#pos:{{PAGENAME}}|A }} | 0 |
+
<includeonly>{{#ifeq: {{#rmatch:{{PAGENAME}}|^(A{{!}}The)\s|1}} | 1 |
  {{DEFAULTSORT:{{#replace:{{PAGENAME}}|A |}}, A}}
+
  {{DEFAULTSORT:{{#rreplace:{{PAGENAME}}|^(A{{!}}The) |}}}}
| }}
 
{{#ifeq: {{#pos:{{PAGENAME}}|The }} | 0 |
 
  {{DEFAULTSORT:{{#replace:{{PAGENAME}}|The |}}, 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}}