This is the template sandbox page for Template:Infobox person/length (diff). See also the companion subpage for test cases. |
This template is used on approximately 7,300 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This is for use in templates. For articles, please use {{Convert}}. |
This template uses Lua: |
This template is used to automatically add conversions of length measurements displayed by infoboxes, such as:
|reach=
in{{Infobox boxer}}
and{{Infobox martial artist}}
|spike=
and|block=
in{{Infobox volleyball biography}}
Usage
edit{{Infobox
...
| label# = Reach
| data# = {{#if: {{{reach|}}} | {{Infobox person/length|{{{reach}}}}} }}
...
}}
{{Infobox
...
| label# = Spike
| data# = {{#if: {{{spike|}}} | {{Infobox person/length|{{{spike}}}}} }}
| label# = Block
| data# = {{#if: {{{block|}}} | {{Infobox person/length|{{{block}}}}} }}
...
}}
Examples
edit|reach=1 inch
→ 1 in (3 cm)|reach=78 inches
→ 78 in (198 cm)|reach=78 ins
→ 78 in (198 cm)|reach=78 in.
→ 78 in (198 cm)|reach=78 in
→ 78 in (198 cm)
|reach=1 centimetre
→ 1 cm (0 in)|reach=1 centimeter
→ 1 cm (0 in)|reach=198 centimetres
→ 198 cm (78 in)|reach=198 centimeters
→ 198 cm (78 in)|reach=198 cms
→ 198 cm (78 in)|reach=198 cm.
→ 198 cm (78 in)|reach=198 cm
→ 198 cm (78 in)
|reach=1 metre
→ 1 m (39 in)|reach=1 meter
→ 1 m (39 in)|reach=1.98 metres
→ 1.98 m (78 in)|reach=1.98 meters
→ 1.98 m (78 in)|reach=1.98 ms
→ 1.98 m (78 in)|reach=1.98 m.
→ 1.98 m (78 in)|reach=1.98 m
→ 1.98 m (78 in)
Non-breaking space or missing space after number:
|reach=78 inches
→ 78 in (198 cm)|reach=198centimetres
→ 198 cm (78 in)|reach=1.98metres
→ 1.98 m (78 in)
Text and/or footnotes (references) after length:
|reach=78 ins (2012)
→ 78 in (198 cm) (2012)|reach=198 cms<ref>citation goes here</ref>
→ 198 cm (78 in)[1]|reach=1.98 ms (2012)<ref>{{cite news|title=title|work=work}}</ref>
→ 1.98 m (78 in) (2012)[2]
- Example references
{{Convert}} templates, without and with wikilinked unit names:
|reach={{Convert|78|in|cm|0|abbr=off}}
→ 78 in (198 cm)|reach={{Convert|78|in|cm|0|abbr=off|lk=on}}
→ 78 in (198 cm)- output of convert template: 78 [[inch|inches]] (198 [[centimetre]]s)
|reach={{Convert|78|in|m|2|abbr=off}}
→ 78 in (1.98 m)|reach={{Convert|78|in|m|2|abbr=off|lk=on}}
→ 78 in (1.98 m)- output of convert template: 78 [[inch|inches]] (1.98 [[metre]]s)
|reach={{Convert|198|cm|abbr=off}}
→ 198 cm (78 in)|reach={{Convert|198|cm|abbr=off|lk=on}}
→ 198 cm (78 in)- output of convert template: 198 [[centimetre]]s (78 [[inch|inches]])
|reach={{Convert|1.98|m|in|abbr=off}}
→ 1.98 m (78 in)|reach={{Convert|1.98|m|in|abbr=off|lk=on}}
→ 1.98 m (78 in)- output of convert template: 1.98 [[metre]]s (78 [[inch|inches]])
Exceptions
editDoes not replace numbers in manually entered conversions, but does replace unit names with abbreviations (examples intentionally show incorrect conversions):
|reach=78 inches (191 centimeters)
→ 78 in (191 cm)|reach=78 inches (1.91 meters)
→ 78 in (1.91 m)|reach=198 centimetres (71 inches)
→ 198 cm (71 in)|reach=1.98 metres (71 inches)
→ 1.98 m (71 in)
Does not replace numeric output of conversion templates such as {{convert}}, but does replace unit names with abbreviations (examples intentionally show different precision than usual):
|reach={{convert|78|in|cm|1|abbr=off|sp=us}}
→ 78 in (198.1 cm)- output of convert template: 78 inches (198.1 centimeters)
|reach={{convert|78|in|m|3|abbr=off|sp=us|lk=on}}
→ 78 in (1.981 m)|reach={{convert|198|cm|in|2|abbr=off|lk=on}}
→ 198 cm (77.95 in)- output of convert template: 198 centimetres (77.95 inches)
|reach={{convert|1.98|m|in|2|abbr=off}}
→ 1.98 m (77.95 in)- output of convert template: 1.98 metres (77.95 inches)
Areas for improvement
editConversion not displayed if unit name contains uppercase characters:
|reach=198 Centimetres
→ 198 Centim|reach=198 CM
→ 198 CM|reach=1.98 Metres
→ 1.98 Metres|reach=1.98 M
→ 1.98 M|reach=78 Inches
→ 78 Inches|reach=78 IN
→ 78 IN
Conversion not displayed if symbols are used for inches:
|reach=78"
→ 78"|reach=78″
→ 78″
Does not recognize symbols for inches in manually entered conversion (adds a second conversion):
|reach=198cm (78")
→ 198 cm (78 in) (78")|reach=1.98m (78″)
→ 1.98 m (78 in) (78″)
Does not convert feet (ft) or yards (yd):
|reach=6 feet
→ 6 feet|reach=6 ft
→ 6 ft|reach=2 yards
→ 2 yards|reach=2 yd
→ 2 yd
If {{convert}} template displays feet or yards, it is not abbreviated:
|reach={{Convert|6|ft|6|in|cm|abbr=off}}
→ 6 feet 6 in (198 cm)|reach={{Convert|6|ft|6|in|m|2|abbr=off|lk=on}}
→ 6 feet 6 in (1.98 m)|reach={{Convert|2|yd|1.5|ft|cm|0|abbr=off}}
→ 2 yards 1.5 feet (229 cm)|reach={{Convert|2|yd|1.5|ft|m|2|abbr=off|lk=on}}
→ 2 yards 1.5 feet (2.29 m)
If {{convert}} displays feet or yards in conversion, a second conversion is displayed (only for unlinked unit names):