Difference between revisions of "Template:Place"

From comp.tf
Jump to navigation Jump to search
 
Line 2: Line 2:
 
  | 11  
 
  | 11  
 
  | 12  
 
  | 12  
  | 13 = {{#if:{{{sep|}}}|{{Thousands separator|{{{1|}}}|{{{sep|}}}|{{{1|}}}}}{{#ifeq:{{{sup|}}}|1|<sup>|}}th{{#ifeq:{{{sup|}}}|1|</sup>|}}
+
  | 13 = {{#if:{{{sep|}}}|{{Thousands separator|{{{1|}}}|{{{sep|}}}}}|{{{1|}}}}}{{#ifeq:{{{sup|}}}|1|<sup>|}}th{{#ifeq:{{{sup|}}}|1|</sup>|}}
 
  |#default={{#switch:{{#sub:{{{1|}}}|-1|}}
 
  |#default={{#switch:{{#sub:{{{1|}}}|-1|}}
  | 1 = {{#if:{{{sep|}}}|{{Thousands separator|{{{1|}}}|{{{sep|}}}|{{{1|}}}}}{{#ifeq:{{{sup|}}}|1|<sup>|}}st{{#ifeq:{{{sup|}}}|1|</sup>|}}
+
  | 1 = {{#if:{{{sep|}}}|{{Thousands separator|{{{1|}}}|{{{sep|}}}}}|{{{1|}}}}}{{#ifeq:{{{sup|}}}|1|<sup>|}}st{{#ifeq:{{{sup|}}}|1|</sup>|}}
  | 2 = {{#if:{{{sep|}}}|{{Thousands separator|{{{1|}}}|{{{sep|}}}|{{{1|}}}}}{{#ifeq:{{{sup|}}}|1|<sup>|}}nd{{#ifeq:{{{sup|}}}|1|</sup>|}}
+
  | 2 = {{#if:{{{sep|}}}|{{Thousands separator|{{{1|}}}|{{{sep|}}}}}|{{{1|}}}}}{{#ifeq:{{{sup|}}}|1|<sup>|}}nd{{#ifeq:{{{sup|}}}|1|</sup>|}}
  | 3 = {{#if:{{{sep|}}}|{{Thousands separator|{{{1|}}}|{{{sep|}}}|{{{1|}}}}}{{#ifeq:{{{sup|}}}|1|<sup>|}}rd{{#ifeq:{{{sup|}}}|1|</sup>|}}
+
  | 3 = {{#if:{{{sep|}}}|{{Thousands separator|{{{1|}}}|{{{sep|}}}}}|{{{1|}}}}}{{#ifeq:{{{sup|}}}|1|<sup>|}}rd{{#ifeq:{{{sup|}}}|1|</sup>|}}
  |#default={{#if:{{{sep|}}}|{{Thousands separator|{{{1|}}}|{{{sep|}}}|{{{1|}}}}}{{#ifeq:{{{sup|}}}|1|<sup>|}}th{{#ifeq:{{{sup|}}}|1|</sup>|}}}}}}</includeonly><noinclude>{{documentation}}</noinclude>
+
  |#default={{#if:{{{sep|}}}|{{Thousands separator|{{{1|}}}|{{{sep|}}}}}|{{{1|}}}}}{{#ifeq:{{{sup|}}}|1|<sup>|}}th{{#ifeq:{{{sup|}}}|1|</sup>|}}}}}}</includeonly><noinclude>{{documentation}}</noinclude>

Latest revision as of 09:38, 20 April 2020

(view - edit) Documentation

Template:Place returns a given number as a placing with the appropriate suffix.

Usage

You type You get
{{place|1}} 1st
{{place|22}} 22nd
{{place|33}} 33rd
{{place|111}} 111th

Optional parameters

|sup=
  • If set to 1, the template will return the suffix as subscript.
    • e.g. {{place|5|sup=1}} returns 5th
|sep=
  • If set to a symbol, the template will use it as a thousands separator.
    • e.g. {{place|1000|sep=,}} returns 1,000th