Difference between revisions of "Template:Navigation"
Dinoguy1000 (talk | contribs) (more tracking (including for defined but empty {{{[Oo]ther2}}}, which wasn't previously tracked)) |
Dinoguy1000 (talk | contribs) ({{Target of}}) |
||
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ #vardefine: $mode | + | {{ #if: {{ #var: $template:navigation }} |
+ | | [[Category:Pages with multiple ((Navigation)) transclusions]] | ||
+ | | {{ #ifeq: {{NAMESPACE}} | {{ns:Template}} || {{ #vardefine: $template:navigation | 1 }} }} | ||
+ | }}{{ #vardefine: $mode | {{ lc: {{{mode|}}} }} | ||
}}{{ #vardefine: $pagename | {{Normalized pagename|{{PAGENAME}}}} | }}{{ #vardefine: $pagename | {{Normalized pagename|{{PAGENAME}}}} | ||
− | + | }}{{ #vardefine: $name | {{ #if: {{{demo|}}} | {{PAGENAME:{{{demo}}}}} | {{ #var: $pagename }} }} | |
− | }}{{ #vardefine: $name | {{ #if: {{{demo|}}} | {{ | + | }}{{ #vardefine: $ns | {{ #if: {{{demo|}}} | {{NAMESPACE:{{{demo}}}}} | {{NAMESPACE}} }} |
− | }}{{ #vardefine: $ | + | }}{{ #vardefine: $linked-name | {{ #show: {{ #var: $name }} |?English name (linked) |default=[[{{ #var: $name }}]] }} |
− | + | }}{{ #vardefine: $show-name | {{target of|{{ #var: $pagename }}}} | |
− | }}{{ #vardefine: $show-name | {{ | + | }}{{ #ifeq: {{ #var: $ns }} | Card Gallery | __NOTOC__ }}<div class="mobile-show">'''"{{ #var: $linked-name }}"''': {{Card info links|{{ #var: $show-name }}}}</div>{{Navbox |
− | }}{{ #ifeq: {{ #var: $ns }} | Card Gallery | __NOTOC__ }}<div class="mobile-show">''' | + | | title = "{{ #var: $linked-name }}" |
− | | title = | ||
− | |||
| navbar = plain | | navbar = plain | ||
| state = plain | | state = plain | ||
| listclass = hlist | | listclass = hlist | ||
− | | bodystyle = | + | | bodystyle = width: auto; display: inline-block; position: relative; left: 50%; transform: translateX(-50%);<!-- https://stackoverflow.com/a/5712620/1488311 "Solution without container div" --> font-size: 90%; margin-bottom: 1em; |
| titlestyle = font-size: 95%; | | titlestyle = font-size: 95%; | ||
− | + | | list1 = <!-- TODO: get appropriate data from the card page and pass it to {{Card info links}} (same for the mobile-show links above) --> | |
− | | list1 = | ||
* {{Related page link|Card Gallery|{{{demo|}}}|label=Gallery}}<!-- | * {{Related page link|Card Gallery|{{{demo|}}}|label=Gallery}}<!-- | ||
-->{{ #switch: {{ #var: $mode }} <!-- only OCG/TCG cards and Tokens get rulings --> | -->{{ #switch: {{ #var: $mode }} <!-- only OCG/TCG cards and Tokens get rulings --> | ||
Line 38: | Line 38: | ||
-->{{ #switch: {{ #var: $mode }} <!-- tokens and tip/strategy cards don't get names or lores --> | -->{{ #switch: {{ #var: $mode }} <!-- tokens and tip/strategy cards don't get names or lores --> | ||
| token | tip = | | token | tip = | ||
− | | #default = {{ # | + | | #default = {{ #if: {{PROTECTIONEXPIRY:edit|Card Names:{{ #var: $pagename }}}}<!-- [[wikipedia:Template:Linkless exists]] --> | <!-- names/lores pages only get linked to if the page already exists --> |
− | * {{Related page link|Card Names|{{{demo|}}}|label=Names}} }}{{ # | + | * {{Related page link|Card Names|{{{demo|}}}|label=Names}} }}{{ #if: {{PROTECTIONEXPIRY:edit|Card Lores:{{ #var: $pagename }}}}<!-- [[wikipedia:Template:Linkless exists]] --> | |
* {{Related page link|Card Lores|{{{demo|}}}|label=Lores}} }} }}<!-- | * {{Related page link|Card Lores|{{{demo|}}}|label=Lores}} }} }}<!-- | ||
− | -->{{ #if: | + | -->{{ #if: {{{other|}}} | <br />{{{other|}}} |
}}{{IfSemantics | }}{{IfSemantics | ||
− | | {{ #if: {{ #ask: [[Main card page::{{ #var: $pagename }}]] }} | | + | | {{ #if: {{ #ask: [[Main card page::{{ #var: $pagename }}]] }} | <nowiki/> |
− | |||
{{ #ask: [[Main card page::{{ #var: $pagename }}]] | {{ #ask: [[Main card page::{{ #var: $pagename }}]] | ||
|?Medium | |?Medium | ||
Line 54: | Line 53: | ||
}} | }} | ||
}} }} | }} }} | ||
− | }} | + | }}<!-- |
− | |||
SMW and categories | SMW and categories | ||
− | + | -->[[{{ #var: $ns }} page for::{{ #var: $pagename }}| ]]{{ #switch: {{ #var: $ns }} | |
− | -->{{ #switch: {{ #var: $ns }} | + | | {{ns:3004}}<!-- Gallery --> |
− | | {{ns: | + | | {{ns:3008}}<!-- Rulings --> |
− | | {{ns: | + | | {{ns:3010}}<!-- Errata --> |
− | | {{ns: | + | | {{ns:3012}}<!-- Artworks --> |
− | | {{ns: | + | | {{ns:3014}}<!-- Tips --> |
− | | {{ns: | + | | {{ns:3016}}<!-- Trivia --> |
− | | {{ns: | + | | {{ns:3018}}<!-- Appearances --> |
− | | {{ns: | + | | {{ns:3020}}<!-- Names --> |
− | | {{ns: | + | | {{ns:3022}}<!-- Lores --> = {{ #if: {{{nocat|}}} |
− | | {{ns: | ||
| <!-- suppress content categories --> | | <!-- suppress content categories --> | ||
| [[Category:{{ #var: $ns }}]] | | [[Category:{{ #var: $ns }}]] | ||
− | }}<!-- maintenance cats - these should not be suppressed -->{{IfSemantics|{{ #ifeq: {{ #var: $pagename }} | + | }}<!-- maintenance cats - these should not be suppressed -->{{IfSemantics|{{ #ifeq: {{ #var: $pagename }} | {{ #var: $show-name }} |
| <!-- card page exists at {{ #var: $pagename }} --> | | <!-- card page exists at {{ #var: $pagename }} --> | ||
| {{ #if: {{ #var: $show-name }} | | {{ #if: {{ #var: $show-name }} | ||
Line 78: | Line 75: | ||
}}[[Category:((Navigation)) transclusions to be renamed]]<!-- card page doesn't exist or is redirect --> | }}[[Category:((Navigation)) transclusions to be renamed]]<!-- card page doesn't exist or is redirect --> | ||
}} | }} | ||
− | }} | + | }}}}{{ #ifeq: {{{1|¬}}} | ¬ || [[Category:((Navigation)) transclusions with unnamed parameter]] |
− | + | }}{{ #ifeq: {{{other|¬}}} | ¬ || [[Category:((Navigation)) transclusions with "other" parameter]] | |
− | |||
− | |||
− | }}{{ #ifeq: {{{ | ||
− | |||
}}{{ #switch: {{ #var: $mode }} | }}{{ #switch: {{ #var: $mode }} | ||
| = <!-- blank or undefined --> | | = <!-- blank or undefined --> | ||
Line 92: | Line 85: | ||
| #default = [[Category:((Navigation)) transclusions with unrecognized mode values]]<!-- anything else --> | | #default = [[Category:((Navigation)) transclusions with unrecognized mode values]]<!-- anything else --> | ||
}} | }} | ||
− | | #default = {{ #switch: {{ | + | | #default = {{ #switch: {{FULLBASEPAGENAME}}<!-- all other namespaces --> |
− | | Template:Navigation | + | | Template:Navigation | Template:Navigation2 | Template:Navigation3 = <!-- no maintenance cats for Template:Navigation et al --> |
− | + | | #default = [[Category:((Navigation)) transclusions in the wrong namespace]] | |
− | | #default | ||
}} | }} | ||
− | }}{{ #if: {{{demo | + | }}{{ #if: {{{demo|}}} | [[Category:Navigation demonstrations]]<!-- demo cat --> |
− | }}<noinclude> | + | }}<!-- |
+ | check for unknown parameters | ||
+ | -->{{ #invoke: check for unknown parameters | check | ||
+ | | unknown = [[Category:((Navigation)) transclusions using unknown parameters]] | ||
+ | | showblankpositional = 1 | ||
+ | | preview = unknown <nowiki>{{Navigation}}</nowiki> parameter "_VALUE_" | ||
+ | | 1 | mode | other | nocat | demo | ||
+ | }}{{-}}<noinclude> | ||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> |
Latest revision as of 01:28, 18 May 2024
Usage
This template is used to create the navigation box at the top of Card Gallery, Rulings, Errata, Tips, Appearances, and Trivia pages. Ordinarily, this template can be used just by placing the template call {{Navigation}} on the target page. However, there are some parameters that can be used to influence the final appearance of the navbox.
Examples
{{Navigation}} |
|
{{Navigation|mode=nonGame}} If the card is only found in an anime or manga series or the Yu-Gi-Oh! Duel Monsters promotional cards set, use mode=nonGame to remove Rulings, Tips and Errata links. Shortcut: {{subst:Navigation2}} Note that the shortcut doesn't allow for any additional parameters, such as |other=[[Flame Swordsman (Bandai)|Bandai]]. |
|
{{Navigation|mode=otherGame}} If the card is only found in the Bandai series, Dungeon Dice Monsters or is video game only, you should use mode=otherGame to remove Rulings and Errata links. Shortcut: {{subst:Navigation3}} Note that the shortcut doesn't allow for any additional parameters, such as |other=[[Flame Swordsman (Bandai)|Bandai]]. |
|
{{Navigation|mode=token}} If the card is a token, you should use mode=token to remove the irrelevant links at the top of the box. |
|
{{Navigation|mode=Tip}} if the card is a Tip, Strategy or FAQ card, you should use mode=Tip to remove the Gallery, Rulings, Errata, Anime and Manga Appearances and Tips links at the top of the box. |
|
{{Navigation|other=Other links and information}} If there are any other pages relating to the card, they can be listed using this parameter. |
Tracking categories
{{Navigation}} automatically detects several different possible errors and tracks them in Category:Navigation transclusions to be checked. In additions, uses of the other
parameter are tracked in Category:((Navigation)) transclusions with "other" parameter.