Template:Rarity: Difference between revisions
(add non-integer case to examples) |
(add text string functionality) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{#switch: {{{1}}} | <includeonly>{{#if: {{{text|}}} | {{{1|}}}★ | {{#switch: {{{1}}} | ||
| 1 | | 1 | ||
| 2 | | 2 | ||
Line 17: | Line 17: | ||
| 16 = [[File:{{{1}}}.png{{!}}alt={{{1}}}★{{!}}link=|{{{1}}}★]] | | 16 = [[File:{{{1}}}.png{{!}}alt={{{1}}}★{{!}}link=|{{{1}}}★]] | ||
| #default = {{{1|}}} | | #default = {{{1|}}} | ||
}} | |||
}}</includeonly><noinclude> | }}</includeonly><noinclude> | ||
==Purpose== | ==Purpose== | ||
A template that resolves an integer into its respective star png. Useful for infoboxes. | A template that resolves an integer into its respective star png or text string. Useful for infoboxes. | ||
==Parameter List== | |||
<pre> | |||
{{Rarity | |||
| <!-- Anonymous parameter. The desired value of the star png. --> | |||
|text = <!-- Whether a text string should be outputted instead of a star png. Treated as true if it's not blank. --> | |||
}} | |||
</pre> | |||
==Examples== | ==Examples== | ||
===1★=== | ===1★=== | ||
Line 30: | Line 38: | ||
<pre>{{Rarity|15}}</pre> | <pre>{{Rarity|15}}</pre> | ||
{{Rarity|15}} | {{Rarity|15}} | ||
===15★, text only=== | |||
<pre>{{Rarity|15|text=1}}</pre> | |||
{{Rarity|15|text=1}} | |||
===30★=== | ===30★=== | ||
<pre>{{Rarity|30}}</pre> | <pre>{{Rarity|30}}</pre> | ||
{{Rarity|30}} | {{Rarity|30}} | ||
</noinclude> | </noinclude> |
Latest revision as of 13:38, 21 December 2023
Purpose
A template that resolves an integer into its respective star png or text string. Useful for infoboxes.
Parameter List
{{Rarity | <!-- Anonymous parameter. The desired value of the star png. --> |text = <!-- Whether a text string should be outputted instead of a star png. Treated as true if it's not blank. --> }}
Examples
1★
{{Rarity|1}}
12.5★
{{Rarity|12.5}}
12.5
15★
{{Rarity|15}}
15★, text only
{{Rarity|15|text=1}}
15★
30★
{{Rarity|30}}
30