Template:Infobox npc/height/doc
{{#ifeq:doc |doc
|
{{#ifeq:show |show
|
This is a documentation subpage for Template:Infobox npc/height. It contains usage information, categories and other content that is not part of the original {{#if: |{{{text2}}} |{{#if: |{{{text1}}} |{{#ifeq:Template |User |template template page |{{#if:Template |template page|article}}}}}}}}. |
}}{{#if: | | {{#ifexist:Template:Infobox npc/height | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]] | }} }} | }}
Template:Infobox npc/height is one of three templates used to automatically add conversions of height measurements displayed by Template:Infobox person and other infoboxes with a |{{#if:height|height=}}
parameter.
- Template:Infobox person/height changes text for units of height to the abbreviations "m", "cm", "ft", or "in", then passes the string to:
- Template:Infobox person/height/locate which replaces any instances of
with a space, and determines the positions of "m", "cm", "ft", or "in" within that string, all of which is passed to: - Template:Infobox person/height/switch which does the conversion
Usage[edit]
{{Infobox person/height|1 metre}}
→ Template:Infobox person/height{{Infobox person/height|1 meter}}
→ Template:Infobox person/height{{Infobox person/height|1.57 metres}}
→ Template:Infobox person/height{{Infobox person/height|1.57 meters}}
→ Template:Infobox person/height{{Infobox person/height|1.57 m}}
→ Template:Infobox person/height{{Infobox person/height|1.57 ms}}
→ Template:Infobox person/height
{{Infobox person/height|1 centimetre}}
→ Template:Infobox person/height{{Infobox person/height|1 centimeter}}
→ Template:Infobox person/height{{Infobox person/height|157 centimetres}}
→ Template:Infobox person/height{{Infobox person/height|157 centimeters}}
→ Template:Infobox person/height{{Infobox person/height|157 cm}}
→ Template:Infobox person/height{{Infobox person/height|157 cms}}
→ Template:Infobox person/height
Feet:
{{Infobox person/height|1 foot}}
→ Template:Infobox person/height{{Infobox person/height|2 feet}}
→ Template:Infobox person/height{{Infobox person/height|2 ft}}
→ Template:Infobox person/height
{{Infobox person/height|1 inch}}
→ Template:Infobox person/height{{Infobox person/height|2 inches}}
→ Template:Infobox person/height{{Infobox person/height|2 in}}
→ Template:Infobox person/height{{Infobox person/height|2 ins}}
→ Template:Infobox person/height
Feet and inches, embedded non-breaking space, and text after height:
{{Infobox person/height|5 feet 2 inches}}
→ Template:Infobox person/height{{Infobox person/height|5feet 2inches}}
→ Template:Infobox person/height{{Infobox person/height|5 feet 2 inches}}
→ Template:Infobox person/height{{Infobox person/height|5 feet 2 inches (2012)}}
→ Template:Infobox person/height
Embedded footnotes (references):
{{Infobox person/height|5 feet 2 inches (2012)<ref>citation goes here</ref>}}
→ Template:Infobox person/height{{Infobox person/height|5 feet 2 inches (2012)<ref>"title". ''work''.</ref>}}
→ Template:Infobox person/height{{Infobox person/height|5 feet 2 inches (2012)<ref>{{cite news|title=feet|work=inches}}</ref>}}
→ Template:Infobox person/height{{Infobox person/height|5 feet 2 inches (2012)<ref>{{citation|title=metres|work=centimetres}}</ref>}}
→ Template:Infobox person/height
<references />
{{Convert}} templates generating wikilinked unit names:
{{Infobox person/height|{{Convert|5|ft|2|in|lk=on|abbr=on}}}}
→ Template:Infobox person/height{{Infobox person/height|{{Convert|5|ft|2|in|lk=on|abbr=off}}}}
→ Template:Infobox person/height{{Infobox person/height|{{Convert|1.57|m|lk=on|abbr=on}}}}
→ Template:Infobox person/height{{Infobox person/height|{{Convert|1.57|m|lk=on|abbr=off}}}}
→ Template:Infobox person/height{{Infobox person/height|{{Convert|157|cm|ftin|lk=on|abbr=on}}}}
→ Template:Infobox person/height{{Infobox person/height|{{Convert|157|cm|ftin|lk=on|abbr=off}}}}
→ Template:Infobox person/height
Exceptions[edit]
Does not replace numbers in hard-coded conversions, but does replace unit names with abbreviations (examples intentionally show incorrect conversions):
{{Infobox person/height|5 feet 2 inches (1.00 metres)}}
→ Template:Infobox person/height{{Infobox person/height|157 centimetres (5 feet 5 inches)}}
→ Template:Infobox person/height
Does not replace numeric output of conversion templates such as {{convert}} or {{height}}, but does replace unit names with abbreviations (examples have different precision than usual):
{{Infobox person/height|{{Convert|5|ft|2|in|m|3|abbr=off}}}}
→ Template:Infobox person/height- output of convert template: 5 feet 2 inches (1.575 metres)
{{Infobox person/height|{{Convert|1.57|m|ftin|1|abbr=off}}}}
→ Template:Infobox person/height- output of convert template: 1.57 metres (5 feet 1.8 inches)
{{Infobox person/height|{{Height|ft=5|in=2|precision=3|abbr=no}}}}
→ Template:Infobox person/height- output of convert template: {{#switch:{{#if:|1|0}}{{#if:|1|0}}{{#if:5|1|0}}{{#if:2|1|0}}
|1000=[convert: needs a number] |0100=[convert: invalid number] |0011=5 feet 2 inches ([convert: unknown unit])* |0010=5 feet 0 inches ([convert: unknown unit])* |0001=0 feet 2 inches ([convert: unknown unit])* |0000= |#default=Error: please specify height using only one type of units }}
{{Infobox person/height|{{Height|m=1.57|frac=4|abbr=no}}}}
→ Template:Infobox person/height- output of convert template: {{#switch:{{#if:|1|0}}{{#if:1.57|1|0}}{{#if:|1|0}}{{#if:|1|0}}
|1000=[convert: needs a number] |0100=1.57 metres (5 ft 1.8 in)* |0011=[convert: needs a number] |0010=[convert: needs a number] |0001=[convert: needs a number] |0000= |#default=Error: please specify height using only one type of units }}
Period at end of abbreviation displays after the conversion:
{{Infobox person/height|5 m.}}
→ Template:Infobox person/height{{Infobox person/height|5 ft.}}
→ Template:Infobox person/height
Multiple unit conversions won't work if input contains periods or commas:
{{Infobox person/height|5 ft. 2 in}}
→ Template:Infobox person/height{{Infobox person/height|5 ft, 2 in}}
→ Template:Infobox person/height
Does not recognize symbols for feet and inches:
{{Infobox person/height|5' 2"}}
→ Template:Infobox person/height{{Infobox person/height|5? 2?}}
→ Template:Infobox person/height{{Infobox person/height|157cm (5' 2")}}
→ Template:Infobox person/height{{Infobox person/height|157cm (5? 2?)}}
→ Template:Infobox person/height
See also[edit]