Difference between revisions of "Template:GetIaSortKey"

From Pathfinder Wiki
(Created page with "<includeonly> {{#vardefine:key|{{#titleparts:{{{page|{{PAGENAME}}}}}|1|{{{field|2}}}}}}}{{#switch:{{#var:key}} |Friend=1 |Companion=2 |Explorer=3 |Ranger=4 |Voyager=5 |Guide=6...")
 
Line 1: Line 1:
 
<includeonly>
 
<includeonly>
 
{{#vardefine:key|{{#titleparts:{{{page|{{PAGENAME}}}}}|1|{{{field|2}}}}}}}{{#switch:{{#var:key}}
 
{{#vardefine:key|{{#titleparts:{{{page|{{PAGENAME}}}}}|1|{{{field|2}}}}}}}{{#switch:{{#var:key}}
|Friend=1
+
|Friend=A
|Companion=2
+
|Companion=B
|Explorer=3
+
|Explorer=C
|Ranger=4
+
|Ranger=D
|Voyager=5
+
|Voyager=E
|Guide=6
+
|Guide=F
|Master Guide=9
+
|Master Guide=G
 
|{{#var:key}}
 
|{{#var:key}}
 
}}
 
}}

Revision as of 02:48, 27 March 2021


This template returns a sort key based on the IA Class name, so that Friend is sorted before Companion, Companion before Explorer, etc.

By default it gets the class name from the second element of the invoking page's title, but it can operate on a different page by specifying the page argument, and it can extract it from a different element within the title by specifying field.

If it doesn't recognize the class name, it will return the portion of the page title it was examining.

Example

{{GetIaSortKey|page=Investiture Achievement/Foo/Explorer|field=3}}


C