Template:Currency cell/doc

From Brighter Shores Wiki
Revision as of 20:24, 20 November 2024 by Artoire (talk | contribs) (html output should be cells, not a row)
Jump to navigation Jump to search
This is a documentation subpage for Template:Currency cell.
It contains usage information, categories, and other content that is not part of the original template page.
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 Copper
1 Silver 0 Copper
1 Silver 1 Copper
1 Copper
-1 Copper
0.5 Copper
0.33 Copper

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 copper
  • show_zeros=none: hide all denominations with zero value
Amount show_zeros=some show_zeros=all show_zeros=none
0 0 Copper 0 Copper 0 Copper
1 1 Copper 1 Copper 1 Copper
2,000 2 Silver 0 Copper 2 Silver 0 Copper 2 Silver
2,001 2 Silver 1 Copper 2 Silver 1 Copper 2 Silver 1 Copper
3,002,000 3 Gold 2 Silver 0 Copper 3 Gold 2 Silver 0 Copper 3 Gold 2 Silver
4,000,002,000 4 Platinum 0 Gold 2 Silver 0 Copper 4 Platinum 0 Gold 2 Silver 0 Copper 4 Platinum 2 Silver
4,003,002,000 4 Platinum 3 Gold 2 Silver 0 Copper 4 Platinum 3 Gold 2 Silver 0 Copper 4 Platinum 3 Gold 2 Silver
Amount show_zeros=some
2,000 2 Silver 0 Copper
3,002,000 3 Gold 2 Silver 0 Copper

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 Silver 100 Copper
{{Currency cell|-200100|force_sign=yes}} -200 Silver 100 Copper
{{Currency cell|0|force_sign=yes}} ±0 Copper

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 Copper 1 Copper 1 Copper
-1 -1 Copper -1 Copper - 1 Copper
-2,000 -2 Silver 0 Copper -2 Silver -0 Copper - 2 Silver 0 Copper
-2,001 -2 Silver 1 Copper -2 Silver -1 Copper - 2 Silver 1 Copper
-3,002,001 -3 Gold 2 Silver 1 Copper -3 Gold -2 Silver -1 Copper - 3 Gold 2 Silver 1 Copper

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 Silver 0 Copper
Head1Head2
Text1Silver0Copper