Template:Brand: Difference between revisions

From Inkipedia, the Splatoon wiki
(The template now properly handles brands which are named the same as something else (amiibo, Nintendo, Sheldon's Picks, etc.) and ones that point to disambiguation pages (Custom, etc.). Also added a documentation note clarifying it works for weapon brands)
(Made this function like the other templates. Added a helper category for quicker fixing of the issues this change will cause.)
Line 1: Line 1:
<includeonly>[[File:{{#switch:{{#if:{{{game|}}}|{{{game}}}|Splatoon}}
<includeonly>[[File:{{{1|S}}}_Brand_{{{2|SquidForce}}}.png|{{#iferror:{{#expr:{{{3|24}}}}}|24}}px|{{{2|SquidForce}}}|link={{{2|SquidForce}}}{{#ifexist:{{{2|SquidForce}}}_(brand)|_(brand)}}]]{{#ifeq:{{{3|}}}|icononly||{{#ifeq:{{{4|}}}|icononly||
|Splatoon  = S
&#32;[[{{{2}}}{{#ifexist:{{{2}}}_(brand)|_(brand)}}|{{{2}}}]]}}}}<!--helper code-->{{#if:{{{game|}}}|[[Category:Pages that use the old format of the Brand template]]}}{{#if:{{{icononly|}}}|[[Category:Pages that use the old format of the Brand template]]}}{{#ifeq:{{{1|}}}|S||{{#ifeq:{{{2|}}}|S2|[[Category:Pages that use the old format of the Brand template]]}}}}<!--/helper code--></includeonly><noinclude>__NOTOC__
|Splatoon 2 = S2
|#default  = S
}}_Brand_{{{1|SquidForce}}}.png|{{{2|24px}}}|{{{1|SquidForce}}}|link={{{1|SquidForce}}}]]{{#ifeq:{{{icononly|}}}|true||
&#32;[[{{{1}}}{{#ifexist:{{{1}}}_(brand)|_(brand)}}|{{{1}}}]]
}}</includeonly><noinclude>__NOTOC__
Displays an inline [[Brand]] icon with a text link.<br />If a page named "<name>_(brand)" exists, the link will point to that page, but will still only show <name> as the text.
Displays an inline [[Brand]] icon with a text link.<br />If a page named "<name>_(brand)" exists, the link will point to that page, but will still only show <name> as the text.


{{t|Brand|game|name|size|icononly}}
=== Parameters ===
=== Parameters ===
{|
{|
|- style="vertical-align: top;"
|<code>game</code>||Unnamed||The game that the Brand belongs to. Must be one of the following:
*<code>S</code> for Splatoon
*<code>S2</code> for Splatoon 2
|-
|-
|<code>name</code>||Unnamed.||The English name of the Brand. Can be either a [[Brand|gear brand]] or a [[weapon brand]].
|<code>name</code>||Unnamed.||The English name of the Brand. Can be either a [[Brand|gear brand]] or a [[weapon brand]].
|-
|-
|<code>size</code>||Unnamed, optional.||A Mediawiki image size parameter for the icon. The default size is 24px.
|<code>size</code>||Unnamed, optional.||The size of the icon. The default size is 24.
|- style="vertical-align: top;"
|<code>game</code>||Optional.||The game that the Brand belongs to. The default value is "Splatoon". Must be one of the following:
*Splatoon
*Splatoon 2
|-
|-
|<code>icononly</code>||Optional.||If present and "true", the text label will be omitted.
|<code>icononly</code>||Unnamed, Optional.||If present, the text label will be omitted.
|}
|}


=== Examples ===
=== Examples ===
==== Markup ====
==== Markup ====
<nowiki>{{Brand|Krak-On}}<br />
<pre>
{{Brand|Krak-On|48px}}<br />
{{Brand|S|Krak-On}}<br />
{{Brand|Krak-On|game=Splatoon 2}}<br />
{{Brand|S|Krak-On|48}}<br />
{{Brand|Krak-On|icononly=true}}<br />
{{Brand|S2|Krak-On}}<br />
{{Brand|amiibo}}<br />
{{Brand|S|Krak-On|icononly}}<br />
{{Brand|Custom}}</nowiki>
{{Brand|S2|Krak-On|48|icononly}}<br />
{{Brand|S|amiibo}}<br />
{{Brand|S|Custom}}
</pre>


==== Output ====
==== Output ====
{{Brand|Krak-On}}<br />
{{Brand|S|Krak-On}}<br />
{{Brand|Krak-On|48px}}<br />
{{Brand|S|Krak-On|48}}<br />
{{Brand|Krak-On|game=Splatoon 2}}<br />
{{Brand|S2|Krak-On}}<br />
{{Brand|Krak-On|icononly=true}}<br />
{{Brand|S|Krak-On|icononly}}<br />
{{Brand|amiibo}}<br />
{{Brand|S2|Krak-On|48|icononly}}<br />
{{Brand|Custom}}
{{Brand|S|amiibo}}<br />
{{Brand|S|Custom}}
</noinclude>
</noinclude>

Revision as of 10:11, 14 February 2018

Displays an inline Brand icon with a text link.
If a page named "<name>_(brand)" exists, the link will point to that page, but will still only show <name> as the text.

{{Brand|<game>|<name>|<size>|<icononly>}}

Parameters

game Unnamed The game that the Brand belongs to. Must be one of the following:
  • S for Splatoon
  • S2 for Splatoon 2
name Unnamed. The English name of the Brand. Can be either a gear brand or a weapon brand.
size Unnamed, optional. The size of the icon. The default size is 24.
icononly Unnamed, Optional. If present, the text label will be omitted.

Examples

Markup

{{Brand|S|Krak-On}}<br />
{{Brand|S|Krak-On|48}}<br />
{{Brand|S2|Krak-On}}<br />
{{Brand|S|Krak-On|icononly}}<br />
{{Brand|S2|Krak-On|48|icononly}}<br />
{{Brand|S|amiibo}}<br />
{{Brand|S|Custom}}

Output

Krak-On Krak-On
Krak-On Krak-On
Krak-On Krak-On
Krak-On
Krak-On
amiibo amiibo
Custom Custom