Difference between revisions of "Template:Infobox person/height/switch/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>Zyxw
(test)
imported>Zyxw
(copy of current template)
 
Line 1: Line 1:
{{{{{|safesubst:}}}#switch:0
+
{{#switch:0
 
   |{{{m}}}{{{f}}}{{{i}}}={{{1|}}}
 
   |{{{m}}}{{{f}}}{{{i}}}={{{1|}}}
   |{{{f}}}{{{i}}}={{{{{|safesubst:}}}#ifeq:{{{c}}}|0
+
   |{{{f}}}{{{i}}}={{#ifeq:{{{c}}}|0
     |{{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#expr:{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|1|{{{{{|safesubst:}}}#expr:{{{m|1}}}-1}}}}}}
+
     |{{#iferror:{{#expr:{{#invoke:String|sub|{{{2|0}}}|1|{{#expr:{{{m|1}}}-1}}}}}}
 
         |{{{1|}}}
 
         |{{{1|}}}
         |{{{{{|safesubst:}}}convert|{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|1|{{{{{|safesubst:}}}#expr:{{{m|1}}}-1}}}}|m|ftin|0|abbr=on}}{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|{{{{{|safesubst:}}}#expr:{{{m|1}}}+1}}}}
+
         |{{convert|{{#invoke:String|sub|{{{2|0}}}|1|{{#expr:{{{m|1}}}-1}}}}|m|ftin|0|abbr=on}}{{#invoke:String|sub|{{{2|0}}}|{{#expr:{{{m|1}}}+1}}}}
 
       }}
 
       }}
     |{{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#expr:{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|1|{{{{{|safesubst:}}}#expr:{{{c|1}}}-1}}}}}}
+
     |{{#iferror:{{#expr:{{#invoke:String|sub|{{{2|0}}}|1|{{#expr:{{{c|1}}}-1}}}}}}
 
         |{{{1|}}}
 
         |{{{1|}}}
         |{{{{{|safesubst:}}}convert|{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|1|{{{{{|safesubst:}}}#expr:{{{c|1}}}-1}}}}|cm|ftin|0|abbr=on}}{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|{{{{{|safesubst:}}}#expr:{{{m|1}}}+1}}}}
+
         |{{convert|{{#invoke:String|sub|{{{2|0}}}|1|{{#expr:{{{c|1}}}-1}}}}|cm|ftin|0|abbr=on}}{{#invoke:String|sub|{{{2|0}}}|{{#expr:{{{m|1}}}+1}}}}
 
       }}
 
       }}
 
   }}
 
   }}
   |{{{m}}}{{{f}}}={{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#expr:{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|1|{{{{{|safesubst:}}}#expr:{{{i|1}}}-1}}}}}}
+
   |{{{m}}}{{{f}}}={{#iferror:{{#expr:{{#invoke:String|sub|{{{2|0}}}|1|{{#expr:{{{i|1}}}-1}}}}}}
 
         |{{{1|}}}
 
         |{{{1|}}}
         |{{{{{|safesubst:}}}convert|{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|1|{{{{{|safesubst:}}}#expr:{{{i|1}}}-1}}}}|in|cm|0|abbr=on}}{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|{{{{{|safesubst:}}}#expr:{{{i|1}}}+2}}}}
+
         |{{convert|{{#invoke:String|sub|{{{2|0}}}|1|{{#expr:{{{i|1}}}-1}}}}|in|cm|0|abbr=on}}{{#invoke:String|sub|{{{2|0}}}|{{#expr:{{{i|1}}}+2}}}}
 
       }}
 
       }}
   |{{{m}}}{{{i}}}={{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#expr:{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|1|{{{{{|safesubst:}}}#expr:{{{f|1}}}-1}}}}}}
+
   |{{{m}}}{{{i}}}={{#iferror:{{#expr:{{#invoke:String|sub|{{{2|0}}}|1|{{#expr:{{{f|1}}}-1}}}}}}
 
         |{{{1|}}}
 
         |{{{1|}}}
         |{{{{{|safesubst:}}}convert|{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|1|{{{{{|safesubst:}}}#expr:{{{f|1}}}-1}}}}|ft|cm|0|abbr=on}}{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|{{{{{|safesubst:}}}#expr:{{{f|1}}}+2}}}}
+
         |{{convert|{{#invoke:String|sub|{{{2|0}}}|1|{{#expr:{{{f|1}}}-1}}}}|ft|cm|0|abbr=on}}{{#invoke:String|sub|{{{2|0}}}|{{#expr:{{{f|1}}}+2}}}}
 
       }}
 
       }}
   |{{{m}}}={{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#expr:{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|1|{{{{{|safesubst:}}}#expr:{{{f|1}}}-1}}}}+{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|{{{{{|safesubst:}}}#expr:{{{f|1}}}+2}}|{{{{{|safesubst:}}}#expr:{{{i|1}}}-1}}}}}}
+
   |{{{m}}}={{#iferror:{{#expr:{{#invoke:String|sub|{{{2|0}}}|1|{{#expr:{{{f|1}}}-1}}}}+{{#invoke:String|sub|{{{2|0}}}|{{#expr:{{{f|1}}}+2}}|{{#expr:{{{i|1}}}-1}}}}}}
 
         |{{{1|}}}
 
         |{{{1|}}}
         |{{{{{|safesubst:}}}convert|{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|1|{{{{{|safesubst:}}}#expr:{{{f|1}}}-1}}}}|ft|{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|{{{{{|safesubst:}}}#expr:{{{f|1}}}+2}}|{{{{{|safesubst:}}}#expr:{{{i|1}}}-1}}}}|in|cm|0|abbr=on}}{{{{{|safesubst:}}}#invoke:String|sub|{{{2|0}}}|{{{{{|safesubst:}}}#expr:{{{i|1}}}+2}}}}
+
         |{{convert|{{#invoke:String|sub|{{{2|0}}}|1|{{#expr:{{{f|1}}}-1}}}}|ft|{{#invoke:String|sub|{{{2|0}}}|{{#expr:{{{f|1}}}+2}}|{{#expr:{{{i|1}}}-1}}}}|in|cm|0|abbr=on}}{{#invoke:String|sub|{{{2|0}}}|{{#expr:{{{i|1}}}+2}}}}
 
       }}
 
       }}
 
   |{{{1|}}}
 
   |{{{1|}}}

Latest revision as of 14:15, 18 February 2019

Template documentation[view] [edit] [history] [purge]

This is one of three templates used to automatically add conversions of height measurements displayed by Template:Infobox person and other infoboxes with a |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

See also