Difference between revisions of "Template:0"

From blackwiki
Jump to navigation Jump to search
blackwiki>Verdy p
m
m (30 revisions imported)
 
(18 intermediate revisions by 15 users not shown)
Line 1: Line 1:
 
<includeonly><span style="visibility:hidden;color:transparent;">{{{1|0}}}</span></includeonly><noinclude>
 
<includeonly><span style="visibility:hidden;color:transparent;">{{{1|0}}}</span></includeonly><noinclude>
Inserts a visibility:hidden and color:transparent (i.e. invisible) zero (0) character. It is used for padding statistics and other numbers in table columns so that they line up properly.
+
{{documentation}}
 
 
The invisible zero may be replaced by any other string to make invisible, by specifying the string as the first optional parameter; this will be useful to make numeric columns in tables sortable (by inserting extra invisitble zeroes, thousands separators, decimal point) like in:
 
<pre><nowiki>
 
{{0|0,000,0}}12{{0|.00}} km
 
{{0|0,000,}}212.5{{0|0}} km
 
{{0|0,00}}3,212.51 km
 
</nowiki></pre>
 
These hidden characters are part of the string used for collation when sorting tables, even though thy are not visible (but they still take space and numeric columns are correctly aligned as if they were present.
 
[[Category:Function templates|{{PAGENAME}}]]
 
[[ar:قالب:0]]
 
[[de:Vorlage:0]]
 
[[fr:Modèle:0]]
 
[[hu:Sablon:0]]
 
[[ru:Шаблон:0]]
 
 
</noinclude>
 
</noinclude>

Latest revision as of 09:03, 30 September 2020

Usage

This template inserts an invisible (visibility:hidden and color:transparent) zero (0) character. It is used for padding statistics and other numbers in table columns so that they line up properly.

The invisible zero may in fact be replaced by any other string (which regardless, is made invisible), by specifying the string as the first optional parameter. This is useful to "visually pad out" equivalent length rows in numeric columns in such tables. This is accomplished by inserting extra invisible zeroes, thousands separators, or decimal points prefixing and suffixing the numeric field, (adjusted to pad to the length of the largest numeric value) like in example one.

Examples

Input Displays as

{{0|00,0}}12{{0|.00}} km
{{0|00,0}}24.{{0|00}} km
{{0|00,}}212.5{{0|0}} km
{{0|0}}3,212.51 km
{{0|}}16,789.01 km
20,111.05 km

00,012.00 km
00,024.00 km
00,212.50 km
03,212.51 km
16,789.01 km
20,111.05 km

Note: The null template, {{0|}}, used in the second to last line, produces the same alignment effect as omitting the template entirely. However, the null template can be useful for preserving the alignment within the wikicode.

Note also OpenType fonts feature tnum/pnum CSS font-variant-numeric:tabular-nums, font-variant-numeric:proportional-nums, Template:Unichar, Template:Unichar and Template:Unichar.

This template is smarter than {{padleft:}} magic word; also MediaWiki: Help:Magic_words § Formatting.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.

TemplateData for 0

This template inserts an invisible (visibility:hidden and color:transparent) zero (0) character. It is used for padding statistics and other numbers in table columns so that they line up properly. The invisible zero may in fact be replaced by any other string (which regardless, is made invisible), by specifying the string as the first optional parameter. This is useful to "visually pad out" equivalent length rows in numeric columns in such tables. This is accomplished by inserting extra invisible zeroes, thousands separators, or decimal points prefixing and suffixing the numeric field, (adjusted to pad to the length of the largest numeric value).

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Hidden string1

no description

Default
0
Example
00,0
Stringoptional