GameCategory – Template

From Bohemia Interactive Community
Jump to navigation Jump to search
(Add link option)
m (Add "link" named argument)
Line 1: Line 1:
<includeonly>{{#if:{{{1|}}}
<includeonly>{{#if:{{{1|}}}
| {{#if:{{{2|}}}
| {{#if:{{{2|}}}
| {{#if:{{{3|}}}
| {{#if:{{{link|}}}
| [[:Category: {{Name|{{{1}}}|cat}}: {{{2}}} | {{Name|{{{1}}}|cat}}: {{{2}}}]]
| [[:Category: {{Name|{{{1}}}|cat}}: {{{2}}} | {{Name|{{{1}}}|cat}}: {{{2}}}]]
| [[ Category: {{Name|{{{1}}}|cat}}: {{{2}}} | {{GameCategory/SortKey|{{Name|{{{1}}}|cat}} | {{PAGENAME}}}}]]
| [[ Category: {{Name|{{{1}}}|cat}}: {{{2}}} | {{GameCategory/SortKey|{{Name|{{{1}}}|cat}} | {{PAGENAME}}}}]]
}}
}}
| {{#if:{{{3|}}}
| {{#if:{{{link|}}}
| [[:Category: {{Name|{{{1}}}|cat}} | {{Name|{{{1}}}|cat}}]]
| [[:Category: {{Name|{{{1}}}|cat}} | {{Name|{{{1}}}|cat}}]]
| [[ Category: {{Name|{{{1}}}|cat}} | {{GameCategory/SortKey|{{Name|{{{1}}}|cat}} | {{PAGENAME}}}}]]
| [[ Category: {{Name|{{{1}}}|cat}} | {{GameCategory/SortKey|{{Name|{{{1}}}|cat}} | {{PAGENAME}}}}]]
Line 15: Line 15:


== Usage ==
== Usage ==
{{<nowiki/>GameCategory|'''''game'''''|'''''subCategory'''''|'''''link'''''}}
{{<nowiki/>GameCategory|'''''game'''''|'''''subCategory'''''|'''''link='''''}}
* 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) <tt>y</tt> to make it a link '''to''' the category
* link: (Optional, default empty - named argument) <tt>y</tt> to make it a link '''to''' the category


{| class="wikitable"
{| class="wikitable"
Line 34: Line 34:
| <tt><nowiki>[[Category: {{Name|arma3|cat}}: Editing|SORTKEY]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|arma3|cat}}: Editing|SORTKEY]]</tt>
| <tt><nowiki>[[Category: {{Name|arma3|cat}}: Editing|SORTKEY]]</nowiki></tt><br>End result: <tt>[[<nowiki/>Category: {{Name|arma3|cat}}: Editing|SORTKEY]]</tt>
|-
|-
| <nowiki>{{GameCategory|arma3||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||y}}</tt>
| <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>
|-
|-
| <nowiki>{{GameCategory|arma3|Editing|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|y}}</tt>
| <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>
|}
|}


[[Category:Templates|{{uc:{{PAGENAME}}}}]]
[[Category:Templates|{{uc:{{PAGENAME}}}}]]
</noinclude>
</noinclude>

Revision as of 23:24, 31 December 2020

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=}}

  • 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
Examples
Code Result
{{GameCategory}} N/A
{{GameCategory|arma1}} [[Category: {{Name|arma1|cat}}|SORTKEY]]
End result: [[Category: ArmA: Armed Assault|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