Plantilla:Nts

De Wikipedia, la enciclopedia libre
Saltar a: navegación, búsqueda
Icono de documentación de plantilla Documentación de la plantilla[ver] [editar] [historial] [purgar]

Uso

This template can be useful when building a sortable table in which a column contains both numbers and text. This template should be applied to every number in the column and should not be used outside of sortable tables.

Currently, the template works for numbers between −10308 and 10308. Numbers outside this range will sort above or below other numbers depending on sign. See the Limitations section below.

By default the output is displayed using thousands separators. To display numbers as entered, use |format=no.

The template generates a hidden "sort key" in the HTML markup which forces the JavaScript sorting algorithm to sort the column alphabetically.

Purpose

There are at two cases where this template is useful:

  1. When numbers are followed by some text
  2. When numbers are preceded by some text other than a currency symbol.

Parameters

The template has only one required parameter: a real number. These examples use the name of the redirect, {{nts}}, for brevity.

Optional parameters
  • prefix: To display some text before the number, use |prefix=some prefix
    {{nts|123456789.00123|prefix=approx. }}&&&&&&0123456789.&&1230123 456 789,00123
  • format: For unformatted output, use |format=no
    {{nts|123456789.00123}}&&&&&&0123456789.&&1230123 456 789,00123
    {{nts|123456789.00123|format=no}}&&&&&&0123456789.&&1230123 456 789,00123
  • debug: To display the sort key, use |debug=yes.
    {{nts|123456789.00123|debug=yes}}&&&&&&0123456789.&&1230123 456 789,00123
    {{nts|-123456789.00123|debug=yes}}&&&&&0-123456790.998770-123 456 789,00123
Apart from the added thousands separators the numbers are formatted as supplied (scientific notation or not, leading and trailing zeros, and a zero before the decimal point or not). This formatting does not affect the sorted order except for numbers not satisfying the limitations mentioned below.
Esta documentación está transcluida desde Plantilla:Nts/doc.
Los editores pueden experimentar en la zona de pruebas (crear) y en los casos de prueba (crear) de la plantilla.
Por favor, añade las categorías en la subpágina de documentación. Subpáginas de esta plantilla.