Difference between revisions of "Template:GameCategory"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Add more examples - names with colons get wrongly cut at it)
m (Text replacement - "<tt>([^ =]+)<\/tt>" to "{{hl|$1}}")
Line 11: Line 11:
 
}}
 
}}
 
}}</includeonly><noinclude>
 
}}</includeonly><noinclude>
Adds a game (sub-)category to the proper format and finds the page Category Sort key (e.g <tt>Arma 2: Editing</tt> gets sorted as <tt>EDITING</tt>).<br>
+
Adds a game (sub-)category to the proper format and finds the page Category Sort key (e.g {{hl|Arma 2: Editing}} gets sorted as {{hl|EDITING}}).<br>
 
Uses {{Template|Name}} and {{Template|GameCategory/SortKey}}.
 
Uses {{Template|Name}} and {{Template|GameCategory/SortKey}}.
  
Line 18: Line 18:
 
* game: game id, see {{Template|Name}}
 
* game: game id, see {{Template|Name}}
 
* subCategory: (Optional, default empty) sub-category (e.g Editing)
 
* subCategory: (Optional, default empty) sub-category (e.g Editing)
* link: (Optional, default empty - named argument) <tt>y</tt> to make it a link '''to''' the category
+
* link: (Optional, default empty - named argument) {{hl|y}} to make it a link '''to''' the category
* sortKey: (Optional, default <tt>{{<nowiki/>uc:{{<nowiki/>PAGENAME}}}}</tt> - named argument) category sort key - will be uppercased
+
* sortKey: (Optional, default {{hl|{{<nowiki/>uc:{{<nowiki/>PAGENAME}}}}}} - named argument) category sort key - will be uppercased
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 30: Line 30:
 
|-
 
|-
 
| <nowiki>{{GameCategory|ofpr}}</nowiki>
 
| <nowiki>{{GameCategory|ofpr}}</nowiki>
| <tt><nowiki>[[Category: {{Name|ofpr|cat}}|SORTKEY]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|ofpr|cat}}|SORTKEY]]</tt>
+
| {{hl|<nowiki>[[Category: {{Name|ofpr|cat}}|SORTKEY]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|ofpr|cat}}|SORTKEY]]}}
 
|-
 
|-
 
| <nowiki>{{GameCategory|arma1}}</nowiki>
 
| <nowiki>{{GameCategory|arma1}}</nowiki>
| <tt><nowiki>[[Category: {{Name|arma1|cat}}|SORTKEY]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|arma1|cat}}|SORTKEY]]</tt>
+
| {{hl|<nowiki>[[Category: {{Name|arma1|cat}}|SORTKEY]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|arma1|cat}}|SORTKEY]]}}
 
|-
 
|-
 
| <nowiki>{{GameCategory|arma1qg}}</nowiki>
 
| <nowiki>{{GameCategory|arma1qg}}</nowiki>
| <tt><nowiki>[[Category: {{Name|arma1qg|cat}}|SORTKEY]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|arma1qg|cat}}|SORTKEY]]</tt>
+
| {{hl|<nowiki>[[Category: {{Name|arma1qg|cat}}|SORTKEY]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|arma1qg|cat}}|SORTKEY]]}}
 
|-
 
|-
 
| <nowiki>{{GameCategory|arma3|Editing}}</nowiki>
 
| <nowiki>{{GameCategory|arma3|Editing}}</nowiki>
| <tt><nowiki>[[Category: {{Name|arma3|cat}}: Editing|SORTKEY]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|arma3|cat}}: Editing|SORTKEY]]</tt>
+
| {{hl|<nowiki>[[Category: {{Name|arma3|cat}}: Editing|SORTKEY]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|arma3|cat}}: Editing|SORTKEY]]}}
 
|-
 
|-
 
| <nowiki>{{GameCategory|arma3|link=y}}</nowiki>
 
