Difference between revisions of "Template:Rarity"
Dinoguy1000 (talk | contribs) (support inputting the abbreviation, too) |
Dinoguy1000 (talk | contribs) (fix everything with an unspecified rarity defaulting to Duel Terminal Normal Rare Parallel Rare and add a comment and default case to hopefully help prevent it happening (again >_> ) in the future) |
||
Line 1: | Line 1: | ||
− | {{ #switch: {{ #replace: {{ lc: {{{1}}} }} | {{ #ifeq: {{ lc: {{{1}}} }} | rare || rare }} }} | + | <!-- there should be *no* empty cases in the following #switch; it defaults to returning blank and empty cases interfere with that |
+ | |||
+ | -->{{ #switch: {{ #replace: {{ lc: {{{1}}} }} | {{ #ifeq: {{ lc: {{{1}}} }} | rare || rare }} }} | ||
| c | common = {{ #if: {{{full|}}} | Common | C }} | | c | common = {{ #if: {{{full|}}} | Common | C }} | ||
| nr | normal = {{ #if: {{{full|}}} | Normal Rare | NR }} | | nr | normal = {{ #if: {{{full|}}} | Normal Rare | NR }} | ||
Line 33: | Line 35: | ||
| ggr | ghost/gold = {{ #if: {{{full|}}} | Ghost/Gold Rare | GGR }} | | ggr | ghost/gold = {{ #if: {{{full|}}} | Ghost/Gold Rare | GGR }} | ||
| dpc | duel terminal parallel common = {{ #if: {{{full|}}} | Duel Terminal Parallel Common | DPC }} | | dpc | duel terminal parallel common = {{ #if: {{{full|}}} | Duel Terminal Parallel Common | DPC }} | ||
− | | dnrpr | + | | dnrpr <!-- see next item --> = {{ #if: {{{full|}}} | Duel Terminal Normal Rare Parallel Rare | DNRPR }} |
| dnpr | duel terminal normal parallel = {{ #ifeq: {{ lc: {{{1}}} }} | duel terminal normal rare parallel rare | | dnpr | duel terminal normal parallel = {{ #ifeq: {{ lc: {{{1}}} }} | duel terminal normal rare parallel rare | ||
| {{ #if: {{{full|}}} | Duel terminal Normal Rare Parallel Rare | DNRPR }} | | {{ #if: {{{full|}}} | Duel terminal Normal Rare Parallel Rare | DNRPR }} | ||
Line 41: | Line 43: | ||
| dupr | duel terminal ultra parallel = {{ #if: {{{full|}}} | Duel Terminal Ultra Parallel Rare | DUPR }} | | dupr | duel terminal ultra parallel = {{ #if: {{{full|}}} | Duel Terminal Ultra Parallel Rare | DUPR }} | ||
| dscpr | duel terminal secret parallel = {{ #if: {{{full|}}} | Duel Terminal Secret Parallel Rare | DScPR }} | | dscpr | duel terminal secret parallel = {{ #if: {{{full|}}} | Duel Terminal Secret Parallel Rare | DScPR }} | ||
+ | | <!-- blank --> | #default = <!-- return blank by default --> | ||
}}<noinclude>{{Documentation}}</noinclude> | }}<noinclude>{{Documentation}}</noinclude> |
Revision as of 21:59, 23 April 2015
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}} |