แม่แบบ:Infobox person/weight
แม่แบบ: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.
- Template:Infobox person/weight changes text for units of weight to the abbreviations "kg", "lb", or "st", then passes the string to:
- 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: - 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{{Infobox person/weight|1 pound}}
→ 1 pound{{Infobox person/weight|238 lbs}}
→ 238 lb{{Infobox person/weight|245 pounds}}
→ 245 pounds
stone[แก้]
{{Infobox person/weight|10 st}}
→ 10 stone (140 ปอนด์; 64 กิโลกรัม){{Infobox person/weight|1 stone}}
→ 1 stone (14 ปอนด์; 6 กิโลกรัม){{Infobox person/weight|17 sts}}
→ 17 stone (238 ปอนด์; 108 กิโลกรัม)
stone and pounds[แก้]
{{Infobox person/weight|17 st 7 lb}}
→ 17 stone (238 ปอนด์; 108 กิโลกรัม) 7 lb{{Infobox person/weight|17 sts 7 lbs}}
→ 17 stone (238 ปอนด์; 108 กิโลกรัม) 7 lb{{Infobox person/weight|17 stone 7 pounds}}
→ 17 stone (238 ปอนด์; 108 กิโลกรัม) 7 pounds
no space or [แก้]
{{Infobox person/weight|108kilograms}}
→ 108kilograms{{Infobox person/weight|238 pounds}}
→ 238 pounds
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 (2012)[1]
- Example references
- ↑ citation goes here
weight ranges[แก้]
with input containing en dash (–):
- {{Infobox person/weight|108–111 kg}} → 108–111 kg
- {{Infobox person/weight|238–245 lb}} → 238–245 lb
- {{Infobox person/weight|17–18 st}} → 17–18 stone (238–252 ปอนด์; 108–114 กิโลกรัม)
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
- {{Infobox person/weight|17-18 st}} → 17–18 stone (238–252 ปอนด์; 108–114 กิโลกรัม)
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{{Infobox person/weight|lb-stlb=yes|238-245 lb}}
→ 238-245 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 pounds){{Infobox person/weight|238 pounds (119 kilograms)}}
→ 238 pounds (119 kilograms){{Infobox person/weight|17 stone (229 pounds; 119 kilograms)}}
→ 17 stone (238 ปอนด์; 108 กิโลกรัม) (229 pounds; 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 กก. (238.3 ปอนด์)- compare to:
{{convert|108.1|kg|lb|1|abbr=off}}
→ 108.1 กิโลกรัม (238.3 ปอนด์)
- compare to:
{{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 กิโลกรัม)
- compare to:
{{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 กิโลกรัม)
- compare to:
Period at end of abbreviation displays after the conversion:
{{Infobox person/weight|5 kg.}}
→ 5 kg{{Infobox person/weight|5 lb.}}
→ 5 lb{{Infobox person/weight|5 st.}}
→ 5 stone (70 ปอนด์; 32 กิโลกรัม)
Multiple unit conversions won't work if input contains periods or commas:
{{Infobox person/weight|17 st. 5 lb}}
→ 17 stone (238 ปอนด์; 108 กิโลกรัม) 5 lb{{Infobox person/weight|17 st, 5 lb}}
→ 17 stone (238 ปอนด์; 108 กิโลกรัม) 5 lb
คู่มือการใช้งานที่ปรากฏด้านบนนี้ดึงมาจาก แม่แบบ:Infobox person/weight/doc (แก้ | ประวัติ) ผู้เขียนสามารถทำการทดลองได้ที่กระบะทราย (สร้าง | คัดลอก) และชุดทดสอบ (สร้าง) ของแม่แบบนี้ โปรดเพิ่มหมวดหมู่ไปที่หน้าย่อย /doc หน้าย่อยของแม่แบบนี้ |