Template:Infobox npc/height/locate/doc

From Anarchy Online Wiki [AOWiki]

{{#ifeq:doc |doc

    | 

{{#ifeq:show |show

|

        }}{{#if: |
         |   {{#ifexist:Template:Infobox npc/height/locate
                  | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
                  |
                 }}
        }}
    | 
   }}

Template:Infobox npc/height/locate is one of three templates used to automatically add conversions of height measurements displayed by Template:Infobox person and other infoboxes with a |{{#if:height|height=}} parameter.

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

Usage[edit]

<references />

Exceptions[edit]

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

Does not replace numeric output of conversion templates such as {{convert}} or {{height}} (examples have precision different than usual):

Technical details[edit]

The following example shows how the template works:

{{Infobox person/height/switch
  |{{{1|5 ft 2&nbsp;in}}}
  |{{#invoke:String|replace|{{{1|5 ft 2&nbsp;in}}}|&nbsp;| }}
  |m={{#invoke:String|find|{{#invoke:String|replace|{{{1|5 ft 2&nbsp;in}}}|&nbsp;| }}|m}}
  |c={{#invoke:String|find|{{#invoke:String|replace|{{{1|5 ft 2&nbsp;in}}}|&nbsp;| }}|cm}}
  |f={{#invoke:String|find|{{#invoke:String|replace|{{{1|5 ft 2&nbsp;in}}}|&nbsp;| }}|ft}}
  |i={{#invoke:String|find|{{#invoke:String|replace|{{{1|5 ft 2&nbsp;in}}}|&nbsp;| }}|in}}
}}

Result:
{{Infobox person/height/switch |5 ft 2&nbsp;in |5 ft 2 in |m=0 |c=0 |f=3 |i=8 }}

See also[edit]