Difference between revisions of "Template:Place"

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

Revision as of 09:37, 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}} {{#switch:1 11 12 1th #default={{#switch:1 1st 1nd 3 =
  1. default=
{{place|22}} {{#switch:22 11 12 22th #default={{#switch:2 22st 22nd 3 =
  1. default=
{{place|33}} {{#switch:33 11 12 33th #default={{#switch:3 33st 33nd 3 =
  1. default=
{{place|111}} {{#switch:11 11 12 111th #default={{#switch:1 111st 111nd 3 =
  1. default=

Optional parameters

|sup=
  • If set to 1, the template will return the suffix as subscript.
    • e.g. {{place|5|sup=1}} returns {{#switch:5
| 11 
| 12 
| 13 = {{#if:|5th
|#default={{#switch:5
| 1 = {{#if:|5st
| 2 = {{#if:|5nd
| 3 = 
  1. default=
|sep=
  • If set to a symbol, the template will use it as a thousands separator.
    • e.g. {{place|1000|sep=,}} returns {{#switch:00
| 11 
| 12 
| 13 = {{#if:,|1,000th
|#default={{#switch:0
| 1 = {{#if:,|1,000st
| 2 = {{#if:,|1,000nd
| 3 = 1,000rd