Difference between revisions of "Template:Video game category header"

From Yugipedia
Jump to: navigation, search
(add support for a few different subcategory types)
(more)
Line 1: Line 1:
 
{{ #vardefine: $type | {{ #explode: {{PAGENAME}} || -1 }}
 
{{ #vardefine: $type | {{ #explode: {{PAGENAME}} || -1 }}
 
}}{{ #switch: {{ #var: $type }}
 
}}{{ #switch: {{ #var: $type }}
| characters | cards | files | images | sets = {{ #vardefine: $game | {{ #explode: {{PAGENAME}} | {{ #var: $type }} }} }}
+
  | cards | characters | files | sets = {{ #vardefine: $game | {{ #explode: {{PAGENAME}} | {{ #var: $type }} }} }}
| #default = {{ #vardefine: $game | {{PAGENAME}} }}{{ #vardefine: $type }}
+
  | images = {{ #switch: {{ #explode: {{PAGENAME}} || -2 }}
}}{{ #vardefine: $game_short | {{ #switch: {{ #explode: {{PAGENAME}} || 1 }}
+
    | card      = {{ #vardefine: $type | card images }}{{ #vardefine: $game | {{ #explode: {{PAGENAME}} | {{ #var: $type }} }} }}
  | GX      = {{ #replace: {{ #var: $game }} | Yu-Gi-Oh! GX }}
+
    | character = {{ #vardefine: $type | character images }}{{ #vardefine: $game | {{ #explode: {{PAGENAME}} | {{ #var: $type }} }} }}
  | 5D's = {{ #replace: {{ #var: $game }} | Yu-Gi-Oh! 5D's }}
+
    | list      = {{ #vardefine: $type | card list images }}{{ #vardefine: $game | {{ #explode: {{PAGENAME}} | {{ #var: $type }} }} }}
  | ZEXAL    = {{ #replace: {{ #var: $game }} | Yu-Gi-Oh! ZEXAL }}
+
    | monster   = {{ #vardefine: $type | monster images }}{{ #vardefine: $game | {{ #explode: {{PAGENAME}} | {{ #var: $type }} }} }}
   | The      = {{ #replace: {{ #var: $game }} | Yu-Gi-Oh! The }}
 
  | #default = {{ #replace: {{ #var: $game }} | Yu-Gi-Oh! }}
 
 
   }}
 
   }}
}}{{ #vardefine: $game_pretty | {{ #explode: {{ #var: $game }} | ( }}
+
  | #default = {{ #vardefine: $game | {{PAGENAME}} }}{{ #vardefine: $type }}
}}This category contains pages related to {{ #if: {{ #var: $type }} | {{ #var: $type }} in }} the video game ''[[{{PAGENAME}}|{{ #var: $game_pretty }}]]''.
+
}}{{ #vardefine: $vg-abbr  | {{vg|{{ #var: $game }}}}
 +
}}{{ #vardefine: $vg      | {{vg|{{ #var: $vg-abbr }}|full=1}}
 +
}}{{ #vardefine: $vg-link  | {{vg|{{ #var: $vg-abbr }}|full=1|link=1}}
 +
}}{{ #vardefine: $vg-short | {{ #switch: {{ #explode: {{ #var: $vg-link }} || 1 }}
 +
  | GX      = {{ #replace: {{ #var: $vg-link }} | Yu-Gi-Oh! GX }}
 +
  | 5D's    = {{ #replace: {{ #var: $vg-link }} | Yu-Gi-Oh! 5D's }}
 +
  | ZEXAL    = {{ #replace: {{ #var: $vg-link }} | Yu-Gi-Oh! ZEXAL }}
 +
  | The      = {{ #replace: {{ #var: $vg-link }} | Yu-Gi-Oh! The }}
 +
  | #default = {{ #replace: {{ #var: $vg-link }} | Yu-Gi-Oh! }}
 +
  }}
 +
}}This category contains {{ #switch: {{ #var: $type }}
 +
  | files = uploaded files for
 +
  | card images = card images from
 +
  | character images = character images from
 +
  | monster images = non-card images from
 +
  | #default = pages related to {{ #if: {{ #var: $type }} | {{ #var: $type }} in }}
 +
}} the video game ''[[{{ #var: $vg-link }}|{{ #var: $vg }}]]''.
  
<includeonly>{{ #if: {{ #var: $type }} | [[Category:{{ #var: $game }}]] }}[[Category:Video games|{{ #var: $game_short }}]]</includeonly><noinclude>[[Category:Templates]]</noinclude>
+
{{ #ifeq: {{ #var: $type }} | sets
 +
  | {{ #ifexist: Template:{{ #var: $vg }} sets | {{ {{ #var: $vg }} sets }} | {{ #ifexist: Template:Boosters/{{ #var: $vg-abbr }} | {{Boosters/{{ #var: $vg-abbr }}}} }} }}
 +
}}
 +
<includeonly>{{ #if: {{ #var: $type }}
 +
  | [[Category:{{ #var: $vg }} {{ #if: {{ #pos: {{ #var: $type }} | images }} | files }}|{{ ucfirst: {{ #var: $type }} }}]]{{ #switch: {{ #var: $type }}
 +
    | cards      = [[Category:Cards by video game|{{ #var: $vg-short }}]]
 +
    | card images = [[Category:Video game card images|{{ #var: $vg-short }}]]
 +
    | characters  = [[Category:Characters by media|{{ #var: $vg-short }}]]
 +
    | files      = [[Category:Files by video game|{{ #var: $vg-short }}]]
 +
    | sets        = [[Category:Video game sets|{{ #var: $vg-short }}]]
 +
  }}
 +
  | [[Category:Video games|{{ #var: $vg-short }}]]
 +
}}</includeonly><noinclude>[[Category:Templates]]</noinclude>

Revision as of 13:49, 23 October 2019

This category contains pages related to the video game [[|]].