Difference between revisions of "Template:Rarity"
Dinoguy1000 (talk | contribs) (rm the need to include "Rare" when providing a rarity name (except for the obvious case of "Rare" itself); make Common/C the default case) |
Dinoguy1000 (talk | contribs) (no, bad dino! don't set #default or everything breaks forever >=( ) |
||
Line 1: | Line 1: | ||
{{ #switch: {{ #replace: {{ lc: {{{1}}} }} | {{ #ifeq: {{ lc: {{{1}}} }} | rare || rare }} }} | {{ #switch: {{ #replace: {{ lc: {{{1}}} }} | {{ #ifeq: {{ lc: {{{1}}} }} | rare || rare }} }} | ||
− | | c | common | + | | c | common = {{ #if: {{{full|}}} | Common | C }} |
| nr | normal = {{ #if: {{{full|}}} | Normal Rare | NR }} | | nr | normal = {{ #if: {{{full|}}} | Normal Rare | NR }} | ||
| sp | short print = {{ #if: {{{full|}}} | Short Print | SP }} | | sp | short print = {{ #if: {{{full|}}} | Short Print | SP }} |
Revision as of 21:38, 30 June 2014
Usage
This template is used to standardize rarity names/abbreviations for templates, so they don't have to implement such a check locally. It currently supports all official rarities and their abbreviations, and is not case-sensitive. The template doesn't return anything when fed unsupported values, which can be used for error-checking.
Basic usage is {{rarity|rarity}}
, outputting the abbreviation for the given rarity. The full name can be output instead by using the {{{full}}}
parameter.
Examples
Code | Result | Code | Result |
---|---|---|---|
{{rarity|Common}} |
C | {{rarity|C}} |
C |
{{rarity|common}} |
C | {{rarity|c}} |
C |
{{rarity|Common|full=yes}} |
Common | {{rarity|C|full=yes}} |
Common |
{{rarity|Rare}} |
R | {{rarity|R}} |
R |
{{rarity|Ghost Rare}} |
GR | {{rarity|GR}} |
GR |
{{rarity|Foo}} |
{{rarity|BLA}} |
||
{{rarity|}} |
{{rarity}} |