Permanently protected template

Difference between revisions of "Template:Card info links"

From Yugipedia
Jump to: navigation, search
(create)
 
(don't display a link to the names/lores pages unless they exist (or are forced to display))
Line 1: Line 1:
{{ #arraydefine: @cil-pages <!-- this is the canonical list of namespaces; it also determines the order the links will be displayed in -->
+
{{ #vardefine: $cil-link | {{ #if: {{{1|}}} | {{{1}}} | {{Normalized pagename|{{PAGENAME}}}} }}
 +
}}{{ #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
 
}}{{ #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) -->
Line 19: Line 20:
 
     | #default                                                                        = {{ #arrayprint: @cil-pages }}
 
     | #default                                                                        = {{ #arrayprint: @cil-pages }}
 
   }}
 
   }}
}}{{ #arrayintersect: @cil-display | @cil-pages | @cil-type | @cil-medium <!-- only links which are allowed by the specified type + medium get displayed -->
+
}}{{ #arrayintersect: @cil-display | @cil-pages | @cil-type | @cil-medium | @cil-names-lores <!-- 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 -->
 +
  | {{ #ifeq: {{{gallery}}} | no | Gallery,
 +
    }}{{ #ifeq: {{{rulings}}} | no | Rulings,
 +
    }}{{ #ifeq: {{{errata}}} | no | Errata,
 +
    }}{{ #ifeq: {{{artworks}}} | no | Artworks,
 +
    }}{{ #ifeq: {{{tips}}} | no | Tips,
 +
    }}{{ #ifeq: {{{trivia}}} | no | Trivia,
 +
    }}{{ #ifeq: {{{appearances}}} | no | Appearances,
 +
    }}{{ #if: {{ #ifeq: {{{names}}} | no | 1 }}{{ #ifexist: Card Names:{{ #var: $cil-link }} || 1 }} | Names,<!-- names link doesn't display if it doesn't exist, unless names=yes -->
 +
    }}{{ #if: {{ #ifeq: {{{lores}}} | no | 1 }}{{ #ifexist: Card Lores:{{ #var: $cil-link }} || 1 }} | Lores<!-- lores link doesn't display if it doesn't exist, unless lores=yes -->
 +
  }}
 +
}}{{ #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,
Line 33: Line 46:
 
}}{{ #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 -->
}}{{ #arraydefine: @cil-forbidden <!-- force non-display of a given link, regardless of card type or medium -->
 
  | {{ #ifeq: {{{gallery}}} | no | Gallery,
 
    }}{{ #ifeq: {{{rulings}}} | no | Rulings,
 
    }}{{ #ifeq: {{{errata}}} | no | Errata,
 
    }}{{ #ifeq: {{{artworks}}} | no | Artworks,
 
    }}{{ #ifeq: {{{tips}}} | no | Tips,
 
    }}{{ #ifeq: {{{trivia}}} | no | Trivia,
 
    }}{{ #ifeq: {{{appearances}}} | no | Appearances,
 
    }}{{ #ifeq: {{{names}}} | no | Names,
 
    }}{{ #ifeq: {{{lores}}} | no | Lores
 
  }}
 
}}{{ #arraydiff: @cil-display | @cil-display | @cil-forbidden <!-- diff -->
 
 
}}{{ #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 -->
 
   | <div class="hlist" style="text-align: center;">{{ #arrayprint: @cil-display || $link | <nowiki/>
 
   | <div class="hlist" style="text-align: center;">{{ #arrayprint: @cil-display || $link | <nowiki/>
* {{Related page link| Card $link | {{{1|}}} | label = $link }}
+
* {{Related page link| Card $link | {{ #var: $cil-link }} | label = $link }}
 
}}
 
}}
 
</div>
 
</div>

Revision as of 19:43, 30 August 2018