Template:Infobox person/weight/doc

From MOASSpedia
Jump to navigation Jump to search

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

Usage

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

Examples

Kilograms:

  • |weight=1 kilogram → 1 kg (2 lb)
  • |weight=108 kg. → 108 kg (238 lb)
  • |weight=111kilograms → 111 kg (245 lb)
  • |weight=108 kgs. → 108 kg (238 lb)

Pounds:

  • |weight=1 pound → 1 lb (0 kg)
  • |weight=200 lb. → 200 lb (91 kg)
  • |weight=245pounds → 245 lb (111 kg)
  • |weight=238 lbs. → 238 lb (108 kg)

Stone:

  • |weight=1 stone → 1 st (14 lb; 6 kg)
  • |weight=10 st. → 10 st (140 lb; 64 kg)
  • |weight=17stones → 17 st (238 lb; 108 kg)
  • |weight=17 sts. → 17 st (238 lb; 108 kg)

Stone and pounds:

  • |weight=17 stone, 7 pounds → 17 st 7 lb (245 lb; 111 kg)
  • |weight=17 st. 7 lb. → 17 st 7 lb (245 lb; 111 kg)
  • |weight=17stones 1pound → 17 st 1 lb (239 lb; 108 kg)
  • |weight=17 sts. 1 lbs. → 17 st 1 lb (239 lb; 108 kg)

Text and/or footnotes (references) after weight:

  • |weight=108 kgs (2012) → 108 kg (238 lb) (2012)
  • |weight=238 lbs<ref>citation goes here</ref> → 238 lb (108 kg)[1]
  • |weight=238 lbs (2012)<ref>{{cite news|title=title|work=work}}</ref> → 238 lb (108 kg) (2012)[2]
Example references
  1. ^ citation goes here
  2. ^ "title". work.

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

  • |weight={{Convert|111|kg|lb stlb|abbr=off}} → 111 kg (245 lb; 17 st 7 lb)
  • |weight={{Convert|111|kg|lb stlb|abbr=off|lk=on}} → 111 kg (245 lb; 17 st 7 lb)
    • output of convert template: 111 [[kilogram]]s (245 [[Pound (mass)|pounds]]; 17&nbsp;[[Stone (unit)|stone]] 7&nbsp;pounds)
  • |weight={{Convert|245|lb|kg stlb|abbr=off}} → 245 lb (111 kg; 17 st 7 lb)
  • |weight={{Convert|245|lb|kg stlb|abbr=off|lk=on}} → 245 lb (111 kg; 17 st 7 lb)
    • output of convert template: 245 [[Pound (mass)|pounds]] (111 [[kilogram]]s; 17&nbsp;[[Stone (unit)|stone]] 7&nbsp;pounds)

Weight ranges with input containing en dash (–):

  • |weight=108–111 kg → 108–111 kg (238–245 lb)
  • |weight=238–245 lb → 238–245 lb (108–111 kg)
  • |weight=17–18 st → 17–18 st (238–252 lb; 108–114 kg)

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

  • |weight=108-111 kg → 108–111 kg (238–245 lb)
  • |weight=238-245 lb → 238–245 lb (108–111 kg)
  • |weight=17-18 st → 17–18 st (238–252 lb; 108–114 kg)

If a template uses {{Infobox person/weight|{{{weight}}}|kg-stlb=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 → 100 kg (220 lb; 15 st 10 lb)
  • |weight=108–111 kg → 108–111 kg (238–245 lb; 17 st 0 lb – 17 st 7 lb)

If a template uses {{Infobox person/weight|{{{weight}}}|lb-stlb=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 → 200 lb (91 kg; 14 st 4 lb)
  • |weight=238-245 lb → 238–245 lb (108–111 kg; 17 st 0 lb – 17 st 7 lb)

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) → 108 kg (229 lb)
  • |weight=238 pounds (119 kilograms) → 238 lb (119 kg)
  • |weight=17 stone (229 pounds; 119 kilograms) → 17 st (229 lb; 119 kg)

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}} → 108.1 kg (238.3 lb)
    • output of convert template: 108.1 kilograms (238.3 pounds)
  • |weight={{convert|238.2|lb|kg|2|abbr=off}} → 238.2 lb (108.05 kg)
    • output of convert template: 238.2 pounds (108.05 kilograms)
  • |weight={{convert|17.3|st|1|abbr=off}} → 17.3 st (242.2 lb; 109.9 kg)
    • output of convert template: 17.3 stone (242.2 pounds; 109.9 kilograms)

Areas for improvement

Conversion not displayed if unit name contains uppercase characters:

  • |weight=100 Kilograms → 100 Kilograms
  • |weight=100 KG → 100 KG
  • |weight=200 Pounds → 200 Pounds
  • |weight=200 LB → 200 LB
  • |weight=10 Stone → 10 Stone
  • |weight=10 ST → 10 ST