টেমপ্লেট:Infobox person/length/locate/নথি

উইকিপিডিয়া, মুক্ত বিশ্বকোষ থেকে

টেমপ্লেট:Infobox person/length/locate is one of three templates used to automatically add conversions of length measurements displayed by infoboxes, such as the |reach= parameter in {{Infobox boxer}}.

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

Usage[সম্পাদনা]

  • {{Template:Infobox person/length/locate|198 cm}} → ১৯৮ সেমি (৭৮ ইঞ্চি)
  • {{Template:Infobox person/length/locate|198 cm}} → ১৯৮ সেমি (৭৮ ইঞ্চি)
  • {{Template:Infobox person/length/locate|78 in}} → 78 in
  • {{Template:Infobox person/length/locate|78 in}} → 78 in
  • {{Template:Infobox person/length/locate|198 cm (2012)}} → ১৯৮ সেমি (৭৮ ইঞ্চি) (2012)
  • {{Template:Infobox person/length/locate|78&nbsp;in (2012)<ref>citation goes here</ref>}} → 78 in (2012)[১]
  1. citation goes here

Exceptions[সম্পাদনা]

Does not replace numbers in hard-coded conversions (examples intentionally show incorrect conversions):

  • {{Template:Infobox person/length/locate|198 cm (71 in)}} → 198 cm (71 in)
  • {{Template:Infobox person/length/locate|78 in (191 cm)}} → 78 in (191 cm)

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}}}} → ১৯৮ সেমি (৭৭.৯৫ ইঞ্চি)
  • {{Template:Infobox person/length/locate|{{convert|78|in|cm|1|abbr=on}}}} → ৭৮ ইঞ্চি (১৯৮.১ সেমি)

Technical details[সম্পাদনা]

The following example shows how the template works:

{{Infobox person/length/switch
  |{{{1|198&nbsp;cm}}}
  |{{#invoke:String|replace|{{{1|198&nbsp;cm}}}|&nbsp;| }}
  |c={{#invoke:String|find|{{#invoke:String|replace|{{{1|198&nbsp;cm}}}|&nbsp;| }}|cm}}
  |i={{#invoke:String|find|{{#invoke:String|replace|{{{1|198&nbsp;cm}}}|&nbsp;| }}|in}}
}}

Result:
{{Infobox person/length/switch |198&nbsp;cm |198 cm |c=5 |i=0 }}

See also[সম্পাদনা]