Template:BadgeBox/doc: Difference between revisions

From Homecoming Wiki
Jump to navigation Jump to search
imported>Sekoia (historical)
(avoiding limitation by using variety of badges)
(link override parameter)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{documentation subpage}}__NOTOC__
{{documentation subpage}}__NOTOC__
==Overview==
==Overview==
This template is used to generate a badge box for displaying the badge graphic, badge name, and badge description for a badge.
This template is used to generate a badge box for displaying the badge graphic, badge name, and badge description for a badge.
==Usage==
==Usage==
There are three ways to use this template.
The first way is to specify the graphic, the badge name, and the badge description as thus:


<nowiki>{{BadgeBox|Image.png|Badge Name|Description}}</nowiki>
Badge data is automatically filled in from the badge article. {{tl|Badge display}} on the badge page provides the data. A combination of {{tl|Image}} and a section with heading "Description" also works, but is deprecated.
 
The second way is to omit the description. If the description is omitted, the description will automatically be filled in from the badge's article using the section titled "Description". (If there is no such section, an error occurs.)
 
<nowiki>{{BadgeBox|Image.png|Badge Name}}</nowiki>
 
The third way is to omit the graphic and the description. If omitted, they will both be automatically filled in from the badge's article using the section titled "Description" and the image displayed through the {{tl|Image}} template. (If either do not exist, an error occurs.)


<nowiki>{{BadgeBox|Badge Name}}</nowiki>
<nowiki>{{BadgeBox|Badge Name}}</nowiki>
Line 19: Line 12:
Note that some badges have a different graphic and/or a different description for heroes and villains. Most badges will work fine automatically (once set up), but some may require additional parameters to get the exact effect you want.
Note that some badges have a different graphic and/or a different description for heroes and villains. Most badges will work fine automatically (once set up), but some may require additional parameters to get the exact effect you want.


Additionally, you can supply the which= option to specify which of a set of disambig pages to refer to; the which= should refer to the parenthetical after the badge name.
Additionally, you can supply the which= option to specify which of a set of disambig pages to refer to; the which= should refer to the parenthetical after the badge name. Or, you can supply the link= option to specify the exact page title.


<nowiki>{{BadgeBox|Badge Name|which=Type}}</nowiki>
<nowiki>{{BadgeBox|Badge Name|which=Type}}</nowiki>


Additionally, you can specify a width for the left using left=. You should provide a number, which will be treated as a width in pixels. This allows a series of badge boxes to line up well.
Additionally, you can specify a width for the left using left=. You should provide a number, which will be treated as a width in pixels. This allows a series of badge boxes to line up well.
<nowiki>{{BadgeBox|Badge Name|left=number}}</nowiki>
Additionally, you can supply the monument= option to add additional information after the description, for instance the monument coordinates.
<nowiki>{{BadgeBox|Badge Name|monument=text}}</nowiki>


==Limitation==
==Limitation==
BadgeBox may only be used once per badge if you're going to let it auto-detect the description. If you call the same badge twice on one page, the second one will get a page link instead of the description. (However, we shouldn't have multiple BadgeBoxes for a single badge on a page anyway.)
 
If the data comes from a section with heading "Description", BadgeBox will work only once per badge per page. If you call BadgeBox for the same badge twice on one page, the second BadgeBox will have a page link instead of the description.
 
If the data comes from <nowiki>{{Badge display}}</nowiki>, this limitation doesn't apply.


==Examples==
==Examples==
Here is an example template call for a badge, providing a custom description:
:<nowiki>{{BadgeBox|badge_stature_03.png|Plague Stopper|Custom description.}}</nowiki>


This will output:
===Basic use===
{{BadgeBox|badge_stature_03.png|Plague Stopper|Custom description.}}
 
<pre>{{BadgeBox|Law Enforcer}}</pre>
 
{{BadgeBox|Law Enforcer}}


===Which parameter===


Here is an example template call for a badge, using the automatic description:
Pulls data from a badge article with a parenthetical disambiguation after the title, e.g., the historical [[Terminator Badge (AE)]] vs the current [[Terminator Badge]].
: <nowiki>{{BadgeBox|badge_stature_03.png|Plague Stopper}}</nowiki>


This will output:
<pre>
{{BadgeBox|badge_stature_03.png|Plague Stopper}}
{{BadgeBox|Terminator|which=AE}}
{{BadgeBox|Terminator}}
</pre>


{{BadgeBox|Terminator|which=AE}}
{{BadgeBox|Terminator}}


Here is an example template call for a badge, using the automatic description and image:
===Link parameter===
: <nowiki>{{BadgeBox|Apex}}</nowiki>


This will output:
Pulls data from a badge article with the exact page name specified.
{{BadgeBox|Apex}}


<pre>
{{BadgeBox|Silent Sentinel}}
{{BadgeBox|link=Silent Sentinel Badge}}
</pre>


Here is an example template call showing how to suppress the description completely:
{{BadgeBox|Silent Sentinel}}
: <nowiki>{{BadgeBox|Badge tourist 01.png|Apex|3=&amp;nbsp;}}</nowiki>
{{BadgeBox|link=Silent Sentinel Badge}}


This will output:
===Left parameter===
{{BadgeBox|Badge tourist 01.png|Apex|3=&nbsp;}}


Gives a smaller badge more space, to align with a large badge.


