Permanently protected template

Difference between revisions of "Template:Navigation"

From Yugipedia
Jump to: navigation, search
m (Some spacing below)
(Clearing after navbox to avoid images getting pushed upwards)
 
(54 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Navbox
+
{{ #if: {{ #var: $template:navigation }}
| title      = '''[[{{ #if: {{{demo|}}} | {{{demo}}} | {{ #if: {{{name|}}} | {{{name}}} | {{PAGENAME}} }}{{ #if: {{{1|}}} | {{!}}{{{1}}} }} }}]]'''
+
  | [[Category:Pages with multiple ((Navigation)) transclusions]]
 
+
  | {{ #ifeq: {{NAMESPACE}} | {{ns:Template}} || {{ #vardefine: $template:navigation | 1 }} }}
 +
}}{{ #vardefine: $mode        | {{ lc: {{{mode|}}} }}
 +
}}{{ #vardefine: $pagename    | {{Normalized pagename|{{PAGENAME}}}}
 +
}}{{ #vardefine: $name        | {{ #if: {{{demo|}}} | {{PAGENAME:{{{demo}}}}} | {{ #var: $pagename }} }}
 +
}}{{ #vardefine: $ns          | {{ #if: {{{demo|}}} | {{NAMESPACE:{{{demo}}}}} | {{NAMESPACE}} }}
 +
}}{{ #vardefine: $linked-name  | {{ #show: {{ #var: $name }} |?English name (linked) |default=[[{{ #var: $name }}]] }}
 +
}}{{ #vardefine: $show-name    | {{ #show: {{ #var: $pagename }} | ?Page name }}
 +
}}{{ #ifeq: {{ #var: $ns }} | Card Gallery | __NOTOC__ }}<div class="mobile-show">'''"{{ #var: $linked-name }}"''': {{Card info links|{{ #var: $show-name }}}}</div>{{Navbox
 +
| title      = "{{ #var: $linked-name }}"
 
| navbar    = plain
 
| navbar    = plain
 
| state      = plain
 
| state      = plain
| bodystyle  = width: auto; background: #F9F9F9; padding: 5px 4px; font-size: 90%; margin-bottom: 20px
+
| listclass  = hlist
 +
| 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) -->
<!--
+
* {{Related page link|Card Gallery|{{{demo|}}}|label=Gallery}}<!--
 
+
-->{{ #switch: {{ #var: $mode }}                 <!-- only OCG/TCG cards and Tokens get rulings -->
The code used to create the links is ripe for being templated, but I've had my fill for now. =)
+
     | nongame | tip        =  
If someone decides to do so before I get around to it, be sure to also update {{CardTable2}} to use the template.
+
    | #default              =  
 
+
* {{Related page link|Card Rulings|{{{demo|}}}|label=Rulings}} }}<!--
-->
+
-->{{ #if: {{ #var: $mode }} ||                   <!-- only OCG/TCG cards get errata -->
| list1      = {{
+
* {{Related page link|Card Errata|{{{demo|}}}|label=Errata}} }}<!--
    #ifeq: {{ lc: {{{mode}}} }} | spirit          <!-- spirits don't get galleries -->
+
-->{{ #switch: {{ #var: $mode }}                  <!-- tip/strategy cards don't get artworks -->
    || [[{{ #if: {{{demo|}}} | Card Gallery:{{{demo}}} | {{ #if: {{ #if: {{ #pos: {{PAGENAME}} | = }} || {{IfSemantics|{{ #ask: [[Card Gallery page for::{{PAGENAME}}]] | link=none }}}} }} | {{ #ask: [[Card Gallery page for::{{PAGENAME}}]] | link=none }} | Card Gallery:{{PAGENAME}} }} }}|Gallery]] -  
+
     | tip                   =  
  }} {{
+
     | #default             =  
    #if: {{{mode|}}}                              <!-- only OCG/TCG cards get rulings or errata -->
+
* {{Related page link|Card Artworks|{{{demo|}}}|label=Artworks}} }}<!--
     || [[{{ #if: {{{demo|}}} | Card Rulings:{{{demo}}} | {{ #if: {{ #if: {{ #pos: {{PAGENAME}} | = }} || {{IfSemantics|{{ #ask: [[Card Rulings page for::{{PAGENAME}}]] | link=none }}}} }} | {{ #ask: [[Card Rulings page for::{{PAGENAME}}]] | link=none }} | Card Rulings:{{PAGENAME}} }} }}|Rulings]] - [[{{ #if: {{{demo|}}} | Card Errata:{{{demo}}} | {{ #if: {{ #if: {{ #pos: {{PAGENAME}} | = }} || {{IfSemantics|{{ #ask: [[Card Errata page for::{{PAGENAME}}]] | link=none }}}} }} | {{ #ask: [[Card Errata page for::{{PAGENAME}}]] | link=none }} | Card Errata:{{PAGENAME}} }} }}|Errata]] -  
+
-->{{ #switch: {{ #var: $mode }}                  <!-- only OCG/TCG/Bandai/DDM/VG cards get tips -->
  }} {{
+
     | token | nongame | tip =  
    #switch: {{ lc: {{{mode}}} }}                  <!-- only OCG/TCG/Bandai/DDM/VG cards get tips -->
+
     | #default             =  
     | token | nongame | spirit | tip =  
+
* {{Related page link|Card Tips|{{{demo|}}}|label=Tips}} }}
     | #default                       = [[{{ #if: {{{demo|}}} | Card Tips:{{{demo}}} | {{ #if: {{ #if: {{ #pos: {{PAGENAME}} | = }} || {{IfSemantics|{{ #ask: [[Card Tips page for::{{PAGENAME}}]] | link=none }}}} }} | {{ #ask: [[Card Tips page for::{{PAGENAME}}]] | link=none }} | Card Tips:{{PAGENAME}} }} }}|Tips]] -  
+
* {{Related page link|Card Trivia|{{{demo|}}}|label=Trivia}}<!--
  }} {{
+
-->{{ #switch: {{ #var: $mode }}                 <!-- tip/strategy cards don't get appearances -->
    #switch: {{ lc: {{{mode}}} }}                  <!-- tokens and tip/strategy cards don't get appearances -->
+
     | tip                  =
     | token | tip =  
+
    | #default              =
     | #default   = [[{{ #if: {{{demo|}}} | Card Appearances:{{{demo}}} | {{ #if: {{ #if: {{ #pos: {{PAGENAME}} | = }} || {{IfSemantics|{{ #ask: [[Card Appearances page for::{{PAGENAME}}]] | link=none }}}} }} | {{ #ask: [[Card Appearances page for::{{PAGENAME}}]] | link=none }} | Card Appearances:{{PAGENAME}} }} }}|Appearances]] -  
+
* {{Related page link|Card Appearances|{{{demo|}}}|label=Appearances}} }}<!--
  }} {{
+
-->{{ #switch: {{ #var: $mode }}                  <!-- tokens and tip/strategy cards don't get names or lores -->
    #ifeq: {{ lc: {{{mode}}} }} | token            <!-- tokens don't get trivia -->
+
     | token | tip           =  
     || [[{{ #if: {{{demo|}}} | Card Trivia:{{{demo}}} | {{ #if: {{ #if: {{ #pos: {{PAGENAME}} | = }} || {{IfSemantics|{{ #ask: [[Card Trivia page for::{{PAGENAME}}]] | link=none }}}} }} | {{ #ask: [[Card Trivia page for::{{PAGENAME}}]] | link=none }} | Card Trivia:{{PAGENAME}} }} }}|Trivia]]
+
     | #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}} }}{{ #if: {{PROTECTIONEXPIRY:edit|Card Lores:{{ #var: $pagename }}}}<!-- [[wikipedia:Template:Linkless exists]] --> |  
    #switch: {{lc: {{{mode}}} }}                  <!-- tokens, spirits, and tip/strategy cards don't have a linebreak -->
+
* {{Related page link|Card Lores|{{{demo|}}}|label=Lores}} }} }}<!--
    | token        = -
+
-->{{ #if: {{{other|}}} | <br />{{{other|}}}
    | spirit | tip =
+
  }}{{IfSemantics
    | #default    = <br />
+
    | {{ #if: {{ #ask: [[Main card page::{{ #var: $pagename }}]] }} | <nowiki/>
  }} {{
+
{{ #ask: [[Main card page::{{ #var: $pagename }}]]
    #switch: {{ lc: {{{mode}}} }}                  <!-- tokens, spirits, and tip/strategy cards don't get names or lores -->
+
      |?Medium
     | token | spirit | tip =  
+
      |?Release
     | #default             = [[{{ #if: {{{demo|}}} | Card Names:{{{demo}}} | {{ #if: {{ #if: {{ #pos: {{PAGENAME}} | = }} || {{IfSemantics|{{ #ask: [[Card Names page for::{{PAGENAME}}]] | link=none }}}} }} | {{ #ask: [[Card Names page for::{{PAGENAME}}]] | link=none }} | Card Names:{{PAGENAME}} }} }}|Names]] - [[{{ #if: {{{demo|}}} | Card Lores:{{{demo}}} | {{ #if: {{ #if: {{ #pos: {{PAGENAME}} | = }} || {{IfSemantics|{{ #ask: [[Card Lores page for::{{PAGENAME}}]] | link=none }}}} }} | {{ #ask: [[Card Lores page for::{{PAGENAME}}]] | link=none }} | Card Lores:{{PAGENAME}} }} }}|Lores]] -
+
      |format=ul
  }} {{
+
      |template=pipeLink
    #switch: {{ lc: {{{mode}}} }}                 <!-- spirits and tip/strategy cards don't get artworks -->
+
      |link=none
    | spirit | tip =
+
      |sort=Medium
    | #default    = [[{{ #if: {{{demo|}}} | Card Artworks:{{{demo}}} | {{ #if: {{ #if: {{ #pos: {{PAGENAME}} | = }} || {{IfSemantics|{{ #ask: [[Card Artworks page for::{{PAGENAME}}]] | link=none }}}} }} | {{ #ask: [[Card Artworks page for::{{PAGENAME}}]] | link=none }} | Card Artworks:{{PAGENAME}} }} }}|Artworks]]
+
      }}
  }}{{
+
   }} }}
    #if: {{{Other2|}}}
 
    | {{{Other2}}}
 
  }}{{
 
    #if: {{{Other|}}}
 
    | <br/>{{{Other}}}
 
  }}
 
----
 
'''{{
 
    #switch: {{ #if: {{{demo_ns|}}} | {{{demo_ns}}} | {{NAMESPACE}} }}
 
    | Card Gallery    = Card Galleries
 
    | Card Rulings    = [[Ruling|Card Rulings]]
 
    | Card Errata      = [[Errata|Card Errata]]
 
    | #default        = {{ #if: {{{demo_ns|}}} | {{{demo_ns}}} | {{NAMESPACE}} }}
 
   }} A-Z'''
 
<div style="font-size: 95%;">{{Contents|Category:{{ #if: {{{demo_ns|}}} | {{{demo_ns}}} | {{NAMESPACE}} }}}}</div>
 
 
}}<!--
 
}}<!--
 
 
SMW and categories
 
SMW and categories
 
+
-->[[{{ #var: $ns }} page for::{{ #var: $pagename }}| ]]{{ #switch: {{ #var: $ns }}
-->{{IfSemantics
+
   | {{ns:3004}}<!-- Gallery -->
| [[{{NAMESPACE}} page for::{{PAGENAME}}| ]]
+
   | {{ns:3008}}<!-- Rulings -->
}}{{
+
   | {{ns:3010}}<!-- Errata -->
  #switch: {{NAMESPACE}}
+
   | {{ns:3012}}<!-- Artworks -->
   | {{NS:100}}<!-- Card Gallery     -->
+
   | {{ns:3014}}<!-- Tips -->
   | {{NS:102}}<!-- Card Rulings     -->
+
   | {{ns:3016}}<!-- Trivia -->
   | {{NS:104}}<!-- Card Errata     -->
+
   | {{ns:3018}}<!-- Appearances -->
   | {{NS:106}}<!-- Card Tips        -->
+
   | {{ns:3020}}<!-- Names -->
   | {{NS:108}}<!-- Card Trivia      -->
+
   | {{ns:3022}}<!-- Lores --> = {{ #if: {{{nocat|}}}
   | {{NS:112}}<!-- Card Appearances -->
 
   | {{NS:116}}<!-- Card Lores      -->
 
   | {{NS:118}}<!-- Card Artworks    -->
 
   | {{NS:120}}<!-- Card Names      --> = {{
 
    #if: {{{nocat|}}}
 
 
     | <!-- suppress content categories -->
 
     | <!-- suppress content categories -->
     | [[Category:{{NAMESPACE}}|{{PAGENAME}}]]
+
     | [[Category:{{ #var: $ns }}]]
   }}<!-- maintenance cats - these should not be suppressed -->{{IfSemantics|{{
+
   }}<!-- maintenance cats - these should not be suppressed -->{{IfSemantics|{{ #ifeq: {{ #var: $pagename }} | {{ #var: $show-name }}
    #ifeq: {{PAGENAME}} | {{ #show: {{PAGENAME}} | ?Page Name }}
+
     | <!-- card page exists at {{ #var: $pagename }} -->
     | <!-- card page exists at {{PAGENAME}} -->
+
     | {{ #if: {{ #var: $show-name }}
     | {{
+
      | {{Mbox
      #if: {{ #pos: {{PAGENAME}} | = }}
+
        | type = move
      | <!-- hack to keep "Damage = Reptile" info pages out of the tracking category -->
+
        | text = '''This page should be [{{fullurl:Special:MovePage/{{FULLPAGENAMEE}}|wpNewTitle={{urlencode:{{ #var: $ns }}:{{ #var: $show-name }}}}&wpReason={{urlencode:per main page}}&wpLeaveRedirect=0}} renamed]''' to "{{ #var: $ns }}:{{ #var: $show-name }}" per its [[{{ #var: $show-name }}|main card article]].<br />After renaming, please null-edit [{{fullurl:{{ #var: $ns }}:{{ #var: $show-name }}|action=edit}} this page], ''and then'' the [{{fullurl:{{ #var: $show-name }}|action=edit}} main card article], to properly update this notice.
      | {{ #if: {{ #show: {{PAGENAME}} |?Page Name }} | {{Rename|{{NAMESPACE}}:{{ #show: {{PAGENAME}} | ?Page Name }}|per main page}} }}[[Category:Navigation transclusions to be checked|N{{PAGENAME}}{{NAMESPACE}}]]<!-- 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]]
    #if: {{{name|¬}}}
+
  }}{{ #ifeq: {{{other|¬}}} | ¬ || [[Category:((Navigation)) transclusions with "other" parameter]]
    || [[Category:Navigation transclusions to be checked|P{{PAGENAME}}{{NAMESPACE}}]]<!-- {{{name}}} used but empty -->
+
  }}{{ #switch: {{ #var: $mode }}
 +
    |          = <!-- blank or undefined -->
 +
    | nongame  = [[Category:((Navigation)) transclusions with "nongame" mode value]]
 +
    | othergame = [[Category:((Navigation)) transclusions with "othergame" mode value]]
 +
    | tip      = [[Category:((Navigation)) transclusions with "tip" mode value]]
 +
    | token    = [[Category:((Navigation)) transclusions with "token" mode value]]
 +
    | #default  = [[Category:((Navigation)) transclusions with unrecognized mode values]]<!-- anything else -->
 
   }}
 
   }}
   | #default<!-- everything else -->    = {{
+
   | #default = {{ #switch: {{FULLBASEPAGENAME}}<!-- all other namespaces -->
    #switch: {{FULLPAGENAME}}
+
     | Template:Navigation | Template:Navigation2 | Template:Navigation3 = <!-- no maintenance cats for Template:Navigation et al -->
     | Template:Navigation           | Template:Navigation/doc  | Template:Navigation/sandbox
+
     | #default = [[Category:((Navigation)) transclusions in the wrong namespace]]
    | Template:Navigation/testcases | Template:Navigation2     | Template:Navigation3 = <!-- no maintenance cats for Template:Navigation et al -->
 
     | #default                     = [[Category:Navigation transclusions to be checked|S{{FULLPAGENAME}}]]
 
 
   }}
 
   }}
}}{{
+
}}{{ #if: {{{demo|}}} | [[Category:Navigation demonstrations]]<!-- demo cat -->
  #if: {{{demo|}}}{{{demo_ns|}}}<!-- demo cat -->
+
}}<!--
  | [[Category:Navigation demonstrations|{{PAGENAME}}]]
+
check for unknown parameters
}}<noinclude>
+
-->{{ #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:45, 16 April 2024