Template:Currency cell/doc: Difference between revisions
Jump to navigation
Jump to search
<thead>
</thead>
<tbody>
Content added Content deleted
(Create initial documentation (Still need to document parameters force_sign, sign, show_zeroes, html)) |
(Add documentation for all args) |
||
Line 1: | Line 1: | ||
{{Documentation}} |
{{Documentation}} |
||
Creates a table cell with a currency. |
Creates a table cell with a currency. These cells will always span 10 columns. |
||
Usage |
==Usage== |
||
<syntaxhighlight lang="wikitext">{| class="wikitable sortable" |
<syntaxhighlight lang="wikitext">{| class="wikitable sortable" |
||
! colspan=" |
! colspan="10" | Header |
||
|- |
|- |
||
| {{Currency cell|0}} |
| {{Currency cell|0}} |
||
Line 20: | Line 20: | ||
{| class="wikitable sortable" |
{| class="wikitable sortable" |
||
! colspan=" |
! colspan="10" | Header |
||
|- |
|- |
||
| {{Currency cell|0}} |
| {{Currency cell|0}} |
||
Line 32: | Line 32: | ||
| {{Currency cell|-1}} |
| {{Currency cell|-1}} |
||
|} |
|} |
||
===1=== |
|||
The first positional argument, the amount of currency (in copper coins). |
|||
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) |
|||
===force_sign=== |
|||
Force a sign in front of the currency. |
|||
{| class="wikitable" |
|||
! Wikitext |
|||
! colspan="10" | Output |
|||
|- |
|||
| {{T|Currency cell|200100|force_sign=yes}} |
|||
| {{Currency cell|200100|force_sign=yes}} |
|||
|- |
|||
| {{T|Currency cell|-200100|force_sign=yes}} |
|||
| {{Currency cell|-200100|force_sign=yes}} |
|||
|- |
|||
| {{T|Currency cell|0|force_sign=yes}} |
|||
| {{Currency cell|0|force_sign=yes}} |
|||
|} |
|||
===sign=== |
|||
Three options: |
|||
* <code>sign=first</code> (default): Put any sign on the first denomination only. |
|||
* <code>sign=all</code>: Put the sign on all denominations. |
|||
* <code>sign=leading</code>: Have a seperate aligned cell for any sign. |
|||
{| class="wikitable" |
|||
! Amount |
|||
! colspan="10" | <code>sign=first</code> |
|||
! colspan="10" | <code>sign=all</code> |
|||
! colspan="10" | <code>sign=leading</code> |
|||
|- |
|||
| 1 || {{Currency cell|1|sign=first}} || {{Currency cell|1|sign=all}} || {{Currency cell|1|sign=leading}} |
|||
|- |
|||
| -1 || {{Currency cell|-1|sign=first}} || {{Currency cell|-1|sign=all}} || {{Currency cell|-1|sign=leading}} |
|||
|- |
|||
| -2,000 || {{Currency cell|-2000|sign=first}} || {{Currency cell|-2000|sign=all}} || {{Currency cell|-2000|sign=leading}} |
|||
|- |
|||
| -2,001 || {{Currency cell|-2001|sign=first}} || {{Currency cell|-2001|sign=all}} || {{Currency cell|-2001|sign=leading}} |
|||
|- |
|||
| -3,002,001 || {{Currency cell|-3002001|sign=first}} || {{Currency cell|-3002001|sign=all}} || {{Currency cell|-3002001|sign=leading}} |
|||
|} |
|||
===extra_class=== |
|||
An arbitrary string to add as an extra class to all <syntaxhighlight lang="html" inline><td></syntaxhighlight> cells. |
|||
===html=== |
|||
With <code>|html=yes</code>, output html tags instead of wikitext. |
|||
For example, |
|||
<syntaxhighlight lang="wikitext"> |
|||
{| class="wikitable" |
|||
! colspan="10" | Head |
|||
|- |
|||
| {{Currency cell|1,000|html=no}} |
|||
|} |
|||
<table class="wikitable"> |
|||
<thead> |
|||
<tr> |
|||
<th colspan="10">Head</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
{{Currency cell|1,000|html=yes}} <!-- Will output some text starting "<th" and ending "</th>" |
|||
</tbody> |
|||
</table> |
|||
</syntaxhighlight> |
|||
{| class="wikitable" |
|||
! colspan="10" | Head |
|||
|- |
|||
| {{Currency cell|1,000|html=no}} |
|||
|} |
|||
<table class="wikitable"> |
|||
<thead> |
|||
<tr> |
|||
<th colspan="10">Head</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
{{Currency cell|1,000|html=yes}} <!-- Will output some text starting "<th" and ending "</th>" |
|||
</tbody> |
|||
</table> |
Revision as of 15:33, 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)
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">
<thead>
<tr>
<th colspan="10">Head</th>
</tr>
</thead>
<tbody>
{{Currency cell|1,000|html=yes}} <!-- Will output some text starting "<th" and ending "</th>"
</tbody>
</table>
Head | |||||||||
---|---|---|---|---|---|---|---|---|---|
1 |
Head | |||||||||
---|---|---|---|---|---|---|---|---|---|
1 |