ਫਰਮਾ:Infobox person/length/locate/doc
ਇਹ ਇੱਕ ਫਰਮਾ:Infobox person/length/locate ਲਈ documentation ਉਪ ਸਫ਼ਾ ਹੈ। ਇਸ ਵਿੱਚ ਵਰਤੋਂ ਦੀ ਜਾਣਕਾਰੀ, ਸ਼੍ਰੇਣੀਆਂ ਅਤੇ ਹੋਰ ਸਮੱਗਰੀ ਜੋ ਮੂਲ ਦਾ ਹਿੱਸਾ ਨਹੀਂ ਹੈ, ਸ਼ਾਮਲ ਹੈ। ਫਰਮਾ page. |
This is one of three templates used to automatically add conversions of length measurements displayed by infoboxes, such as the |reach=
parameter in {{Infobox boxer}}
or the |spike=
and |block=
parameters in {{Infobox volleyball biography}}
.
- Template:Infobox person/length changes text for units of length to the abbreviations "in", "cm" or "m", then passes the string to:
- Template:Infobox person/length/locate which replaces any instances of
with a space, and determines the positions of "in", "cm" or "m" within that string, all of which is passed to: - Template:Infobox person/length/switch which does the conversion
Usage
ਸੋਧੋ{{Template:Infobox person/length/locate|198 cm}}
→ 198 cm (78 in){{Template:Infobox person/length/locate|198 cm}}
→ 198 cm (78 in){{Template:Infobox person/length/locate|78 in}}
→ 78 in (198 cm){{Template:Infobox person/length/locate|78 in}}
→ 78 in (198 cm){{Template:Infobox person/length/locate|198 cm (2012)}}
→ 198 cm (78 in) (2012){{Template:Infobox person/length/locate|78 in (2012)<ref>citation goes here</ref>}}
→ 78 in (198 cm) (2012)[1]
- ↑ citation goes here
Exceptions
ਸੋਧੋDoes not replace numbers in manually entered conversions (examples intentionally show incorrect conversions):
{{Template:Infobox person/length/locate|198 cm (71 in)}}
→ 198 cm (71 in){{Template:Infobox person/length/locate|1.98 m (71 in)}}
→ 1.98 m (71 in){{Template:Infobox person/length/locate|78 in (191 cm)}}
→ 78 in (191 cm){{Template:Infobox person/length/locate|78 in (1.91 m)}}
→ 78 in (1.91 m)
Does not replace numeric output of conversion templates such as {{convert}} (examples have precision different than usual):
{{Template:Infobox person/length/locate|{{convert|198|cm|in|2|abbr=on}}}}
→ 198 cm (77.95 in){{Template:Infobox person/length/locate|{{convert|1.98|m|in|2|abbr=on}}}}
→ 1.98 m (77.95 in){{Template:Infobox person/length/locate|{{convert|78|in|cm|1|abbr=on}}}}
→ 78 in (198.1 cm){{Template:Infobox person/length/locate|{{convert|78|in|m|3|abbr=on}}}}
→ 78 in (1.981 m)
Technical details
ਸੋਧੋThe following examples show how the template works:
cm
ਸੋਧੋ{{Infobox person/length/switch |{{{1|198 cm}}} |{{#invoke:String|replace|{{{1|198 cm}}}| | }} |c={{#invoke:String|find|{{#invoke:String|replace|{{{1|198 cm}}}| | }}|cm}} |m={{#invoke:String|find|{{#invoke:String|replace|{{{1|198 cm}}}| | }}|m}} |i={{#invoke:String|find|{{#invoke:String|replace|{{{1|198 cm}}}| | }}|in}} }}
Result:
{{Infobox person/length/switch
|198 cm
|198 cm
|c=5
|m=6
|i=0
}}
198 cm (78 in)
m
ਸੋਧੋ{{Infobox person/length/switch |{{{1|1.98 m}}} |{{#invoke:String|replace|{{{1|1.98 m}}}| | }} |c={{#invoke:String|find|{{#invoke:String|replace|{{{1|1.98 m}}}| | }}|cm}} |m={{#invoke:String|find|{{#invoke:String|replace|{{{1|1.98 m}}}| | }}|m}} |i={{#invoke:String|find|{{#invoke:String|replace|{{{1|1.98 m}}}| | }}|in}} }}
Result:
{{Infobox person/length/switch
|1.98 m
|1.98 m
|c=0
|m=6
|i=0
}}
1.98 m (78 in)
in
ਸੋਧੋ{{Infobox person/length/switch |{{{1|78 in}}} |{{#invoke:String|replace|{{{1|78 in}}}| | }} |c={{#invoke:String|find|{{#invoke:String|replace|{{{1|78 in}}}| | }}|cm}} |m={{#invoke:String|find|{{#invoke:String|replace|{{{1|78 in}}}| | }}|m}} |i={{#invoke:String|find|{{#invoke:String|replace|{{{1|78 in}}}| | }}|in}} }}
Result:
{{Infobox person/length/switch
|78 in
|78 in
|c=0
|m=0
|i=4
}}
78 in (198 cm)
See also
ਸੋਧੋ