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

From Team Fortress Wiki
Jump to: navigation, search
(Note about localization)
m (Whitespace trim)
Line 2: Line 2:
 
{| class="wikitable grid"
 
{| class="wikitable grid"
 
|-
 
|-
! class = "header" | Argument  
+
! class = "header" | Argument
 
! class = "header" | Meaning
 
! class = "header" | Meaning
 
|-
 
|-
Line 16: Line 16:
 
{| class="wikitable grid"
 
{| class="wikitable grid"
 
|-
 
|-
! class = "header" | Numbers  
+
! class = "header" | Numbers
 
|-
 
|-
 
| {{Decimal Align | NUM = 123.456789}}
 
| {{Decimal Align | NUM = 123.456789}}
Line 30: Line 30:
 
{| class="wikitable grid"
 
{| class="wikitable grid"
 
|-
 
|-
! class = "header" | Numbers  
+
! class = "header" | Numbers
 
|-
 
|-
 
| {{Decimal Align | NUM = 123.456789}}
 
| {{Decimal Align | NUM = 123.456789}}

Revision as of 01:30, 10 March 2011

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, maximum of nine
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 ,

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 = ,}}
|}

Would generate:

Numbers
123 .457
123
123 .000
999 .11