Template:Infobox person/weight/doc

From The Tower of Babel

{{#invoke:Message box|mbox}} {{#invoke:Message box|mbox}} {{#invoke:High-use|main|1=|2=|info=|demo=|form=|expiry=|system=}} {{#invoke:Lua banner|main}}

This template is used to automatically add conversions of weight measurements displayed by Template:Infobox person and other infoboxes with a |weight= parameter.

{{#invoke:Hatnote|hatnote}}

Usage

{{Infobox
...
| label# = Weight
| data#  = {{#if: {{{weight|}}} | {{Infobox person/weight|{{{weight}}}}} }}
...
}}

Examples

Kilograms:

  • |weight=1 kilogram → {{#invoke:Person weight|weight}}
  • |weight=108 kg. → {{#invoke:Person weight|weight}}
  • |weight=111kilograms → {{#invoke:Person weight|weight}}
  • |weight=108 kgs. → {{#invoke:Person weight|weight}}

Pounds:

  • |weight=1 pound → {{#invoke:Person weight|weight}}
  • |weight=200 lb. → {{#invoke:Person weight|weight}}
  • |weight=245pounds → {{#invoke:Person weight|weight}}
  • |weight=238 lbs. → {{#invoke:Person weight|weight}}

Stone:

  • |weight=1 stone → {{#invoke:Person weight|weight}}
  • |weight=10 st. → {{#invoke:Person weight|weight}}
  • |weight=17stones → {{#invoke:Person weight|weight}}
  • |weight=17 sts. → {{#invoke:Person weight|weight}}

Stone and pounds:

  • |weight=17 stone, 7 pounds → {{#invoke:Person weight|weight}}
  • |weight=17 st. 7 lb. → {{#invoke:Person weight|weight}}
  • |weight=17stones 1pound → {{#invoke:Person weight|weight}}
  • |weight=17 sts. 1 lbs. → {{#invoke:Person weight|weight}}

Text and/or footnotes (references) after weight:

  • |weight=108 kgs (2012) → {{#invoke:Person weight|weight}}
  • |weight=238 lbs<ref>citation goes here</ref> → {{#invoke:Person weight|weight}}
  • |weight=238 lbs (2012)<ref>{{cite news|title=title|work=work}}</ref> → {{#invoke:Person weight|weight}}
Example references


{{Convert}} templates, without and with wikilinked unit names:

  • |weight={{Convert|111|kg|lb stlb|abbr=off}} → {{#invoke:Person weight|weight}}
  • |weight={{Convert|111|kg|lb stlb|abbr=off|lk=on}} → {{#invoke:Person weight|weight}}
    • {{#invoke:Template test case|main}}
  • |weight={{Convert|245|lb|kg stlb|abbr=off}} → {{#invoke:Person weight|weight}}
  • |weight={{Convert|245|lb|kg stlb|abbr=off|lk=on}} → {{#invoke:Person weight|weight}}
    • {{#invoke:Template test case|main}}

Weight ranges with input containing en dash (–):

  • |weight=108–111 kg → {{#invoke:Person weight|weight}}
  • |weight=238–245 lb → {{#invoke:Person weight|weight}}
  • |weight=17–18 st → {{#invoke:Person weight|weight}}

Weight ranges with input containing hyphen (-); output is changed to en dash by {{Convert}}:

  • |weight=108-111 kg → {{#invoke:Person weight|weight}}
  • |weight=238-245 lb → {{#invoke:Person weight|weight}}
  • |weight=17-18 st → {{#invoke:Person weight|weight}}

If a template uses {{#Invoke:Template link general|main|nolink=yes|code=yes}}, then an article using that template with an input in kg will display two conversions: lb followed by st/lb (default is one conversion to lb):

  • |weight=100 kg → {{#invoke:Person weight|weight}}
  • |weight=108–111 kg → {{#invoke:Person weight|weight}}

If a template uses {{#Invoke:Template link general|main|nolink=yes|code=yes}}, then an article using that template with an input in lb will display two conversions: kg followed by st/lb (default is one conversion to kg):

  • |weight=200 lb → {{#invoke:Person weight|weight}}
  • |weight=238-245 lb → {{#invoke:Person weight|weight}}

Exceptions

Does not replace numbers in manually entered conversions, but does replace unit names with abbreviations (examples intentionally show incorrect conversions):

  • |weight=108 kilograms (229 pounds) → {{#invoke:Person weight|weight}}
  • |weight=238 pounds (119 kilograms) → {{#invoke:Person weight|weight}}
  • |weight=17 stone (229 pounds; 119 kilograms) → {{#invoke:Person weight|weight}}

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):

  • |weight={{convert|108.1|kg|lb|1|abbr=off}} → {{#invoke:Person weight|weight}}
    • output of convert template: {{safesubst:#invoke:convert|convert}}
  • |weight={{convert|238.2|lb|kg|2|abbr=off}} → {{#invoke:Person weight|weight}}
    • output of convert template: {{safesubst:#invoke:convert|convert}}
  • |weight={{convert|17.3|st|1|abbr=off}} → {{#invoke:Person weight|weight}}
    • output of convert template: {{safesubst:#invoke:convert|convert}}

Areas for improvement

Conversion not displayed if unit name contains uppercase characters:

  • |weight=100 Kilograms → {{#invoke:Person weight|weight}}
  • |weight=100 KG → {{#invoke:Person weight|weight}}
  • |weight=200 Pounds → {{#invoke:Person weight|weight}}
  • |weight=200 LB → {{#invoke:Person weight|weight}}
  • |weight=10 Stone → {{#invoke:Person weight|weight}}
  • |weight=10 ST → {{#invoke:Person weight|weight}}