Difference between revisions of "Template:GameCategory"

From Bohemia Interactive Community
Jump to navigation Jump to search
(Fix template)
m (Add Arma Reforger and Arma 4)
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#if:{{{1|}}}
+
<includeonly>{{#switch:{{lc:{{{1|}}}}}
|{{#if:{{{2|}}}
+
|#default= {{#if:{{{2|}}}
|[[Category: {{Name|{{{1}}}|short}}: {{{2}}}]]
+
| {{#if:{{{link|}}}
|[[Category: {{Name|{{{1}}}|short}}]]]]}}
+
| [[:Category: {{Name|{{{1}}}|cat}}: {{{2}}} | {{{text|{{Name|{{{1}}}|cat}}: {{{2}}}}}}]]
}}</includeonly><noinclude>
+
| [[ Category: {{Name|{{{1}}}|cat}}: {{{2}}} | {{#if:{{{sortKey|}}} | {{uc:{{{sortKey}}}}} | {{GameCategory/SortKey|{{Name|{{{1}}}|cat}}|{{PAGENAME}}}}}}]]
Adds a game (sub-)category to the proper format.
+
}}
 +
| {{#if:{{{link|}}}
 +
| [[:Category: {{Name|{{{1}}}|cat}} | {{{text|{{Name|{{{1}}}|cat}}}}}]]
 +
| [[ Category: {{Name|{{{1}}}|cat}} | {{#if:{{{sortKey|}}} | {{uc:{{{sortKey}}}}} | {{GameCategory/SortKey|{{Name|{{{1}}}|cat}}|{{PAGENAME}}}}}}]]
 +
}}
 +
}}
 +
|armar
 +
|arma4= {{#if:{{{link|}}}
 +
| [[:Category: {{Concat|/|{{Name|{{{1}}}|cat}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}}} | {{{text|{{Concat|/|{{Name|{{{1}}}|cat}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}}}}}}]]
 +
| [[ Category: {{Concat|/|{{Name|{{{1}}}|cat}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}}} | {{uc:{{{sortKey|{{SUBPAGENAME}}}}}}}]]
 +
}}
 +
|= -no category provided-
 +
}}</includeonly><noinclude>{{Doc/Template
 +
|descr= 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}}, {{Template|Concat}} and {{Template|GameCategory/SortKey}}.
  
== Usage ==
+
|param1= game
{{<nowiki/>GameCategory|'''''game'''''|'''''subCategory'''''}}
+
|descr1= game id, see {{Template|Name}}
* game: game id, see {{Template|Name}}
 
* subCategory: (Optional, default empty) sub-category (e.g Editing)
 
  
{| class="wikitable"
+
|param2= subCategory
|+ Examples
+
|descr2= (Optional, default empty) sub-category (e.g Editing) - for &ge; {{armaR}} can be up to 5 sub-levels
! Code
 
! Result
 
|-
 
| <nowiki>{{GameCategory}}</nowiki>
 
| {{n/a}}
 
|-
 
| <nowiki>{{GameCategory|arma2}}</nowiki>
 
| <tt><nowiki>[[Category:{{Name|arma2}}]]</nowiki></tt><br>End result: <tt><nowiki>[[Category:Arma 2]]</nowiki></tt>
 
|-
 
| <nowiki>{{GameCategory|arma3|Editing}}</nowiki>
 
| <tt><nowiki>[[Category:{{Name|arma3}}: Editing]]</nowiki></tt><br>End result: <tt><nowiki>[[Category:Arma 3: Editing]]</nowiki></tt>
 
|}
 
  
[[Category:Templates|{{uc:{{PAGENAME}}}}]]
+
|param3= link
</noinclude>
+
|descr3= (Optional, default empty - named argument) {{hl|y}} to make it a link '''to''' the category
 +
 
 +
|param4= text
 +
|descr4= (Optional, default empty - named argument) requires ''link''. The link's text (otherwise, the category name will be used)
 +
 
 +
|param5= sortKey
 +
|descr5= (Optional, default {{hl|{{<nowiki/>uc:{{<nowiki/>PAGENAME}}}}}} (see {{Template|GameCategory/SortKey}}) or {{hl|{{<nowiki/>SUBPAGENAME}}}} (for &ge; {{armaR}}) - named argument) category sort key - will be uppercased
 +
 
 +
|example1= <nowiki>{{GameCategory}}</nowiki>
 +
|result1= {{hl|{{GameCategory}}}}
 +
 
 +
|example2= <nowiki>{{GameCategory|ofpr}}</nowiki>
 +
|result2= {{hl|<nowiki>[[Category: {{Name|ofpr|cat}}|PAGENAME]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|ofpr|cat}}|PAGENAME]]}}
 +
 
 +
|example3= <nowiki>{{GameCategory|ofpr|link= y}}</nowiki>
 +
|result3= {{hl|{{GameCategory|ofpr|link= y}}}}
 +
 
 +
