Template:Infobox person/length/doc

From Hârn
Jump to navigation Jump to search

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}}.

  1. Template:Infobox person/length changes text for units of length to the abbreviations "in", "cm" or "m", then passes the string to:
  2. 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:
  3. Template:Infobox person/length/switch which does the conversion

Usage[edit source]

Inches:

  • {{Infobox person/length|1 inch}} → 1 in (3 cm)
  • {{Infobox person/length|78 inches}} → 78 in (198 cm)
  • {{Infobox person/length|78 ins}} → 78 in (198 cm)
  • {{Infobox person/length|78 in.}} → 78 in (198 cm)
  • {{Infobox person/length|78 in}} → 78 in (198 cm)

Centimetres:

  • {{Infobox person/length|1 centimetre}} → 1 cm (0 in)
  • {{Infobox person/length|1 centimeter}} → 1 cm (0 in)
  • {{Infobox person/length|198 centimetres}} → 198 cm (78 in)
  • {{Infobox person/length|198 centimeters}} → 198 cm (78 in)
  • {{Infobox person/length|198 cms}} → 198 cm (78 in)
  • {{Infobox person/length|198 cm.}} → 198 cm (78 in)
  • {{Infobox person/length|198 cm}} → 198 cm (78 in)

Metres:

  • {{Infobox person/length|1 metre}} → 1 m (39 in)
  • {{Infobox person/length|1 meter}} → 1 m (39 in)
  • {{Infobox person/length|1.98 metres}} → 1.98 m (78 in)
  • {{Infobox person/length|1.98 meters}} → 1.98 m (78 in)
  • {{Infobox person/length|1.98 ms}} → 1.98 m (78 in)
  • {{Infobox person/length|1.98 m.}} → 1.98 m (78 in)
  • {{Infobox person/length|1.98 m}} → 1.98 m (78 in)

Non-breaking space or missing space after number:

  • {{Infobox person/length|78 inches}} → 78 in (198 cm)
  • {{Infobox person/length|198centimetres}} → 198 cm (78 in)
  • {{Infobox person/length|1.98metres}} → 1.98 m (78 in)

Footnotes or additional text:

  • {{Infobox person/length|78 ins (2012)<ref>citation goes here</ref>}} → 78 in (198 cm) (2012)[1]
  • {{Infobox person/length|198 cms (2012)}} → 198 cm (78 in) (2012)
  • {{Infobox person/length|1.98 ms<ref>citation goes here</ref>}} → 1.98 m (78 in)[2]
  1. citation goes here
  2. citation goes here

Exceptions[edit source]

Manually entered conversions are not changed, but units are replaced with "in", "cm" or "m" (examples intentionally show incorrect conversions):

  • {{Infobox person/length|78 inches (191 centimeters)}} → 78 in (191 cm)
  • {{Infobox person/length|78 inches (1.91 meters)}} → 78 in (1.91 m)
  • {{Infobox person/length|198 centimetres (71 inches)}} → 198 cm (71 in)
  • {{Infobox person/length|1.98 metres (71 inches)}} → 1.98 m (71 in)

Conversions via a template such as {{convert}} are not changed, but units are replaced with "in", "cm" or "m" (examples have precision different than usual):

  • {{Infobox person/length|{{convert|78|in|cm|1|abbr=off|sp=us}}}} → 78 in (198.1 cm)
    • output of convert template: 78 inches (198.1 centimeters)
  • {{Infobox person/length|{{convert|78|in|m|3|abbr=off|sp=us|lk=on}}}} → 78 in (1.981 m)
  • {{Infobox person/length|{{convert|198|cm|in|2|abbr=off|lk=on}}}} → 198 cm (77.95 in)
  • {{Infobox person/length|{{convert|1.98|m|in|2|abbr=off}}}} → 1.98 m (77.95 in)
    • output of convert template: 1.98 metres (77.95 inches)

Does not recognize symbols for inches:

  • {{Infobox person/length|78"}} → 78"
  • {{Infobox person/length|78″}} → 78″
  • {{Infobox person/length|198cm (78")}} → 198 cm (78 in) (78")
  • {{Infobox person/length|198cm (78″)}} → 198 cm (78 in) (78″)

Does not convert feet (ft), yards (yd), etc.:

  • {{Infobox person/length|5 feet}} → 5 feet
  • {{Infobox person/length|5 ft}} → 5 ft
  • {{Infobox person/length|5 yards}} → 5 yards
  • {{Infobox person/length|5 yd}} → 5 yd

See also[edit source]

External links[edit source]