Template:Counterparts: Difference between revisions
Bongolium500 (talk | contribs) (making it so that, by default, the first counterpart uses the same link as {{{name}}} and the display text "The Doctor's universe" as, more often than not, this is what will be desired.) |
No edit summary |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
<infobox theme="infobox"> | <infobox theme="infobox"> | ||
<header><center><small>Alternate counterparts of</small><br/>[[{{{name|{{PAGENAME}}}}}|{{{dname|{{da smw|{{{name|{{PAGENAME}}}}}}}}}}]]</center></header> | <header><center><small>Alternate counterparts of</small><br/>[[{{{name|{{PAGENAME}}}}}|{{{dname|{{da smw|{{{name|{{PAGENAME}}}}}}}}}}]]</center></header> | ||
<navigation><center style="font-weight:500"><!--loops through all numbered arguments: {{{1}}}, {{{2}}}, etc-->{{#fornumargs: num <!--the number of the argument for the current iteration--> | <navigation><center style="font-weight:500">[[{{{1|{{{name|{{PAGENAME}}}}}}}}|{{{d1|The Doctor's universe}}}]]<!--loops through all numbered arguments: {{{1}}}, {{{2}}}, etc-->{{#fornumargs: num <!--the number of the argument for the current iteration--> | ||
| value <!--the value of the argument--> | | value <!--the value of the argument--> | ||
|{{#ifeq:{{#var:num}}|1| | |{{#ifeq:{{#var:num}}|1||<nowiki/> • [[{{#var:value}}|{{{d{{#var:num}}|{{gd|{{#var:value}}}}}}}]]}} | ||
}}</center></navigation></infobox><noinclude>{{ | }}<includeonly>{{#ifeq:{{PAGENAME}}|{{{name}}}||{{#set:counterpart={{{name|}}}}}}}</includeonly></center></navigation></infobox><noinclude>{{documentation}}[[Category:Parallel counterpart navfoboxes| ]]</noinclude> |
Latest revision as of 15:23, 22 July 2024
{{counterparts |name=page name of primary counterpart |dname=display name of primary counterpart |1=first counterpart |d1=display name of second counterpart |2=second counterpart |d2=display name of second counterpart}}
By default, the name of the primary counterpart used in the box's header is the page name of the page the template is being used on. If that is not desirable, it can optionally be specified using the name variable. This produces a link to the specified page with the display text set to the name specified but without the dab term. If a different display name should be used, that can be specified with the optional dname variable.
Counterparts are specified with numbered variables like 1 and 2. Technically, the actual "1=" bit can be omitted. However, that quickly becomes confusing when combining it with the display name variables. By default, the counterpart's dab term is used as display text. If there is no dab term, the full page name is used. If neither of these are desirable, a display name can be manually set using an optional "d" variable. For instance, if you want to specify the display name for the third counterpart, you would use the d3 variable.
It is more often than not desirable to use the same page as in the name variable for the first counterpart, along with the display text "The Doctor's universe". If this is needed, the first counterpart's variables can be left out entirely. If the same page name as in the name variable should be used as the first counterpart but with different display text, d1 can be specified as normal. For an example of this in use, see below.
In theory, the template supports infinitely many counterparts, although there is a practical limit after which performance would begin to noticeably suffer.
Example[[edit source]]
The following code produces the box on the right:
{{counterparts |name=Twelfth Doctor |2=Twelfth Doctor (Shadow World) |3=Twelfth Doctor (The Curse of Fatal Death) |d3=''The Curse of Fatal Death'' |4=Twelfth Doctor (Four Doctors) |d4=''Four Doctors''}}
Obviously, since it's missing "the", this is an instance where creating a dedicated template would serve the situation better: in this case, {{Twelfth Doctor counterparts}}.