|example4= <nowiki>{{GameCategory|arma2|sortKey= the sort key}}</nowiki>
 +
|result4= {{hl|<nowiki>[[Category: {{Name|arma2|cat}}|THE SORT KEY]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|arma2|cat}}|THE SORT KEY]]}}
 +
 
 +
|example5= <nowiki>{{GameCategory|arma1}}</nowiki>
 +
|result5= {{hl|<nowiki>[[Category: {{Name|arma1|cat}}|PAGENAME]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|arma1|cat}}|PAGENAME]]}}
 +
 
 +
|example6= <nowiki>{{GameCategory|arma1qg}}</nowiki>
 +
|result6= {{hl|<nowiki>[[Category: {{Name|arma1qg|cat}}|PAGENAME]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|arma1qg|cat}}|PAGENAME]]}}
 +
 
 +
|example7= <nowiki>{{GameCategory|arma3|Editing}}</nowiki>
 +
|result7= {{hl|<nowiki>[[Category: {{Name|arma3|cat}}/Editing|PAGENAME]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|arma3|cat}}: Editing|PAGENAME]]}}
 +
 
 +
|example8= <nowiki>{{GameCategory|armaR|Editing|Scripting}}</nowiki>
 +
|result8= {{hl|<nowiki>[[Category: {{Name|armaR|cat}}/Editing/Scripting|PAGENAME]]</nowiki>}}<br>End result: {{hl|[[<nowiki/>Category: {{Name|armaR|cat}}/Editing/Scripting|PAGENAME]]}}
 +
 
 +
|example9= <nowiki>{{GameCategory|arma3|Editing|Scripting|link= y}}</nowiki><br><nowiki>{{GameCategory|arma4|0|1|2|3|4|5|6|7|8|9|10|link= y}}</nowiki>
 +
|result9= {{hl|{{GameCategory|arma3|Editing|Scripting|link= y}}}}<br>{{hl|{{GameCategory|arma4|0|1|2|3|4|5|6|7|8|9|10|link= y}}}}
 +
 
 +
|example10= <nowiki>{{GameCategory|ofp|link= y|text= OFP!}}</nowiki><br><nowiki>{{GameCategory|arma4|link= y|text= A4 is great :)}}</nowiki>
 +
|result10= {{GameCategory|ofp|link= y|text= OFP!}}<br>{{GameCategory|arma4|link= y|text= A4 is great :)}}
 +
}}

Latest revision as of 21:15, 17 May 2022

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}}, {{Concat}} and {{GameCategory/SortKey}}.

This template is used on these pages.

Usage

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

  • game: game id, see {{Name}}
  • subCategory: (Optional, default empty) sub-category (e.g Editing) - for ≥ Arma Reforger can be up to 5 sub-levels
  • link: (Optional, default empty - named argument) y to make it a link to the category
  • text: (Optional, default empty - named argument) requires link. The link's text (otherwise, the category name will be used)
  • sortKey: (Optional, default {{uc:{{PAGENAME}}}} (see {{GameCategory/SortKey}}) or {{SUBPAGENAME}} (for ≥ Arma Reforger) - named argument) category sort key - will be uppercased
Examples
Code Result
{{GameCategory}} -no category provided-
{{GameCategory|ofpr}} [[Category: {{Name|ofpr|cat}}|PAGENAME]]
End result: [[Category: Operation Flashpoint: Resistance|PAGENAME]]
{{GameCategory|ofpr|link= y}} Operation Flashpoint: Resistance
{{GameCategory|arma2|sortKey= the sort key}} [[Category: {{Name|arma2|cat}}|THE SORT KEY]]
End result: [[Category: Arma 2|THE SORT KEY]]
{{GameCategory|arma1}} [[Category: {{Name|arma1|cat}}|PAGENAME]]
End result: [[Category: ArmA: Armed Assault|PAGENAME]]
{{GameCategory|arma1qg}} [[Category: {{Name|arma1qg|cat}}|PAGENAME]]
End result: [[Category: ArmA: Queen's Gambit|PAGENAME]]
{{GameCategory|arma3|Editing}} [[Category: {{Name|arma3|cat}}/Editing|PAGENAME]]
End result: [[Category: Arma 3: Editing|PAGENAME]]
{{GameCategory|armaR|Editing|Scripting}} [[Category: {{Name|armaR|cat}}/Editing/Scripting|PAGENAME]]
End result: [[Category: Arma Reforger/Editing/Scripting|PAGENAME]]
{{GameCategory|arma3|Editing|Scripting|link= y}}
{{GameCategory|arma4|0|1|2|3|4|5|6|7|8|9|10|link= y}}
Arma 3: Editing
Arma 4/0/1/2/3/4
{{GameCategory|ofp|link= y|text= OFP!}}
{{GameCategory|arma4|link= y|text= A4 is great :)}}
OFP!
A4 is great :)