Difference between revisions of "Template:Kilometer"
From Teampedia
(Created page with "{{#switch:{{{2|}}} | adj | on = {{convert|{{{1|80}}}|km|mi|adj=on}} | off | abbr | #default = {{convert|{{{1|80}}}|km|mi|abbr=on}} }}<noinclude> {{documentation}} </noin...") |
|||
Line 1: | Line 1: | ||
− | {{# | + | <includeonly>{{FORMATNUM:{{#if:{{{num|}}}|{{{num}}}|{{{1}}}}}}} {{#ifexpr:({{#ifeq:{{LC:{{{abbr|mos}}}}}|mos|1|0}} OR {{#ifeq:{{LC:{{{abbr|mos}}}}}|no|1|0}})|{{#ifeq:{{LC:{{{spell|american}}}}}|american|{{#ifeq:{{LC:{{{wiki|no}}}}}|yes|[[w:kilometre|kilometers]]|kilometers}}|{{#ifeq:{{LC:{{{wiki|no}}}}}|yes|[[w:kilometre|kilometres]]|kilometres}}}}|{{#ifeq:{{LC:{{{wiki|no}}}}}|yes|[[w:kilometre|km]]|km}}}} ({{FORMATNUM:{{#expr:{{#if:{{{num|}}}|{{{num}}}|{{{1}}}}}/1.609344 round {{{precision|0}}}}}}} {{#ifeq:{{LC:{{{abbr|mos}}}}}|no|{{#ifeq:{{LC:{{{wiki|no}}}}}|yes|[[w:mile|miles]]|miles}}|{{#ifeq:{{LC:{{{wiki|no}}}}}|yes|[[w:mile|mi]]|mi}}}})</includeonly><noinclude>{{documentation}}[[Category:Conversion templates|{{PAGENAME}}]]</noinclude> |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | }}<noinclude> | + | |
− | {{documentation}} | + | |
− | </noinclude> | + |
Revision as of 18:54, 29 February 2020
To show distances in kilometre (and mile) such as:
"the trail is 8 kilometers (5 mi) long" and "it's a 5 kilometers (3 mi) trail"
Usage
- {{kilometer|2}} or {{kilometer|2}} - will show as - 2 kilometers (1 mi)
- {{kilometer|10-15}} or {{kilometer|10-15} - will show as - 10-15 kilometers (1 mi)
- {{kilometer|2|on}} or {{kilometer|2|on} or {{kilometer|2|adj} - will show as - 2 kilometers (1 mi)
Parameters
- First parameter is distance number in kilometer
- also possible to show range using a dash
- Second optional parameter set to on or adj to produce the adjective form
See also
- Wikivoyage:Units
- {{convert}} - from which this template is built; but this one removes the need to know full syntax and ensure consistent formatting throughout the site.
The above documentation is transcluded from Template:Kilometer/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Please add categories and interwikis to the /doc subpage. Subpages of this template.
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Please add categories and interwikis to the /doc subpage. Subpages of this template.