Template:Currency cell/doc: Difference between revisions
(Request) |
(Document rowspan/{left,right}_colspan) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Documentation}} |
{{Documentation}} |
||
''// Please allow decimal values to the currency. Recent changes have caused GP/XP columns to round to 0. An example being the Alchemist Table'' |
|||
Creates a table cell with a currency. These cells will always span 10 columns. |
Creates a table cell with a currency. These cells will always span 10 columns. |
||
Line 19: | Line 17: | ||
|- |
|- |
||
| {{Currency cell|-1}} |
| {{Currency cell|-1}} |
||
|- |
|||
| {{Currency cell|0.5}} |
|||
|- |
|||
| {{Currency cell|1/3 round 2}} |
|||
|}</syntaxhighlight> |
|}</syntaxhighlight> |
||
Line 33: | Line 35: | ||
|- |
|- |
||
| {{Currency cell|-1}} |
| {{Currency cell|-1}} |
||
|- |
|||
| {{Currency cell|0.5}} |
|||
|- |
|||
| {{Currency cell|1/3 round 2}} |
|||
|} |
|} |
||
Line 42: | Line 48: | ||
===show_zeros=== |
===show_zeros=== |
||
Three options: |
Three options: |
||
* <code>show_zeros= |
* <code>show_zeros=some</code> (default): shows zero sized denominations after the first non-zero denomination. Will hide copper/silver if no currency cell in the row has a non-zero copper/silver. |
||
* <code>show_zeros= |
* <code>show_zeros=all</code>: show all zeros after the first denomination up to copper |
||
* <code>show_zeros=none</code>: hide all denominations with zero value |
* <code>show_zeros=none</code>: hide all denominations with zero value |
||
{| class="wikitable" |
{| class="wikitable" |
||
! Amount |
! Amount |
||
⚫ | |||
! colspan="10" | <code>show_zeros=some</code> |
! colspan="10" | <code>show_zeros=some</code> |
||
⚫ | |||
! colspan="10" | <code>show_zeros=none</code> |
! colspan="10" | <code>show_zeros=none</code> |
||
|- |
|- |
||
| 0 || {{Currency cell|0|show_zeros= |
| 0 || {{Currency cell|0|show_zeros=some}} || {{Currency cell|0|show_zeros=all}} || {{Currency cell|0|show_zeros=none}} |
||
|- |
|- |
||
| 1 || {{Currency cell|1|show_zeros= |
| 1 || {{Currency cell|1|show_zeros=some}} || {{Currency cell|1|show_zeros=all}} || {{Currency cell|1|show_zeros=none}} |
||
|- |
|- |
||
| 2,000 || {{Currency cell|2000|show_zeros= |
| 2,000 || {{Currency cell|2000|show_zeros=some}} || {{Currency cell|2000|show_zeros=all}} || {{Currency cell|2000|show_zeros=none}} |
||
|- |
|- |
||
| 2,001 || {{Currency cell|2001|show_zeros= |
| 2,001 || {{Currency cell|2001|show_zeros=some}} || {{Currency cell|2001|show_zeros=all}} || {{Currency cell|2001|show_zeros=none}} |
||
|- |
|- |
||
| 3,002,000 || {{Currency cell|3002000|show_zeros= |
| 3,002,000 || {{Currency cell|3002000|show_zeros=some}} || {{Currency cell|3002000|show_zeros=all}} || {{Currency cell|3002000|show_zeros=none}} |
||
|- |
|- |
||
| 4,000,002,000 || {{Currency cell|4000002000|show_zeros= |
| 4,000,002,000 || {{Currency cell|4000002000|show_zeros=some}} || {{Currency cell|4000002000|show_zeros=all}} || {{Currency cell|4000002000|show_zeros=none}} |
||
|- |
|- |
||
| 4,003,002,000 || {{Currency cell|4003002000|show_zeros= |
| 4,003,002,000 || {{Currency cell|4003002000|show_zeros=some}} || {{Currency cell|4003002000|show_zeros=all}} || {{Currency cell|4003002000|show_zeros=none}} |
||
|} |
|} |
||
{| class="wikitable" |
|||
! Amount |
|||
! colspan="10" | <code>show_zeros=some</code> |
|||
|- |
|||
| 2,000 |
|||
| {{Currency cell|2000|show_zeros=some}} |
|||
|- |
|||
| 3,002,000 |
|||
| {{Currency cell|3002000|show_zeros=some}} |
|||
|} |
|||
Notice how there is no 0 copper column above |
|||
===force_sign=== |
===force_sign=== |
||
Line 117: | Line 136: | ||
<syntaxhighlight lang="wikitext"> |
<syntaxhighlight lang="wikitext"> |
||
{| class="wikitable" |
{| class="wikitable" |
||
! Head1 |
|||
! colspan="10" | |
! colspan="10" | Head2 |
||
|- |
|- |
||
| Text |
|||
| {{Currency cell|1,000|html=no}} |
| {{Currency cell|1,000|html=no}} |
||
|} |
|} |
||
Line 124: | Line 145: | ||
<table class="wikitable"><!-- |
<table class="wikitable"><!-- |
||
--><tr><!-- |
--><tr><!-- |
||
--><th |
--><th>Head1</th><!-- |
||
--><th colspan="10">Head2</th><!-- |
|||
--></tr><!-- |
|||
--><tr><!-- |
|||
--><td>Text</td><!-- |
|||
⚫ | |||
--></tr><!-- |
--></tr><!-- |
||
⚫ | |||
--></table> |
--></table> |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
{| class="wikitable" |
{| class="wikitable" |
||
! Head1 |
|||
! colspan="10" | |
! colspan="10" | Head2 |
||
|- |
|- |
||
| Text |
|||
| {{Currency cell|1,000|html=no}} |
| {{Currency cell|1,000|html=no}} |
||
|} |
|} |
||
Line 139: | Line 165: | ||
<table class="wikitable"><!-- |
<table class="wikitable"><!-- |
||
--><tr><!-- |
--><tr><!-- |
||
--><th |
--><th>Head1</th><!-- |
||
--><th colspan="10">Head2</th><!-- |
|||
--></tr><!-- |
|||
--><tr><!-- |
|||
--><td>Text</td><!-- |
|||
⚫ | |||
--></tr><!-- |
--></tr><!-- |
||
⚫ | |||
--></table> |
--></table> |
||
==rowspan== |
|||
Each cell will have rowspan="rowspan". Defaults to 1. |
|||
==left_colspan== |
|||
The 10 columns with the currency cell will be merged with (blank) cells to the left of this amount. |
|||
==right_colspan== |
|||
Similar to left_colspan but with cells to the right. |
|||
<syntaxhighlight lang="wikitext">{| class="wikitable" |
|||
! Left |
|||
! colspan="10" | Currency |
|||
! Right |
|||
|- |
|||
| {{Currency cell|1|left_colspan=1}} |
|||
| A |
|||
|- |
|||
| B |
|||
| {{Currency cell|2|right_colspan=1}} |
|||
|- |
|||
| D |
|||
| {{Currency cell|3|rowspan=2}} |
|||
| E |
|||
|- |
|||
| F |
|||
| G |
|||
|}</syntaxhighlight> |
|||
{| class="wikitable sortable" |
|||
! Left |
|||
! colspan="10" | Currency |
|||
! Right |
|||
|- |
|||
| {{Currency cell|1|left_colspan=1}} |
|||
| A |
|||
|- |
|||
| B |
|||
| {{Currency cell|2|right_colspan=1}} |
|||
|- |
|||
| D |
|||
| {{Currency cell|3|rowspan=2}} |
|||
| E |
|||
|- |
|||
| F |
|||
| G |
|||
|} |
Latest revision as of 09:25, 28 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}}
|-
| {{Currency cell|0.5}}
|-
| {{Currency cell|1/3 round 2}}
|}
Header | |||||||||
---|---|---|---|---|---|---|---|---|---|
0 | |||||||||
1 | |||||||||
1 | 1 | ||||||||
1 | |||||||||
-1 | |||||||||
0.5 | |||||||||
0.33 |
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=some
(default): shows zero sized denominations after the first non-zero denomination. Will hide copper/silver if no currency cell in the row has a non-zero copper/silver.show_zeros=all
: show all zeros after the first denomination up to coppershow_zeros=none
: hide all denominations with zero value
Amount | show_zeros=some
|
show_zeros=all
|
show_zeros=none
| |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | |||||||||||||||||||||||||||
1 | 1 | 1 | 1 | |||||||||||||||||||||||||||
2,000 | 2 | 2 | 0 | 2 | ||||||||||||||||||||||||||
2,001 | 2 | 1 | 2 | 1 | 2 | 1 | ||||||||||||||||||||||||
3,002,000 | 3 | 2 | 3 | 2 | 0 | 3 | 2 | |||||||||||||||||||||||
4,000,002,000 | 4 | 0 | 2 | 4 | 0 | 2 | 0 | 4 | 2 | |||||||||||||||||||||
4,003,002,000 | 4 | 3 | 2 | 4 | 3 | 2 | 0 | 4 | 3 | 2 |
Amount | show_zeros=some
| |||||||||
---|---|---|---|---|---|---|---|---|---|---|
2,000 | 2 | |||||||||
3,002,000 | 3 | 2 |
Notice how there is no 0 copper column above
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"
! Head1
! colspan="10" | Head2
|-
| Text
| {{Currency cell|1,000|html=no}}
|}
<table class="wikitable"><!--
--><tr><!--
--><th>Head1</th><!--
--><th colspan="10">Head2</th><!--
--></tr><!--
--><tr><!--
--><td>Text</td><!--
-->{{Currency cell|1,000|html=yes}}<!-- Will output some text starting "<td" and ending "</td>"
--></tr><!--
--></table>
Head1 | Head2 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Text | 1 |
Head1 | Head2 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Text | 1 |
rowspan
Each cell will have rowspan="rowspan". Defaults to 1.
left_colspan
The 10 columns with the currency cell will be merged with (blank) cells to the left of this amount.
right_colspan
Similar to left_colspan but with cells to the right.
{| class="wikitable"
! Left
! colspan="10" | Currency
! Right
|-
| {{Currency cell|1|left_colspan=1}}
| A
|-
| B
| {{Currency cell|2|right_colspan=1}}
|-
| D
| {{Currency cell|3|rowspan=2}}
| E
|-
| F
| G
|}
Left | Currency | Right | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | A | ||||||||||
B | 2 | ||||||||||
D | 3 | E | |||||||||
F | G |