Bahaipedia
Bahaipedia
Menu
About Bahaipedia
Ask a question
General help
Random page
Recent changes
In other projects
Tools
What links here
Related changes
Upload file
Special pages
Printable version
Permanent link
Page information
Template
Discussion
View history
Talk
Contributions
Create account
Log in
Navigation
About Bahaipedia
Ask a question
General help
Random page
Recent changes
In other projects
Learn more
Core topics
Bahá’í Faith
Central Figures
Teachings
Practices
Tools
What links here
Related changes
Upload file
Special pages
Printable version
Permanent link
Page information
Translations

Template:Nts/doc

From Bahaipedia
< Template:Nts
Jump to:navigation, search

This is the documentation page for Template:Nts.
This page is not intended to be viewed directly. Links using variables may appear broken; do not replace these with hardcoded page names or URLs.

Similar to Dts, Nts/doc stands for Number Table Sorting and is used to display numbers with thousands separator in a sortable table and have them numerically sorted in alphabetic sort mode.

Contents

  • 1 What it solves
  • 2 Parameters
    • 2.1 Input
    • 2.2 Output
  • 3 See also

What it solves[edit]

Formerly, for table sorting to function correctly, numbers had to be entered with not more than one thousands separator. As a workaround alphabetic sorting mode was applied, and the numbers provided with a hidden part so that alphabetic sorting corresponded with numeric sorting.

Since a mix in one column of numbers formatted for alphabetic sorting and plain numbers does not allow proper sorting, adding a number in an existing table may require putting it in the format used in that column. Also, if some table cells in a column contain text after the number, or if the numbers are preceded by some fixed text other than a currency symbol, alphabetic sorting mode is needed.

This template automatically creates the hidden <span style="display:none">&&&&&&&0123456789.&&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 with this template.

Parameters[edit]

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

Input[edit]

{{Nts|123456789.00123}}

Output[edit]

Output sent to table

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

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

See also[edit]

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


Retrieved from "https://bahaipedia.org/index.php?title=Template:Nts/doc&oldid=20736"
Category:
  • Template documentation
This page was last edited on 10 April 2008, at 15:28.
Text is available under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.
Privacy policy
About Bahaipedia
Disclaimers
Powered by MediaWiki