Changes

Jump to navigation Jump to search
m
replace template name in first sentence, it is shown in numbered list below
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->

This is one of three templates used to automatically add conversions of weight measurements displayed by [[Template:Infobox person]] and other [[:Category:Infobox templates|infoboxes]] with a {{para|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 <code>&amp;nbsp;</code> 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 ===
* <code><nowiki>{{Infobox person/weight|100 kg}}</nowiki></code> &rarr; {{Infobox person/weight|100 kg}}
* <code><nowiki>{{Infobox person/weight|1 kilogram}}</nowiki></code> &rarr; {{Infobox person/weight|1 kilogram}}
* <code><nowiki>{{Infobox person/weight|108 kgs}}</nowiki></code> &rarr; {{Infobox person/weight|108 kgs}}
* <code><nowiki>{{Infobox person/weight|111 kilograms}}</nowiki></code> &rarr; {{Infobox person/weight|111 kilograms}}

=== pounds ===
* <code><nowiki>{{Infobox person/weight|200 lb}}</nowiki></code> &rarr; {{Infobox person/weight|200 lb}}
* <code><nowiki>{{Infobox person/weight|1 pound}}</nowiki></code> &rarr; {{Infobox person/weight|1 pound}}
* <code><nowiki>{{Infobox person/weight|238 lbs}}</nowiki></code> &rarr; {{Infobox person/weight|238 lbs}}
* <code><nowiki>{{Infobox person/weight|245 pounds}}</nowiki></code> &rarr; {{Infobox person/weight|245 pounds}}

=== stone ===
* <code><nowiki>{{Infobox person/weight|10 st}}</nowiki></code> &rarr; {{Infobox person/weight|10 st}}
* <code><nowiki>{{Infobox person/weight|1 stone}}</nowiki></code> &rarr; {{Infobox person/weight|1 stone}}
* <code><nowiki>{{Infobox person/weight|17 sts}}</nowiki></code> &rarr; {{Infobox person/weight|17 sts}}

=== stone and pounds ===
* <code><nowiki>{{Infobox person/weight|17 st 7 lb}}</nowiki></code> &rarr; {{Infobox person/weight|17 st 7 lb}}
* <code><nowiki>{{Infobox person/weight|17 sts 7 lbs}}</nowiki></code> &rarr; {{Infobox person/weight|17 sts 7 lbs}}
* <code><nowiki>{{Infobox person/weight|17 stone 7 pounds}}</nowiki></code> &rarr; {{Infobox person/weight|17 stone 7 pounds}}

=== no space or &amp;nbsp; ===
* <code><nowiki>{{Infobox person/weight|108kilograms}}</nowiki></code> &rarr; {{Infobox person/weight|108kilograms}}
* <code><nowiki>{{Infobox person/weight|238&amp;nbsp;pounds}}</nowiki></code> &rarr; {{Infobox person/weight|238&nbsp;pounds}}

=== year and reference ===
* <code><nowiki>{{Infobox person/weight|108 kgs (2012)}}</nowiki></code> &rarr; {{Infobox person/weight|108 kgs (2012)}}
* <code><nowiki>{{Infobox person/weight|238 lbs (2012)<ref>citation goes here</ref>}}</nowiki></code> &rarr; {{Infobox person/weight|238 lbs (2012)<ref>citation goes here</ref>}}
; Example references
<references />

=== weight ranges ===
with input containing [[en dash]] (–):
* <kbd><nowiki>{{</nowiki>Infobox person/weight|108</kbd>–<kbd>111 kg}}</kbd> &rarr; {{Infobox person/weight|108–111 kg}}
* <kbd><nowiki>{{</nowiki>Infobox person/weight|238</kbd>–<kbd>245 lb}}</kbd> &rarr; {{Infobox person/weight|238–245 lb}}
* <kbd><nowiki>{{</nowiki>Infobox person/weight|17</kbd>–<kbd>18 st}}</kbd> &rarr; {{Infobox person/weight|17–18 st}}

with input containing [[hyphen]] (-); output is changed to [[en dash]] by {{tl|Convert}}:
* <kbd><nowiki>{{</nowiki>Infobox person/weight|108</kbd>-<kbd>111 kg}}</kbd> &rarr; {{Infobox person/weight|108-111 kg}}
* <kbd><nowiki>{{</nowiki>Infobox person/weight|238</kbd>-<kbd>245 lb}}</kbd> &rarr; {{Infobox person/weight|238-245 lb}}
* <kbd><nowiki>{{</nowiki>Infobox person/weight|17</kbd>-<kbd>18 st}}</kbd> &rarr; {{Infobox person/weight|17-18 st}}

=== optional stlb output ===
with {{para|kg-stlb|yes}}:
* <code><nowiki>{{Infobox person/weight|kg-stlb=yes|100 kg}}</nowiki></code> &rarr; {{Infobox person/weight|kg-stlb=yes|100 kg}}
* <code><nowiki>{{Infobox person/weight|kg-stlb=yes|108–111 kg}}</nowiki></code> &rarr; {{Infobox person/weight|kg-stlb=yes|108–111 kg}}

with {{para|lb-stlb|yes}}:
* <code><nowiki>{{Infobox person/weight|lb-stlb=yes|200 lb}}</nowiki></code> &rarr; {{Infobox person/weight|lb-stlb=yes|200 lb}}
* <code><nowiki>{{Infobox person/weight|lb-stlb=yes|238-245 lb}}</nowiki></code> &rarr; {{Infobox person/weight|lb-stlb=yes|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":

* <code><nowiki>{{Infobox person/weight|108 kilograms (229 pounds)}}</nowiki></code> &rarr; {{Infobox person/weight|108 kilograms (229 pounds)}}
* <code><nowiki>{{Infobox person/weight|238 pounds (119 kilograms)}}</nowiki></code> &rarr; {{Infobox person/weight|238 pounds (119 kilograms)}}
* <code><nowiki>{{Infobox person/weight|17 stone (229 pounds; 119 kilograms)}}</nowiki></code> &rarr; {{Infobox person/weight|17 stone (229 pounds; 119 kilograms)}}

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

* <code><nowiki>{{Infobox person/weight|{{convert|108.1|kg|lb|1|abbr=off}}}}</nowiki></code> &rarr; {{Infobox person/weight|{{convert|108.1|kg|lb|1|abbr=off}}}}
** compare to: <code><nowiki>{{convert|108.1|kg|lb|1|abbr=off}}</nowiki></code> &rarr; {{convert|108.1|kg|lb|1|abbr=off}}
* <code><nowiki>{{Infobox person/weight|{{convert|238.2|lb|kg|2|abbr=off}}}}</nowiki></code> &rarr; {{Infobox person/weight|{{convert|238.2|lb|kg|2|abbr=off}}}}
** compare to: <code><nowiki>{{convert|238.2|lb|kg|2|abbr=off}}</nowiki></code> &rarr; {{convert|238.2|lb|kg|2|abbr=off}}
* <code><nowiki>{{Infobox person/weight|{{convert|17.3|st|1|abbr=off}}}}</nowiki></code> &rarr; {{Infobox person/weight|{{convert|17.3|st|1|abbr=off}}}}
** compare to: <code><nowiki>{{convert|17.3|st|1|abbr=off}}</nowiki></code> &rarr; {{convert|17.3|st|1|abbr=off}}

Period at end of abbreviation displays after the conversion:

* <code><nowiki>{{Infobox person/weight|5 kg.}}</nowiki></code> &rarr; {{Infobox person/weight|5 kg.}}
* <code><nowiki>{{Infobox person/weight|5 lb.}}</nowiki></code> &rarr; {{Infobox person/weight|5 lb.}}
* <code><nowiki>{{Infobox person/weight|5 st.}}</nowiki></code> &rarr; {{Infobox person/weight|5 st.}}

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

* <code><nowiki>{{Infobox person/weight|17 st. 5 lb}}</nowiki></code> &rarr; {{Infobox person/weight|17 st. 5 lb}}
* <code><nowiki>{{Infobox person/weight|17 st, 5 lb}}</nowiki></code> &rarr; {{Infobox person/weight|17 st, 5 lb}}

== See also ==
* [[Template:Infobox person]]
* [[Template:Infobox person/height]]
** [[Template:Infobox person/height/locate]]
** [[Template:Infobox person/height/switch]]
* [[Template:Infobox person/length]]
** [[Template:Infobox person/length/locate]]
** [[Template:Infobox person/length/switch]]

<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Template implementation details]]

}}</includeonly>
Anonymous user

Navigation menu