Template:Infobox person/weight/doc

From Brunswick MD History
< Template:Infobox person‎ | weight
Revision as of 22:08, 5 January 2018 by Dhuscha (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

  1. Template:Infobox person/weight changes text for units of weight to the abbreviations "kg", "lb", or "st", then passes the string to:
  2. Template:Infobox person/weight/locate which replaces any instances of &nbsp; with a space, and determines the positions of "kg", "lb", or "st" within that string, all of which is passed to:
  3. Template:Infobox person/weight/switch which does the conversion

Usage

kilograms

  • {{Infobox person/weight|100 kg}} → 100 kg (220 lb)
  • {{Infobox person/weight|1 kilogram}} → 1 kg (2 lb)
  • {{Infobox person/weight|108 kgs}} → 108 kg (238 lb)
  • {{Infobox person/weight|111 kilograms}} → 111 kg (245 lb)

pounds

  • {{Infobox person/weight|200 lb}} → 200 lb (91 kg)
  • {{Infobox person/weight|1 pound}} → 1 lb (0 kg)
  • {{Infobox person/weight|238 lbs}} → 238 lb (108 kg)
  • {{Infobox person/weight|245 pounds}} → 245 lb (111 kg)

stone

  • {{Infobox person/weight|10 st}} → 10 st (140 lb; 64 kg)
  • {{Infobox person/weight|1 stone}} → 1 st (14 lb; 6 kg)
  • {{Infobox person/weight|17 sts}} → 17 st (238 lb; 108 kg)

stone and pounds

  • {{Infobox person/weight|17 st 7 lb}} → 17 st 7 lb (245 lb; 111 kg)
  • {{Infobox person/weight|17 sts 7 lbs}} → 17 st 7 lb (245 lb; 111 kg)
  • {{Infobox person/weight|17 stone 7 pounds}} → 17 st 7 lb (245 lb; 111 kg)

no space or &nbsp;

  • {{Infobox person/weight|108kilograms}} → 108 kg (238 lb)
  • {{Infobox person/weight|238&nbsp;pounds}} → 238 lb (108 kg)

year and reference

  • {{Infobox person/weight|108 kgs (2012)}} → 108 kg (238 lb) (2012)
  • {{Infobox person/weight|238 lbs (2012)<ref>citation goes here</ref>}} → 238 lb (108 kg) (2012)[1]
Example references
  1. citation goes here

weight ranges

with input containing en dash (–):

  • {{Infobox person/weight|108111 kg}} → 108–111 kg (238–245 lb)
  • {{Infobox person/weight|238245 lb}} → 238–245 lb (108–111 kg)
  • {{Infobox person/weight|1718 st}} → 17–18 st (238–252 lb; 108–114 kg)

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

  • {{Infobox person/weight|108-111 kg}} → 108–111 kg (238–245 lb)
  • {{Infobox person/weight|238-245 lb}} → 238–245 lb (108–111 kg)
  • {{Infobox person/weight|17-18 st}} → 17–18 st (238–252 lb; 108–114 kg)

optional stlb output

with |kg-stlb=yes:

  • {{Infobox person/weight|kg-stlb=yes|100 kg}} → 100 kg (220 lb; 15 st 10 lb)
  • {{Infobox person/weight|kg-stlb=yes|108–111 kg}} → 108–111 kg (238–245 lb; 17 st 0 lb–17 st 7 lb)

with |lb-stlb=yes:

  • {{Infobox person/weight|lb-stlb=yes|200 lb}} → 200 lb (91 kg; 14 st 4 lb)
  • {{Infobox person/weight|lb-stlb=yes|238-245 lb}} → 238–245 lb (108–111 kg; 17 st 0 lb–17 st 7 lb)

Exceptions

Does not replace numbers in hard-coded conversions (examples intentionally show incorrect conversions), but does replace units with abbreviations "kg", "lb", or "st":

  • {{Infobox person/weight|108 kilograms (229 pounds)}} → 108 kg (229 lb)
  • {{Infobox person/weight|238 pounds (119 kilograms)}} → 238 lb (119 kg)
  • {{Infobox person/weight|17 stone (229 pounds; 119 kilograms)}} → 17 st (229 lb; 119 kg)

Does not replace numeric output of conversion templates such as {{convert}} (examples have precision different than usual), but does replace units with abbreviations "kg", "lb", or "st":

  • {{Infobox person/weight|{{convert|108.1|kg|lb|1|abbr=off}}}} → 108.1 kg (238.3 lb)
    • compare to: {{convert|108.1|kg|lb|1|abbr=off}} → 108.1 kilograms (238.3 pounds)
  • {{Infobox person/weight|{{convert|238.2|lb|kg|2|abbr=off}}}} → 238.2 lb (108.05 kg)
    • compare to: {{convert|238.2|lb|kg|2|abbr=off}} → 238.2 pounds (108.05 kilograms)
  • {{Infobox person/weight|{{convert|17.3|st|1|abbr=off}}}} → 17.3 st (242.2 lb; 109.9 kg)
    • compare to: {{convert|17.3|st|1|abbr=off}} → 17.3 stone (242.2 pounds; 109.9 kilograms)

Period at end of abbreviation displays after the conversion:

  • {{Infobox person/weight|5 kg.}} → 5 kg (11 lb).
  • {{Infobox person/weight|5 lb.}} → 5 lb (2 kg).
  • {{Infobox person/weight|5 st.}} → 5 st (70 lb; 32 kg).

Multiple unit conversions won't work if input contains periods or commas:

  • {{Infobox person/weight|17 st. 5 lb}} → 17 st. 5 lb
  • {{Infobox person/weight|17 st, 5 lb}} → 17 st, 5 lb

See also