แม่แบบ:Infobox person/weight

จากวิกิพีเดีย สารานุกรมเสรี
ไปยังการนำทาง ไปยังการค้นหา
Documentation icon คู่มือการใช้งานแม่แบบ[ดู] [แก้] [ประวัติ] [ล้างแคช]

แม่แบบ:Infobox person 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   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
  • {{Infobox person/weight|1 kilogram}} → 1 kilogram
  • {{Infobox person/weight|108 kgs}} → 108 kg
  • {{Infobox person/weight|111 kilograms}} → 111 kilograms

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  [แก้]

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

year and reference[แก้]

  • {{Infobox person/weight|108 kgs (2012)}} → 108 kg (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
  • {{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
  • {{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
  • {{Infobox person/weight|kg-stlb=yes|108–111 kg}} → 108–111 kg

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

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 lb). (238.3 ปอนด์)
    • compare to: {{convert|108.1|kg|lb|1|abbr=off}} → 108.1 กิโลกรัม (238.3 ปอนด์)
  • {{Infobox person/weight|{{convert|238.2|lb|kg|2|abbr=off}}}} → 238.2 ปอนด์ (108.05 กก.)
    • compare to: {{convert|238.2|lb|kg|2|abbr=off}} → 238.2 ปอนด์ (108.05 กิโลกรัม)
  • {{Infobox person/weight|{{convert|17.3|st|1|abbr=off}}}} → 17.3 st (242.2 ปอนด์; 109.9 กก.)
    • compare to: {{convert|17.3|st|1|abbr=off}} → 17.3 stone (242.2 ปอนด์; 109.9 กิโลกรัม)

Period at end of abbreviation displays after the conversion:

  • {{Infobox person/weight|5 kg.}} → 5 kg
  • {{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 (243 lb; 110 kg)
  • {{Infobox person/weight|17 st, 5 lb}} → 17 st 5 lb (243 lb; 110 kg)