Template:Nts/doc

From Wikipedia, the free encyclopedia

This is the template documentation page for Template:Nts.

This page is not necessarily intended to be viewed directly. If it uses variables, some links may appear broken. Do not replace these variables with hardcoded page names or URLs.

Similar to Dts, Nts/doc stands for Number Table Sorting and is used to correctly sort and display numbers using thousands separators in a table when using sortable tables.

Contents

[edit] What it solves

To use Help:Sorting and have it function correctly, numbers must be entered with not more than one thousands separator. To enable the display of thousands separators in a table column containing also one or more numbers of one million or more, this template automatically creates the hidden <span style="display:none">&&&&&&&123456789.&&1230</span> 123,456,789.00123 before the actual displayed number. It forces the sorting routine to use text sort on the hidden segment, which functions correctly due to the preceding ampersands (currently till 16 digits before, and 6 digits after the decimal separator).

Negative numbers do not sort correctly.

[edit] Parameters

The template has only one parameter: a real number without thousand separators.

[edit] Input

{{Nts|123456789.00123}}

[edit] Output

Output sent to table

 <span style="display:none">&&&&&&&123456789.&&1230</span> 123,456,789.00123 

Output displayed to user
&&&&&&&123456789.&&1230123,456,789.00123

[edit] See also

  • Template:Ntsh- same as Nts, but does not display the number
  • Template:Lsc11- using non-breaking spaces instead of ampersands in a similar fashion