Difference between revisions of "Template:Decimal Align/doc"

From Team Fortress Wiki
Jump to: navigation, search
m
(PREFIX examples)
 
(9 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
{| class="wikitable grid"
 
{| class="wikitable grid"
 
|-
 
|-
! class = "header" | Argument  
+
! class = "header" | Argument
 
! class = "header" | Meaning
 
! class = "header" | Meaning
 
|-
 
|-
 
| NUM || Number to format
 
| NUM || Number to format
 
|-
 
|-
| P || Number of places after the decimal separator, defaults to three, maximum of nine
+
| P || Number of places after the decimal separator, defaults to three.
 
|-
 
|-
| SEP || Alternate character to use as the decimal separator, defaults to a <code>.</code>
+
| PREFIX || String to append to the start of the number, such as a <code>~</code> symbol.
 +
|-
 +
| POSTFIX || String to append to the end of the number, such as a <code>%</code> symbol.
 +
|-
 +
| FORMAT || B for '''Bold''', I for ''Italic'', and BI or IB for '''''Bold Italic'''''
 +
|-
 +
| TOOLTIP || Hover tooltip for the entire number, including POSTFIX if present.
 
|}
 
|}
  
Line 16: Line 22:
 
{| class="wikitable grid"
 
{| class="wikitable grid"
 
|-
 
|-
! class = "header" | Numbers  
+
! class = "header" | Numbers
 
|-
 
|-
 
| {{Decimal Align | NUM = 123.456789}}
 
| {{Decimal Align | NUM = 123.456789}}
Line 24: Line 30:
 
| {{Decimal Align | NUM = 123}}
 
| {{Decimal Align | NUM = 123}}
 
|-
 
|-
| {{Decimal Align | NUM = 999.111 | P = 2 | SEP = ,}}
+
| {{Decimal Align | NUM = {{#expr: 24 * 6 /11}}}}
 +
|-
 +
| {{Decimal Align | NUM = 999.1111 | P = 2}}
 +
|-
 +
| {{Decimal Align | NUM = 33.343 | POSTFIX = % | FORMAT = I}}
 +
|-
 +
| {{Decimal Align | NUM = 33.343 | PREFIX = ~ | FORMAT = B}}
 +
|-
 +
| {{Decimal Align | NUM = 33.343 | PREFIX = ~ | POSTFIX = % | FORMAT = I}}
 +
|-
 +
| {{Decimal Align | NUM = 33.343 | P = 0 | POSTFIX = &&&}}
 +
|-
 +
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI}}
 +
|-
 +
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI | TOOLTIP=tooltip}}
 
|}
 
|}
 
</pre>
 
</pre>
Line 30: Line 50:
 
{| class="wikitable grid"
 
{| class="wikitable grid"
 
|-
 
|-
! class = "header" | Numbers  
+
! class = "header" | Numbers
 
|-
 
|-
 
| {{Decimal Align | NUM = 123.456789}}
 
| {{Decimal Align | NUM = 123.456789}}
Line 38: Line 58:
 
| {{Decimal Align | NUM = 123}}
 
| {{Decimal Align | NUM = 123}}
 
|-
 
|-
| {{Decimal Align | NUM = 999.111 | P = 2 | SEP = ,}}
+
| {{Decimal Align | NUM = {{#expr: 24 * 6 /11}}}}
|}<noinclude>[[Category:Template documentation]]</noinclude>
+
|-
 +
| {{Decimal Align | NUM = 999.1111 | P = 2}}
 +
|-
 +
| {{Decimal Align | NUM = 33.343 | POSTFIX = % | FORMAT = I}}
 +
|-
 +
| {{Decimal Align | NUM = 33.343 | PREFIX = ~ | FORMAT = B}}
 +
|-
 +
| {{Decimal Align | NUM = 33.343 | PREFIX = ~ | POSTFIX = % | FORMAT = I}}
 +
|-
 +
| {{Decimal Align | NUM = 33.343 | P = 0 | POSTFIX = &&&}}
 +
|-
 +
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI}}
 +
|-
 +
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI | TOOLTIP=tooltip}}
 +
|}<noinclude>[[Category:Template documentation]]

Latest revision as of 06:59, 13 March 2024

This template is useful for stacking values in a table, where the numbers should be aligned based on the decimal separator. This template takes three arguments:

Argument Meaning
NUM Number to format
P Number of places after the decimal separator, defaults to three.
PREFIX String to append to the start of the number, such as a ~ symbol.
POSTFIX String to append to the end of the number, such as a % symbol.
FORMAT B for Bold, I for Italic, and BI or IB for Bold Italic
TOOLTIP Hover tooltip for the entire number, including POSTFIX if present.

So in example, the following table construct:

{| class="wikitable grid"
|-
! class = "header" | Numbers
|-
| {{Decimal Align | NUM = 123.456789}}
|-
| {{Decimal Align | NUM = 123.456789 | P = 0}}
|-
| {{Decimal Align | NUM = 123}}
|-
| {{Decimal Align | NUM = {{#expr: 24 * 6 /11}}}}
|-
| {{Decimal Align | NUM = 999.1111 | P = 2}}
|-
| {{Decimal Align | NUM = 33.343 | POSTFIX = % | FORMAT = I}}
|-
| {{Decimal Align | NUM = 33.343 | PREFIX = ~ | FORMAT = B}}
|-
| {{Decimal Align | NUM = 33.343 | PREFIX = ~ | POSTFIX = % | FORMAT = I}}
|-
| {{Decimal Align | NUM = 33.343 | P = 0 | POSTFIX = &&&}}
|-
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI}}
|-
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI | TOOLTIP=tooltip}}
|}

Would generate:

Numbers
123 .457
123
123 .000
13 .091
999 .11
33 .343%
~33 .343
~33 .343%
33 &&&
19 .000%
19 .000%