| <nowiki>{{GameCategory|arma3|link=y}}</nowiki>
| <tt><nowiki>[[:Category: {{Name|arma3|cat}}|SORTKEY]]</nowiki></tt><br>End result: <tt>[[<nowiki/>:Category: {{Name|arma3|cat}}|SORTKEY]]</tt><br><tt>{{GameCategory|arma3|link=y}}</tt>
+
| {{hl|<nowiki>[[:Category: {{Name|arma3|cat}}|SORTKEY]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>:Category: {{Name|arma3|cat}}|SORTKEY]]}}<br><tt>{{GameCategory|arma3|link=y}}</tt>
 
|-
 
|-
 
| <nowiki>{{GameCategory|arma3|Editing|link=y}}</nowiki>
 
| <nowiki>{{GameCategory|arma3|Editing|link=y}}</nowiki>
| <tt><nowiki>[[:Category: {{Name|arma3|cat}}: Editing|SORTKEY]]</nowiki></tt><br>End result: <tt>[[<nowiki/>:Category: {{Name|arma3|cat}}: Editing|SORTKEY]]</tt><br><tt>{{GameCategory|arma3|Editing|link=y}}</tt>
+
| {{hl|<nowiki>[[:Category: {{Name|arma3|cat}}: Editing|SORTKEY]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>:Category: {{Name|arma3|cat}}: Editing|SORTKEY]]}}<br><tt>{{GameCategory|arma3|Editing|link=y}}</tt>
 
|-
 
|-
 
| <nowiki>{{GameCategory|arma3|Editing|sortKey=#}}</nowiki>
 
| <nowiki>{{GameCategory|arma3|Editing|sortKey=#}}</nowiki>
| <tt><nowiki>[[Category: {{Name|arma3|cat}}: Editing|#]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|arma3|cat}}: Editing|#]]</tt>
+
| {{hl|<nowiki>[[Category: {{Name|arma3|cat}}: Editing|#]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|arma3|cat}}: Editing|#]]}}
 
|}
 
|}
  
 
[[Category:Templates|{{uc:{{PAGENAME}}}}]]
 
[[Category:Templates|{{uc:{{PAGENAME}}}}]]
 
</noinclude>
 
</noinclude>

Revision as of 11:33, 16 November 2021

Adds a game (sub-)category to the proper format and finds the page Category Sort key (e.g Arma 2: Editing gets sorted as EDITING).
Uses {{Name}} and {{GameCategory/SortKey}}.

Usage

{{GameCategory|game|subCategory|link=|sortKey=}}

  • game: game id, see {{Name}}
  • subCategory: (Optional, default empty) sub-category (e.g Editing)
  • link: (Optional, default empty - named argument) y to make it a link to the category
  • sortKey: (Optional, default {{uc:{{PAGENAME}}}} - named argument) category sort key - will be uppercased
Examples
Code Result
{{GameCategory}} N/A
{{GameCategory|ofpr}} [[Category: {{Name|ofpr|cat}}|SORTKEY]]
End result: [[Category: Operation Flashpoint: Resistance|SORTKEY]]
{{GameCategory|arma1}} [[Category: {{Name|arma1|cat}}|SORTKEY]]
End result: [[Category: ArmA: Armed Assault|SORTKEY]]
{{GameCategory|arma1qg}} [[Category: {{Name|arma1qg|cat}}|SORTKEY]]
End result: [[Category: ArmA: Queen's Gambit|SORTKEY]]
{{GameCategory|arma3|Editing}} [[Category: {{Name|arma3|cat}}: Editing|SORTKEY]]
End result: [[Category: Arma 3: Editing|SORTKEY]]
{{GameCategory|arma3|link=y}} [[:Category: {{Name|arma3|cat}}|SORTKEY]]
End result: [[:Category: Arma 3|SORTKEY]]
Arma 3
{{GameCategory|arma3|Editing|link=y}} [[:Category: {{Name|arma3|cat}}: Editing|SORTKEY]]
End result: [[:Category: Arma 3: Editing|SORTKEY]]
Arma 3: Editing
{{GameCategory|arma3|Editing|sortKey=#}} [[Category: {{Name|arma3|cat}}: Editing|#]]
End result: [[Category: Arma 3: Editing|#]]