Here are some examples with the which= option:
<pre>
: <nowiki>{{BadgeBox|Resolute|which=Vet}}</nowiki>
{{BadgeBox|left=78|Top Dog}}
: <nowiki>{{BadgeBox|Badge vr months generic.png|Resolute|which=Veteran}}</nowiki>
{{BadgeBox|Atlas Tour Guide}}
: <nowiki>{{BadgeBox|Badge vr months generic.png|Resolute|Custom description.|which=Veteran}}</nowiki>
</pre>


This will output:
{{BadgeBox|left=78|Top Dog}}
{{BadgeBox|Resolute|which=Vet}}
{{BadgeBox|Atlas Tour Guide}}
{{BadgeBox|Badge vr months generic.png|Resolute|which=Veteran}}
{{BadgeBox|Badge vr months generic.png|Resolute|Custom description.|which=Veteran}}


===Monument parameter===


Here is an example using the left= option:
<pre>{{BadgeBox|Intellectual|monument=* [[Intellectual Badge#Monument 1|Monument 1]] {{coords|2381|0|-1251}}}}</pre>
: <nowiki>{{BadgeBox|left=130|Enhancer}}</nowiki>
: <nowiki>{{BadgeBox|left=130|Vendor}}</nowiki>


This will output:
{{BadgeBox|Intellectual|monument=* [[Intellectual Badge#Monument 1|Monument 1]] {{coords|2381|0|-1251}}}}
{{BadgeBox|left=130|Enhancer}}
{{BadgeBox|left=130|Vendor}}


<includeonly>
<includeonly>
[[Category:Badge Templates|{{PAGENAME}}]]
[[Category:Badge Templates|{{PAGENAME}}]]
[[Category:SMW Query Templates]]
</includeonly>
</includeonly>

Latest revision as of 06:20, 18 May 2022

This is a documentation subpage for Template:BadgeBox (see that page for the template itself).
It contains usage information, categories and other content that is not part of the original template page.

Overview

This template is used to generate a badge box for displaying the badge graphic, badge name, and badge description for a badge.

Usage

Badge data is automatically filled in from the badge article. {{Badge display}} on the badge page provides the data. A combination of {{Image}} and a section with heading "Description" also works, but is deprecated.

{{BadgeBox|Badge Name}}

Note that some badges have a different graphic and/or a different description for heroes and villains. Most badges will work fine automatically (once set up), but some may require additional parameters to get the exact effect you want.

Additionally, you can supply the which= option to specify which of a set of disambig pages to refer to; the which= should refer to the parenthetical after the badge name. Or, you can supply the link= option to specify the exact page title.

{{BadgeBox|Badge Name|which=Type}}

Additionally, you can specify a width for the left using left=. You should provide a number, which will be treated as a width in pixels. This allows a series of badge boxes to line up well.

{{BadgeBox|Badge Name|left=number}}

Additionally, you can supply the monument= option to add additional information after the description, for instance the monument coordinates.

{{BadgeBox|Badge Name|monument=text}}

Limitation

If the data comes from a section with heading "Description", BadgeBox will work only once per badge per page. If you call BadgeBox for the same badge twice on one page, the second BadgeBox will have a page link instead of the description.

If the data comes from {{Badge display}}, this limitation doesn't apply.

Examples

Basic use

{{BadgeBox|Law Enforcer}}
Badge
Law Enforcer / Dirty Cop (requires hero/vigilante)

You have worked closely with the Paragon Police Department during your free time earning the Law Enforcer Day Job. Logging out in a Police Station will earn you an Experience Bonus, when you log back in, each time you complete a mission for a short time.


The Paragon Police Department has severed its ties with you now that you're a villain.

Which parameter

Pulls data from a badge article with a parenthetical disambiguation after the title, e.g., the historical Terminator Badge (AE) vs the current Terminator Badge.

{{BadgeBox|Terminator|which=AE}}
{{BadgeBox|Terminator}}
Badge

You've defeated 5000 custom enemies during published Architect missions earning yourself the Terminator badge.

Badge

The citizens of Paragon City flee in terror when they see you coming.


Given your past deeds, many of Paragon City's citizens are understandably wary of you.

Link parameter

Pulls data from a badge article with the exact page name specified.

{{BadgeBox|Silent Sentinel}}
{{BadgeBox|link=Silent Sentinel Badge}}
Badge
Silent Sentinel (-608.0, 70.0, -1890.0)[Copy]

In the 1950's the hero called 'Gargoyle' would stand watch over the city from this spot.

Badge
Silent Sentinel (-608.0, 70.0, -1890.0)[Copy]

In the 1950's the hero called 'Gargoyle' would stand watch over the city from this spot.

Left parameter

Gives a smaller badge more space, to align with a large badge.

{{BadgeBox|left=78|Top Dog}}
{{BadgeBox|Atlas Tour Guide}}
Badge
Top Dog (131.0, 319.7, -319.5)[Copy]

The top of Atlas' statue is the first place many flying heroes will go.

Badge

You've obtained this Accolade by earning every Exploration badge within Atlas Park.

Monument parameter

{{BadgeBox|Intellectual|monument=* [[Intellectual Badge#Monument 1|Monument 1]] {{coords|2381|0|-1251}}}}
Badge

You have learned the history of the Lost's attempt to control the minds of Paragon City's people.