Esta plantilla puede resultar útil al crear una tabla ordenable en la que una columna contiene tanto números como texto. Esta plantilla debe aplicarse a todos los números de la columna y no debe utilizarse fuera de las tablas ordenables.
Actualmente, la plantilla funciona con números entre −10 308 y 10 308. Los números fuera de este rango se ordenarán por encima o por debajo de otros números según el signo. Consulta la sección Limitaciones a continuación.
De forma predeterminada, el resultado se muestra con separadores de miles. Para mostrar los números tal como se ingresaron, use |format=no
.
La plantilla genera una "clave de clasificación" oculta en el marcado HTML que obliga al algoritmo de clasificación de JavaScript a ordenar la columna alfabéticamente.
Hay dos casos en los que esta plantilla es útil:
La plantilla solo tiene un parámetro obligatorio: un número real. Estos ejemplos utilizan el nombre de la redirección, {{ nts }} , para abreviar.
prefix
:Para mostrar algún texto antes del número, utilice|prefix=some prefix
{{nts|123456789.00123|prefix=approx. }}
→ aprox. 123.456.789,00123format
:Para salida sin formato, utilice|format=no
{{nts|123456789.00123}}
→ 123.456.789,00123{{nts|123456789.00123|format=no}}
→ 123456789.00123debug
:Para mostrar la clave de ordenación, utilice |debug=yes
.{{nts|123456789.00123|debug=yes}}
→ 7008123456789001230♠ 123.456.789,00123{{nts|-123456789.00123|debug=yes}}
→ 2991876543210998770♠ −123.456.789,00123Aparte de los separadores de miles añadidos, los números se formatean tal como se proporcionan (notación científica o no, ceros iniciales y finales, y un cero antes del punto decimal o no). Este formato no afecta el orden de clasificación, excepto en el caso de los números que no cumplen las limitaciones mencionadas a continuación.
TemplateData para ordenar la tabla de números
La clave de ordenación es un número de diecinueve dígitos. En el caso de los números que se encuentran dentro de un rango, los primeros cuatro dígitos se determinan mediante el signo y el orden de magnitud del número , y los siguientes quince dígitos se determinan mediante el signo y el significado del número .
prefix
parámetro) no afecta el orden de clasificación.{{nts|123456789.00123}}
→ 7008123456789001230♠ 123.456.789,00123
Para el texto que sigue a un número, {{nts|123,456}} as of 2012
se muestra 123,456 as of 2012
con una clave de ordenación numérica de 123456
. Esto fuerza la ordenación numérica en la celda utilizando este valor en lugar de la ordenación alfabética predeterminada.
A continuación se presentan más ejemplos, algunos de los cuales ilustran las limitaciones enumeradas anteriormente.