Template:Currency cell/doc: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(Add documentation for all args) |
(Document show_zeros) |
||
(One intermediate revision by the same user not shown) | |||
Line 37: | Line 37: | ||
This is either a comma-seperated number (like <code>1,000,000</code> for 1 gold) or an expression (like <code>6 * 10^6 / 3</code> for 2 gold) |
This is either a comma-seperated number (like <code>1,000,000</code> for 1 gold) or an expression (like <code>6 * 10^6 / 3</code> for 2 gold) |
||
===show_zeros=== |
|||
Three options: |
|||
* <code>show_zeros=all</code> (default): show all zeros after the first denomination up to copper |
|||
* <code>show_zeros=some</code>: show the zero valued denominations between the biggest and smallest denomination |
|||
* <code>show_zeros=none</code>: hide all denominations with zero value |
|||
{| class="wikitable" |
|||
! Amount |
|||
! colspan="10" | <code>show_zeros=all</code> |
|||
! colspan="10" | <code>show_zeros=some</code> |
|||
! colspan="10" | <code>show_zeros=none</code> |
|||
|- |
|||
| 0 || {{Currency cell|0|show_zeros=all}} || {{Currency cell|0|show_zeros=some}} || {{Currency cell|0|show_zeros=none}} |
|||
|- |
|||
| 1 || {{Currency cell|1|show_zeros=all}} || {{Currency cell|1|show_zeros=some}} || {{Currency cell|1|show_zeros=none}} |
|||
|- |
|||
| 2,000 || {{Currency cell|2000|show_zeros=all}} || {{Currency cell|2000|show_zeros=some}} || {{Currency cell|2000|show_zeros=none}} |
|||
|- |
|||
| 2,001 || {{Currency cell|2001|show_zeros=all}} || {{Currency cell|2001|show_zeros=some}} || {{Currency cell|2001|show_zeros=none}} |
|||
|- |
|||
| 3,002,000 || {{Currency cell|3002000|show_zeros=all}} || {{Currency cell|3002000|show_zeros=some}} || {{Currency cell|3002000|show_zeros=none}} |
|||
|- |
|||
| 4,000,002,000 || {{Currency cell|4000002000|show_zeros=all}} || {{Currency cell|4000002000|show_zeros=some}} || {{Currency cell|4000002000|show_zeros=none}} |
|||
|- |
|||
| 4,003,002,000 || {{Currency cell|4003002000|show_zeros=all}} || {{Currency cell|4003002000|show_zeros=some}} || {{Currency cell|4003002000|show_zeros=none}} |
|||
|} |
|||
===force_sign=== |
===force_sign=== |
||
Line 93: | Line 120: | ||
|} |
|} |
||
<table class="wikitable"> |
<table class="wikitable"><!-- |
||
< |
--><tr><!-- |
||
⚫ | |||
--></tr><!-- |
|||
⚫ | |||
⚫ | |||
⚫ | |||
--></table> |
|||
<tbody> |
|||
⚫ | |||
</tbody> |
|||
</table> |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
Line 112: | Line 135: | ||
|} |
|} |
||
<table class="wikitable"> |
<table class="wikitable"><!-- |
||
< |
--><tr><!-- |
||
⚫ | |||
<tr> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
</tr> |
|||
--></table> |
|||
<tbody> |
|||
⚫ | |||
</tbody> |
|||
</table> |
Revision as of 15:39, 20 November 2024
Template:Currency cell invokes function cell in Module:Currency using Lua.
Creates a table cell with a currency. These cells will always span 10 columns.
Usage
{| class="wikitable sortable"
! colspan="10" | Header
|-
| {{Currency cell|0}}
|-
| {{Currency cell|1000}}
|-
| {{Currency cell|1001}}
|-
| {{Currency cell|1}}
|-
| {{Currency cell|-1}}
|}
Header | |||||||||
---|---|---|---|---|---|---|---|---|---|
0 | |||||||||
1 | |||||||||
1 | 1 | ||||||||
1 | |||||||||
-1 |
1
The first positional argument, the amount of currency (in copper coins).
This is either a comma-seperated number (like 1,000,000
for 1 gold) or an expression (like 6 * 10^6 / 3
for 2 gold)
show_zeros
Three options:
show_zeros=all
(default): show all zeros after the first denomination up to coppershow_zeros=some
: show the zero valued denominations between the biggest and smallest denominationshow_zeros=none
: hide all denominations with zero value
Amount | show_zeros=all
|
show_zeros=some
|
show_zeros=none
| |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | |||||||||||||||||||||||||||
1 | 1 | 1 | 1 | |||||||||||||||||||||||||||
2,000 | 2 | 0 | 2 | 2 | ||||||||||||||||||||||||||
2,001 | 2 | 1 | 2 | 1 | 2 | 1 | ||||||||||||||||||||||||
3,002,000 | 3 | 2 | 0 | 3 | 2 | 3 | 2 | |||||||||||||||||||||||
4,000,002,000 | 4 | 0 | 2 | 0 | 4 | 0 | 2 | 4 | 2 | |||||||||||||||||||||
4,003,002,000 | 4 | 3 | 2 | 0 | 4 | 3 | 2 | 4 | 3 | 2 |
force_sign
Force a sign in front of the currency.
Wikitext | Output | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{{Currency cell|200100|force_sign=yes}}
|
+200 | 100 | ||||||||
{{Currency cell|-200100|force_sign=yes}}
|
-200 | 100 | ||||||||
{{Currency cell|0|force_sign=yes}}
|
±0 |
sign
Three options:
sign=first
(default): Put any sign on the first denomination only.sign=all
: Put the sign on all denominations.sign=leading
: Have a seperate aligned cell for any sign.
Amount | sign=first
|
sign=all
|
sign=leading
| |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 1 | |||||||||||||||||||||||||||
-1 | -1 | -1 | - | 1 | ||||||||||||||||||||||||||
-2,000 | -2 | -2 | - | 2 | ||||||||||||||||||||||||||
-2,001 | -2 | 1 | -2 | -1 | - | 2 | 1 | |||||||||||||||||||||||
-3,002,001 | -3 | 2 | 1 | -3 | -2 | -1 | - | 3 | 2 | 1 |
extra_class
An arbitrary string to add as an extra class to all <td>
cells.
html
With |html=yes
, output html tags instead of wikitext.
For example,
{| class="wikitable"
! colspan="10" | Head
|-
| {{Currency cell|1,000|html=no}}
|}
<table class="wikitable"><!--
--><tr><!--
--><th colspan="10">Head</th><!--
--></tr><!--
-->{{Currency cell|1,000|html=yes}}<!-- Will output some text starting "<tr" and ending "</tr>"
--></table>
Head | |||||||||
---|---|---|---|---|---|---|---|---|---|
1 |
Head | |||||||||
---|---|---|---|---|---|---|---|---|---|
1 |