Difference between revisions of "Template:Convert/x"
m (1 revision: Conversion templates from wikipedia) |
m (1 revision) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | {{formatnum:{{convert/{{{4}}}|{{{1}}}|x|{{{3}}}|{{#ifeq:{{#expr:({{{5}}}+0)*0}}|0|def|{{{5}}}}}|{{{6|}}}<!--set | + | {{formatnum:{{convert/{{{4}}}|{{{1}}}|x|{{{3}}}<!-- |
+ | -->|{{#ifeq:{{#expr:({{{5}}}+0)*0}}|0|def|{{{5}}}}}<!--param. 4 | ||
+ | -->|{{{6|}}}<!--set parameter 5-- | ||
+ | -->|{{{7|}}}<!--set parameter 6-- | ||
+ | -->|s=({{#ifeq:{{#expr:({{{5|a}}})*0}}|0|{{{5}}}|{{#ifeq:{{#expr:({{{6|a}}})*0}}|0|{{{6}}}|{{#ifeq:{{#expr:({{{8|a}}})*0}}|0|{{{8}}}|0.5}} }} }})+(0{{{s}}})<!--set precision as numeric {5},{6} or {8} | ||
+ | -->|r={{{r}}}|d=Dual/{{{d}}}}}}}<noinclude> | ||
+ | |||
+ | <br>The [[Template:Convert/x]] (for ranges using "x") is invoked as the first template below {Convert}, for converting ranges such as {Convert|2|x|4|ft|m}. It immediately invokes Convert/{4}, for the input unit {4}, passing the range of input numbers as "{1}|x|{3}". Having obtained all 8 parameters, {1}|x|{3}...{8}, it sets the precision "s" from either parameter {5}, {6} or {8} (depending on whichever is the numeric round-number); otherwise, the precision is set as: <nowiki>s=(0.5)+(0{{{s}}})</nowiki>. It passes {d} down as Dual/{d} to invoke subtemplate Convert/Dual/{d} which displays the dual-range (rather than a typical single amount). For any customization, such as disp=x, the parameters {6} and {7} are passed as {5} and {6} (or null if none). | ||
+ | |||
[[Category:Subtemplates of Template Convert]] | [[Category:Subtemplates of Template Convert]] | ||
</noinclude> | </noinclude> |
Latest revision as of 13:53, 10 December 2011
{{convert/{{{4}}}|{{{1}}}|x|{{{3}}}|{{{5}}}|||s=(0.5)+(0{{{s}}})|r={{{r}}}|d=Dual/{{{d}}}}}
The Template:Convert/x (for ranges using "x") is invoked as the first template below {Convert}, for converting ranges such as {Convert|2|x|4|ft|m}. It immediately invokes Convert/{4}, for the input unit {4}, passing the range of input numbers as "{1}|x|{3}". Having obtained all 8 parameters, {1}|x|{3}...{8}, it sets the precision "s" from either parameter {5}, {6} or {8} (depending on whichever is the numeric round-number); otherwise, the precision is set as: s=(0.5)+(0{{{s}}}). It passes {d} down as Dual/{d} to invoke subtemplate Convert/Dual/{d} which displays the dual-range (rather than a typical single amount). For any customization, such as disp=x, the parameters {6} and {7} are passed as {5} and {6} (or null if none).