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

From Team Fortress Wiki
Jump to: navigation, search
(Updated documentationf for FORMAT)
(Updated dcoumentation)
Line 14: Line 14:
 
|-
 
|-
 
| FORMAT || B for '''Bold''', I for ''Italic'', and BI or IB for '''''Bold Italic'''''
 
| 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 33: Line 35:
 
|-
 
|-
 
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI}}
 
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI}}
 +
|-
 +
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI | TOOLTIP=tooltip}}
 
|}
 
|}
 
</pre>
 
</pre>
Line 51: Line 55:
 
|-
 
|-
 
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI}}
 
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI}}
|}<noinclude>[[Category:Template documentation]]</noinclude>
+
|-
 +
| {{Decimal Align | NUM = 19 | POSTFIX = % | FORMAT = BI | TOOLTIP=tooltip}}
 +
|}<noinclude>[[Category:Template documentation]]

Revision as of 12:34, 20 August 2012

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.
SEP Alternate character to use as the decimal separator, defaults to a . except for the languages ru, fr, de, pt, pl, ro, it, and hu, in which case it defaults to a ,
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 = 999.111 | P = 2 | SEP = ,}}
|-
| {{Decimal Align | NUM = 33.343 | 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
999 .11
33 .343%
19 .000%
19 .000%