Difference between revisions of "Template:Height/doc"
imported>Zyxw (update examples) |
imported>Getsnoopy (Updated the documentation to be consistent with the output of the template.) |
||
| Line 7: | Line 7: | ||
* The template is intended for conversion of heights specified in either feet and inches, or metric units (centimetres or metres). Metric units are converted to feet and inches, and feet and inches are converted to metres, or optionally to centimetres. | * The template is intended for conversion of heights specified in either feet and inches, or metric units (centimetres or metres). Metric units are converted to feet and inches, and feet and inches are converted to metres, or optionally to centimetres. | ||
* As this template is intended for use in infoboxes, the units on both sides of the conversion are abbreviated by default. When using this template outside of infoboxes, use the ''abbr'' parameter, which can take values of ''yes'' (default; both sides of the conversion are abbreviated), ''no'' (both sides of the conversion are spelled out), or ''mos'' ([[WP:MOSNUM]]-compliant format, where the units being converted are spelled out and the units of the converted values are abbreviated). | * As this template is intended for use in infoboxes, the units on both sides of the conversion are abbreviated by default. When using this template outside of infoboxes, use the ''abbr'' parameter, which can take values of ''yes'' (default; both sides of the conversion are abbreviated), ''no'' (both sides of the conversion are spelled out), or ''mos'' ([[WP:MOSNUM]]-compliant format, where the units being converted are spelled out and the units of the converted values are abbreviated). | ||
| − | * For conversion of metric units to feet/inches, the ''frac'' parameter can be specified to either show the output inches as decimals (''frac''=10) or as a vulgar fraction (''frac''=desired denominator; the default is 2 for halves). The ''frac'' parameter is ignored for conversion of feet/inches to | + | * For conversion of metric units to feet/inches, the ''frac'' parameter can be specified to either show the output inches as decimals (''frac''=10) or as a vulgar fraction (''frac''=desired denominator; the default is 2 for halves). The ''frac'' parameter is ignored for conversion of feet/inches to metres. |
| − | * When decimal output is used, the default precision is 1 for | + | * When decimal output is used, the default precision is 1 for metres-to-feet/inches conversion and 2 for feet/inches-to-metres conversion, but it can be overridden by specifying a different figure using the ''precision'' parameter (see example below). The ''precision'' parameter is ignored when ''frac'' is set to anything but 10. |
* ''wiki'' parameter specifies whether the names of the units should be wikified or not and can take values of either ''yes'' or ''no''. The default value is ''no''. | * ''wiki'' parameter specifies whether the names of the units should be wikified or not and can take values of either ''yes'' or ''no''. The default value is ''no''. | ||
* Use {{para|out|cm}} with input values in feet and inches to output the conversion as centimetres. | * Use {{para|out|cm}} with input values in feet and inches to output the conversion as centimetres. | ||
| Line 26: | Line 26: | ||
| {{height|metres=1.77}} | | {{height|metres=1.77}} | ||
|- | |- | ||
| − | | <nowiki>{{height| | + | | <nowiki>{{height|metres=1.77|abbr=no}}</nowiki> |
| − | | {{height| | + | | {{height|metres=1.77|abbr=no}} |
|- | |- | ||
| <nowiki>{{height|m=1.77|abbr=mos}}</nowiki> | | <nowiki>{{height|m=1.77|abbr=mos}}</nowiki> | ||
| Line 46: | Line 46: | ||
| {{height|centimetres=177}} | | {{height|centimetres=177}} | ||
|- | |- | ||
| − | | <nowiki>{{height| | + | | <nowiki>{{height|centimetres=177|abbr=no}}</nowiki> |
| − | | {{height| | + | | {{height|centimetres=177|abbr=no}} |
|- | |- | ||
| <nowiki>{{height|cm=177|abbr=mos}}</nowiki> | | <nowiki>{{height|cm=177|abbr=mos}}</nowiki> | ||
| Line 133: | Line 133: | ||
|} | |} | ||
| − | * ''m'' is for | + | * ''m'' is for metres |
* ''cm'' is for centimetres | * ''cm'' is for centimetres | ||
* ''ft'' is for feet | * ''ft'' is for feet | ||
| Line 146: | Line 146: | ||
<templatedata> | <templatedata> | ||
{ | { | ||
| − | "description": "The template is intended for conversion of heights specified in either | + | "description": "The template is intended for conversion of heights specified in either metres or in feet and inches.", |
"params": { | "params": { | ||
"m": { | "m": { | ||
| − | "label": " | + | "label": "Metres", |
"type": "number", | "type": "number", | ||
| − | "description": "The height in | + | "description": "The height in metres. Do not use if feet and inches are specified.", |
| − | "aliases":[" | + | "aliases":["metre", "metres", "meter", "meters"] |
}, | }, | ||
"cm": { | "cm": { | ||
| − | "label": " | + | "label": "Centimetres", |
"type": "number", | "type": "number", | ||
| − | "description": "The height in | + | "description": "The height in centimetres. Do not use if feet and inches are specified.", |
| − | "aliases":[" | + | "aliases":["centimetre", "centimetres", "centimeter", "centimeters"] |
}, | }, | ||
"ft": { | "ft": { | ||
"label": "Feet", | "label": "Feet", | ||
"type": "number", | "type": "number", | ||
| − | "description": "The feet part of the height in feet and inches. Do not use if | + | "description": "The feet part of the height in feet and inches. Do not use if centimetres are specified.", |
"aliases":["foot", "feet"] | "aliases":["foot", "feet"] | ||
}, | }, | ||
| Line 169: | Line 169: | ||
"label": "Inches", | "label": "Inches", | ||
"type": "number", | "type": "number", | ||
| − | "description": "The inches part of the height in feet and inches (optional). Do not use if | + | "description": "The inches part of the height in feet and inches (optional). Do not use if centimetres are specified. Fractions are supported in the form u+n/d.", |
"aliases":["inch", "inches"] | "aliases":["inch", "inches"] | ||
}, | }, | ||
| Line 175: | Line 175: | ||
"label": "Precision of converted value", | "label": "Precision of converted value", | ||
"type": "number", | "type": "number", | ||
| − | "description": "The amount of decimal places to display the converted value to. Defaults to 2 for feet and inches to | + | "description": "The amount of decimal places to display the converted value to. Defaults to 2 for feet and inches to metres and to 1 for metres/centimetres to feet and inches." |
}, | }, | ||
"frac": { | "frac": { | ||
"label": "Fraction denominator", | "label": "Fraction denominator", | ||
"type": "number", | "type": "number", | ||
| − | "description": "Shows result as a fraction. The number in this parameter is the denominator of the fraction. Used only for | + | "description": "Shows result as a fraction. The number in this parameter is the denominator of the fraction. Used only for metres/centimetres to feet and inches. Set to \"10\" for decimals. Defaults to 2 (halves). " |
}, | }, | ||
"abbr": { | "abbr": { | ||
Revision as of 06:26, 29 October 2019
| This is a documentation subpage for Template:Height. It contains usage information, categories and other content that is not part of the original template page. |
| This template uses Lua: |
Instructions
- The template is intended for conversion of heights specified in either feet and inches, or metric units (centimetres or metres). Metric units are converted to feet and inches, and feet and inches are converted to metres, or optionally to centimetres.
- As this template is intended for use in infoboxes, the units on both sides of the conversion are abbreviated by default. When using this template outside of infoboxes, use the abbr parameter, which can take values of yes (default; both sides of the conversion are abbreviated), no (both sides of the conversion are spelled out), or mos (WP:MOSNUM-compliant format, where the units being converted are spelled out and the units of the converted values are abbreviated).
- For conversion of metric units to feet/inches, the frac parameter can be specified to either show the output inches as decimals (frac=10) or as a vulgar fraction (frac=desired denominator; the default is 2 for halves). The frac parameter is ignored for conversion of feet/inches to metres.
- When decimal output is used, the default precision is 1 for metres-to-feet/inches conversion and 2 for feet/inches-to-metres conversion, but it can be overridden by specifying a different figure using the precision parameter (see example below). The precision parameter is ignored when frac is set to anything but 10.
- wiki parameter specifies whether the names of the units should be wikified or not and can take values of either yes or no. The default value is no.
- Use
|out=cmwith input values in feet and inches to output the conversion as centimetres.
Examples
| Code | Result |
|---|---|
| m | |
| {{height|m=1.77}} | 1.77 m (5 ft 9 1⁄2 in) |
| {{height|metres=1.77}} | 1.77 m (5 ft 9 1⁄2 in) |
| {{height|metres=1.77|abbr=no}} | 1.77 metres (5 feet 9 1⁄2 inches) |
| {{height|m=1.77|abbr=mos}} | 1.77 metres (5 ft 9 1⁄2 in) |
| {{height|m=1.77|frac=16}} | 1.77 m (5 ft 9 11⁄16 in) |
| {{height|m=1.77|precision=0}} | 1.77 m (5 ft 10 in) |
| cm | |
| {{height|cm=177}} | 177 cm (5 ft 9 1⁄2 in) |
| {{height|centimetres=177}} | 177 cm (5 ft 9 1⁄2 in) |
| {{height|centimetres=177|abbr=no}} | 177 centimetres (5 feet 9 1⁄2 inches) |
| {{height|cm=177|abbr=mos}} | 177 centimetres (5 ft 9 1⁄2 in) |
| {{height|cm=177|frac=16}} | 177 cm (5 ft 9 11⁄16 in) |
| {{height|cm=177|precision=0}} | 177 cm (5 ft 10 in) |
| ft and in | |
| {{height|ft=6|in=1}} | 6 ft 1 in (1.85 m) |
| {{height|ft=6|in=1|out=cm}} | 6 ft 1 in (185 cm) |
| {{height|ft=6|in=1|precision=1}} | 6 ft 1 in (1.9 m) |
| {{height|ft=6|in=1|precision=-1|out=cm}} | 6 ft 1 in (190 cm) |
| {{height|feet=6|inches=1}} | 6 ft 1 in (1.85 m) |
| {{height|feet=6|inches=1|out=cm}} | 6 ft 1 in (185 cm) |
| {{height|ft=6|in=1|abbr=no}} | 6 feet 1 inch (1.85 metres) |
| {{height|ft=6|in=1|abbr=no|out=cm}} | 6 feet 1 inch (185 centimetres) |
| {{height|ft=6|in=1|abbr=mos}} | 6 feet 1 inch (1.85 m) |
| {{height|ft=6|in=1|abbr=mos|out=cm}} | 6 feet 1 inch (185 cm) |
| {{height|ft=5|in=7+1/2}} | 5 ft 7 1⁄2 in (1.71 m) |
| {{height|ft=5|in=7+1/2|out=cm}} | 5 ft 7 1⁄2 in (171 cm) |
| {{height|ft=5|in=7+1/2|precision=1}} | 5 ft 7 1⁄2 in (1.7 m) |
| {{height|ft=5|in=7+1/2|precision=1|out=cm}} | 5 ft 7 1⁄2 in (171.5 cm) |
| {{height|ft=5|in=7+1/2|precision=-1|out=cm}} | 5 ft 7 1⁄2 in (170 cm) |
| {{height|ft=5|in=7+1/2|precision=3}} | 5 ft 7 1⁄2 in (1.715 m) |
| ft | |
| {{height|ft=6}} | 6 ft 0 in (1.83 m) |
| {{height|ft=6|out=cm}} | 6 ft 0 in (183 cm) |
| in | |
| {{height|in=10}} | 0 ft 10 in (0.25 m) |
| {{height|in=10|out=cm}} | 0 ft 10 in (25 cm) |
| errors | |
| {{height|cm=200|in=2|precision=0}} | Error: please specify height using only one type of units |
| {{height|cm=177|frac=0}} | 177 cm (5 ft 9.7 in)* |
- m is for metres
- cm is for centimetres
- ft is for feet
- in is for inches
Tracking categories
- Category:Pages using height with unknown parameters (0)
- Category:Pages using height with 1 equal 0 (0)
Template data
TemplateData for Height
The template is intended for conversion of heights specified in either metres or in feet and inches.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Metres | m metre metres meter meters | The height in metres. Do not use if feet and inches are specified. | Number | optional |
| Centimetres | cm centimetre centimetres centimeter centimeters | The height in centimetres. Do not use if feet and inches are specified. | Number | optional |
| Feet | ft foot feet | The feet part of the height in feet and inches. Do not use if centimetres are specified. | Number | optional |
| Inches | in inch inches | The inches part of the height in feet and inches (optional). Do not use if centimetres are specified. Fractions are supported in the form u+n/d. | Number | optional |
| Precision of converted value | precision | The amount of decimal places to display the converted value to. Defaults to 2 for feet and inches to metres and to 1 for metres/centimetres to feet and inches. | Number | optional |
| Fraction denominator | frac | Shows result as a fraction. The number in this parameter is the denominator of the fraction. Used only for metres/centimetres to feet and inches. Set to "10" for decimals. Defaults to 2 (halves). | Number | optional |
| Abbreviation style | abbr | Changes abbreviation style. Set to "yes" for all units to be abbreviated (default), "no" for all to be spelled out, or "mos" for the units being converted to be spelled out and the converted units to be abbreviated. | String | optional |
| Unit linking | wiki | Changes whether units are linked. Set to "no" to not link units (default) or "yes" to link units. | String | optional |
| Output format | out | Changes output format of conversion. Set to "cm" with input values in feet and inches to output the conversion as centimetres. No other options currently exist and the template ignores anything other than "cm". | String | optional |
See also
- {{convert}}
- {{convert|1.82|m|ftin|frac=4|abbr=on}} → 1.82 m (5 ft 11 3⁄4 in)
- {{convert|182|cm|ftin|frac=4|abbr=on}} → 182 cm (5 ft 11 3⁄4 in)
- {{convert|5|ft|11+3/4|in|m|2|abbr=on}} → 5 ft 11 3⁄4 in (1.82 m)
- {{convert|5|ft|11+3/4|in|cm|0|abbr=on}} → 5 ft 11 3⁄4 in (182 cm)