Difference between revisions of "Template:Card info links"
Dinoguy1000 (talk | contribs) (allow the div to be suppressed with wrapper=no) |
Dinoguy1000 (talk | contribs) (rm array name I forgot to remove when I implemented the Names/Lores check in a different way from my original plan; allow namespace names to be easily changed in the future) |
||
Line 2: | Line 2: | ||
}}{{ #arraydefine: @cil-pages <!-- this is the canonical list of namespaces; it also determines the order the links will be displayed in --> | }}{{ #arraydefine: @cil-pages <!-- this is the canonical list of namespaces; it also determines the order the links will be displayed in --> | ||
| Gallery, Rulings, Errata, Artworks, Tips, Trivia, Appearances, Names, Lores | | Gallery, Rulings, Errata, Artworks, Tips, Trivia, Appearances, Names, Lores | ||
+ | }}{{ #vardefine: $cil-ns-Gallery | Card Gallery <!-- these variables define the actual namespace names --> | ||
+ | }}{{ #vardefine: $cil-ns-Rulings | Card Rulings | ||
+ | }}{{ #vardefine: $cil-ns-Errata | Card Errata | ||
+ | }}{{ #vardefine: $cil-ns-Artworks | Card Artworks | ||
+ | }}{{ #vardefine: $cil-ns-Tips | Card Tips | ||
+ | }}{{ #vardefine: $cil-ns-Trivia | Card Trivia | ||
+ | }}{{ #vardefine: $cil-ns-Appearances | Card Appearances | ||
+ | }}{{ #vardefine: $cil-ns-Names | Card Names | ||
+ | }}{{ #vardefine: $cil-ns-Lores | Card Lores | ||
}}{{ #arraydefine: @cil-type <!-- limit links to be displayed based on card type (e.g. Tip/Strategy/FAQ Cards will [should] never have rulings) --> | }}{{ #arraydefine: @cil-type <!-- limit links to be displayed based on card type (e.g. Tip/Strategy/FAQ Cards will [should] never have rulings) --> | ||
| {{ #switch: {{ lc: {{{type}}} }} | | {{ #switch: {{ lc: {{{type}}} }} | ||
Line 20: | Line 29: | ||
| #default = {{ #arrayprint: @cil-pages }} | | #default = {{ #arrayprint: @cil-pages }} | ||
}} | }} | ||
− | }}{{ #arrayintersect: @cil-display | @cil-pages | @cil-type | @cil-medium | + | }}{{ #arrayintersect: @cil-display | @cil-pages | @cil-type | @cil-medium <!-- only links which are allowed by the specified type + medium get displayed --> |
}}{{ #arraydefine: @cil-forbidden <!-- force non-display of a given link, regardless of card type or medium --> | }}{{ #arraydefine: @cil-forbidden <!-- force non-display of a given link, regardless of card type or medium --> | ||
| {{ #ifeq: {{{gallery}}} | no | Gallery, | | {{ #ifeq: {{{gallery}}} | no | Gallery, | ||
− | }}{{ #ifeq: {{{rulings}}} | no | Rulings, | + | }}{{ #ifeq: {{{rulings}}} | no | Rulings, |
}}{{ #ifeq: {{{errata}}} | no | Errata, | }}{{ #ifeq: {{{errata}}} | no | Errata, | ||
}}{{ #ifeq: {{{artworks}}} | no | Artworks, | }}{{ #ifeq: {{{artworks}}} | no | Artworks, | ||
Line 29: | Line 38: | ||
}}{{ #ifeq: {{{trivia}}} | no | Trivia, | }}{{ #ifeq: {{{trivia}}} | no | Trivia, | ||
}}{{ #ifeq: {{{appearances}}} | no | Appearances, | }}{{ #ifeq: {{{appearances}}} | no | Appearances, | ||
− | }}{{ #if: {{ #ifeq: {{{names}}} | no | 1 }}{{ #ifexist: | + | }}{{ #if: {{ #ifeq: {{{names}}} | no | 1 }}{{ #ifexist: {{ #var: $cil-ns-Names }}:{{ #var: $cil-link }} || 1 }} | Names,<!-- only show names link if page exists, unless names=yes --> |
− | }}{{ #if: {{ #ifeq: {{{lores}}} | no | 1 }}{{ #ifexist: | + | }}{{ #if: {{ #ifeq: {{{lores}}} | no | 1 }}{{ #ifexist: {{ #var: $cil-ns-Lores }}:{{ #var: $cil-link }} || 1 }} | Lores<!-- only show lores link if page exists, unless lores=yes --> |
}} | }} | ||
}}{{ #arraydiff: @cil-display | @cil-display | @cil-forbidden <!-- diff --> | }}{{ #arraydiff: @cil-display | @cil-display | @cil-forbidden <!-- diff --> | ||
}}{{ #arraydefine: @cil-required <!-- force display of a given link, regardless of card type or medium --> | }}{{ #arraydefine: @cil-required <!-- force display of a given link, regardless of card type or medium --> | ||
| {{ #ifeq: {{{gallery}}} | yes | Gallery, | | {{ #ifeq: {{{gallery}}} | yes | Gallery, | ||
− | }}{{ #ifeq: {{{rulings}}} | yes | Rulings, | + | }}{{ #ifeq: {{{rulings}}} | yes | Rulings, |
}}{{ #ifeq: {{{errata}}} | yes | Errata, | }}{{ #ifeq: {{{errata}}} | yes | Errata, | ||
}}{{ #ifeq: {{{artworks}}} | yes | Artworks, | }}{{ #ifeq: {{{artworks}}} | yes | Artworks, | ||
Line 45: | Line 54: | ||
}} | }} | ||
}}{{ #arraymerge: @cil-display | @cil-display | @cil-required <!-- merge --> | }}{{ #arraymerge: @cil-display | @cil-display | @cil-required <!-- merge --> | ||
− | }}{{ #arrayunique: @cil-display <!-- rm dupes --> | + | }}{{ #arrayunique: @cil-display <!-- rm dupes and empty elements --> |
}}{{ #arrayintersect: @cil-display | @cil-pages | @cil-display <!-- ensure that @cil-display keeps the canonical link order --> | }}{{ #arrayintersect: @cil-display | @cil-pages | @cil-display <!-- ensure that @cil-display keeps the canonical link order --> | ||
}}{{ #ifexpr: {{ #arraysize: @cil-display }} > 0 <!-- output nothing if no links are to be displayed --> | }}{{ #ifexpr: {{ #arraysize: @cil-display }} > 0 <!-- output nothing if no links are to be displayed --> | ||
| {{ #if: {{{wrapper|}}} || <div class="hlist" style="text-align: center;"> }}{{ #arrayprint: @cil-display || $link | <nowiki/> | | {{ #if: {{{wrapper|}}} || <div class="hlist" style="text-align: center;"> }}{{ #arrayprint: @cil-display || $link | <nowiki/> | ||
− | * {{Related page link| | + | * {{Related page link| {{ #var: $cil-ns-$link }} | {{ #var: $cil-link }} | label = $link }} |
}} | }} | ||
{{ #if: {{{wrapper|}}} || </div> }} | {{ #if: {{{wrapper|}}} || </div> }} |