Open main menu

Gobblerpedia β

Changes

Template:Convert/4

9,522 bytes added, 02:21, 3 August 2011
no edit summary
<!--
-=============================================================
- Template:Convert/4 - Convert 4 units at once
-=============================================================
-
-->{{#ifeq:{{{disp|b}}}|output only|<!--
--then-skip--
--else-show-inputs-->|<!--
------------------------------------------------- Show inputs
-->{{convert/numdisp|{{{1|10}}}}}<!--show amount 1-->{{
#switch:{{padleft:|1|{{{2|x}}}}}
| x|-|,|/ =<!--then no -/space-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if hyphen--
-->}}<!--endswitch {2}-->{{
#switch:{{{2|x}}}
|- = &ndash;<!--if {2}=hyphen show dash-->
|+/- = ± | x = ×
|#default={{{2|xx}}}<!--put range-word #1
-->}}<!--endswitch {2} word-->{{
#switch:{{{2|x}}}| x|-|/ =<!--then skip hyphen-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--
-->}}<!--endswitch {2}
---------------------------------- Show {3} {4}
-->{{convert/numdisp|{{{3|20}}}}}<!--show amount 2 in param.3-->{{
#switch:{{padleft:|1|{{{4|x}}}}}
| x|-|,|/ =<!--then no -/space-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--
-->}}<!--endsw{4}-->{{
#switch:{{{4|x}}}
|- = &ndash;<!--if {4}=hyphen show dash-->
|+/- = ± | x = ×
|#default={{{4|xx}}}<!--put range-word #2
-->}}<!--endsw{4} word-->{{
#switch:{{{4|x}}}| x|-|/ =<!--then skip hyphen-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if hyphen--
-->}}<!--endsw{4}
---------------------------------- Show {5} {6}
-->{{convert/numdisp|{{{5|30}}}}}<!--show amount 3 in param.5-->{{
#switch:{{padleft:|1|{{{6|x}}}}}
| x|-|,|/ =<!--then no -/space-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if hyphen--
-->}}<!--endsw{6}-->{{
#switch:{{{6|x}}}
|- = &ndash;<!--if {6}=hyphen show dash-->
|+/- = ± | x = ×
|#default={{{6|xx}}}<!--put range-word #3
-->}}<!--endsw{6} word-->{{
#switch:{{{6|x}}}| x|-|/ =<!--then skip hyphen-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if hyphen--
-->}}<!--endsw{6}
---------------------------------- Show {7} {8}
-->{{convert/numdisp|{{{7|40}}}}}<!--show amount 4 in param.7
-->{{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if show hyphen--
-->{{convert|{{{7|40}}}|{{{8|m}}}|abbr={{
#switch: {{{abbr|off}}}<!--condense 7 values to off/on/comma-->
| off|out|none|comma|mos = def
| on|in = on
}}<!--endswitch {abbr}--
-->|lk={{{lk|off}}}|adj={{{sing|{{{adj|off}}}}}}<!--
-->|disp=unit|sp={{{sp|}}} }}<!--show unit
----------------------------------------------- Mid-text if any
-->{{#ifeq: {{{adj|off}}}|mid|<!--
-->{{#ifeq:{{padleft:|1|{{{10|}}}}}|-||&#32;}}<!--
-->{{{10|zzz}}}<!--show mid-text
-->}}<!--
----------------------------------------------- Show separator
-->{{#switch:{{{disp|b}}}
| b = &#32;(
| or = &#32;or&#32;
| s|/ = &#32;/&#32;
| comma = ,&#32;
| semi|semicolon = &#59;&#32;
| x = <b/>{{{10|}}}<b/>
| #default = '''[[Template:Convert/4|Convert/4]] - Invalid<!--
--> separator''' "disp={{{disp|xx}}}" - try: disp=s, <!--
--> disp=or, disp=comma, disp=semi, disp=output only,<!--
--> disp=x or disp=b.
}}<!--endswitch {2}--
-->}}<!--endif disp=output only
================================================= Show results
--------------------------------------- convert {1}
-->{{convert|{{{1|10}}}|{{{8|m}}}|{{{9|ft}}}<!--
-->|disp=output number only<!-- SHOW RESULT 1 --
-->|abbr={{#ifeq:{{{abbr}}}|comma|comma|def}}<!--
--> }}{{
#switch:{{padleft:|1|{{{2|x}}}}}
| x|-|,|/ =<!--then no -/space-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if hyphen--
-->}}<!--endsw{2}-->{{
#switch:{{{2|x}}}
|- = &ndash;<!--if {2}=hyphen show dash-->
|+/- = ± | x = ×
|#default={{{2|xx}}}<!--put range-word #1
-->}}<!--endsw{2} word-->{{
#switch:{{{2|x}}}| x|-|/ =<!--then skip hyphen-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if hyphen--
-->}}<!--endsw{2}
--------------------------------------- convert {3}
-->{{convert|{{{3|20}}}|{{{8|m}}}|{{{9|ft}}}<!--
-->|disp=output number only<!-- SHOW RESULT 2 --
-->|abbr={{#ifeq:{{{abbr}}}|comma|comma|def}}<!--
--> }}{{
#switch:{{padleft:|1|{{{4|x}}}}}
| x|-|,|/ =<!--then no -/space-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if hyphen--
-->}}<!--endsw{4}-->{{
#switch:{{{4|x}}}
|- = &ndash;<!--if {4}=hyphen show dash-->
|+/- = ± | x = ×
|#default={{{4|xx}}}<!--put range-word #2
-->}}<!--endsw{4} word-->{{
#switch:{{{4|x}}}| x|-|/ =<!--then skip hyphen-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if hyphen--
-->}}<!--endsw{4}
--------------------------------------- convert {5}
-->{{convert|{{{5|30}}}|{{{8|m}}}|{{{9|ft}}}<!--
-->|disp=output number only<!-- SHOW RESULT 3 --
-->|abbr={{#ifeq:{{{abbr}}}|comma|comma|def}}<!--
--> }}{{
#switch:{{padleft:|1|{{{6|x}}}}}
| x|-|,|/ =<!--then no -/space-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if hyphen--
-->}}<!--endsw{6}-->{{
#switch:{{{6|x}}}
|- = &ndash;<!--if {6}=hyphen show dash-->
|+/- = ± | x = ×
|#default={{{6|xx}}}<!--put range-word #3
-->}}<!--endsw{6} word-->{{
#switch:{{{6|x}}}| x|-|/ =<!--then skip hyphen-->
|#default={{#ifeq:{{{adj|off}}}|off|&#32;|-}}<!--if hyphen--
-->}}<!--endsw{6}
--------------------------------------- convert {7}
-->{{convert|{{{7|40}}}|{{{8|m}}}|{{{9|ft}}}<!--
-->|disp=output only<!--show result 4 & unit--
-->|lk={{{lk|off}}}<!--use link-mode
-->|abbr={{<!--use abbreviation-mode-->
#switch:{{{abbr|on}}}<!--condense 7 values to off/on/comma-->
| in = off
| none|off = none
| out|on|mos = on
| comma = comma
}}<!--endswitch {abbr}--
-->|adj={{{sing|{{{adj|off}}}}}}<!--use adjective-mode
-->|sp={{{sp|}}} }}<!--endconvert of 4th amount
-->{{#switch:{{{disp|b}}}
| output only | output number only = <!--do nothing-->
| b = )
| x = <b/>{{{11|}}}<b/>
}}<!--endsw {disp}
--><noinclude><!--
-------------------------------------------------- Doc text-->
{| width=585px style="background:transparent;"
| The converter [[Template:Convert/4]] will convert 4 amounts at once, allowing a mix of different range words between the 4 amounts. However, all 4 amounts are treated as the same unit type. The output unit must be specified, or put "0" to default.
:'''Usage''':&nbsp; <nowiki>{{convert/4 |1|by|2|by|3|by|4|m|ft}}</nowiki>
::: <nowiki>{{convert/4 |1|x|2|x|3|x|4|m|ft}}</nowiki>
::: <nowiki>{{convert/4 |1|-|2|-|3|-|4|m|ft}}</nowiki>
::: <nowiki>{{convert/4 |7|to|8|by|3|to|4.5|km|mi|abbr=on}}</nowiki>
The template has the same parameters as [[Template:Convert]], and so it allows abbreviation abbr=in or abbr=out or abbr=off, wikilinks lk=in or lk=out, and adjective mode adj=on or adj=mid. The separator can also be a semicolon: disp=semi, disp=semicolon, disp=or, disp=comma, disp=x (customized), disp=b (default as parentheses) and "disp=output only".

===Examples===
The examples show a mixture of "by" & "x" or "to" or "rarely" (etc.) in some conversions:
* {&#123;convert/4 |5|by|6|or|7|by|8|m|ft}}{{in5}}gives: {{convert/4 |5|by|6|or|7|by|8|m|ft}}
* {&#123;convert/4 |5|x|6|x|7|up to|8|m|ft}}{{pad|1.1em}}gives: {{convert/4 |5|x|6|x|7|up to|8|m|ft}}
* {&#123;convert/4 |7|to|8|,|9|or|10|km|mi}}{{pad|0.7em}}gives: {{convert/4 |7|to|8|,|9|or|10|km|mi}}
* {&#123;convert/4 |7|to|8|not|9|to|10|km|mi|abbr=on}}{{in5|4}}gives: {{convert/4 |7|to|8|not|9|to|10|km|mi|abbr=on}}
* {&#123;convert/4 |7|to|8|to|9|to|10|km|mi|adj=on}}{{in5|6}}gives: {{convert/4 |7|to|8|to|9|to|10|km|mi|adj=on}}
* {&#123;convert/4 |5|to|6|rarely|7|to|8|m|ft}} &rarr; {{convert/4 |5|to|6|rarely|7|to|8|m|ft}}
* {&#123;convert/4 |5|x|6|by|7|-|8|m|ft}}{{pad|2.2em}}&rarr; {{convert/4 |5|x|6|by|7|-|8|m|ft}}
* {&#123;convert/4 |10|-|20|, summer|25|-|30|°C|F|disp=or}} &rarr; {{convert/4 |10|-|20|, summer|30|-|40|°C|F|disp=or}}
* {&#123;convert/4 |11|-|13|-|15|-|17|°C|F|disp=semi}}{{in5}}gives: {{convert/4 |11|-|13|-|15|-|17|°C|F|disp=semi}}
* {&#123;convert/4 |40|-|50|-|60|-|70|°F|C|lk=on }}{{pad|3.2em}}gives: {{convert/4 |40|-|50|-|60|-|70|°F|C|lk=on}}
* {&#123;convert/4 |45|-|55|rising to|65|-|75|°F|C|lk=out}}{{in5}}gives: {{convert/4 |45|-|55|rising to|65|-|75|°F|C|lk=out}}

* <nowiki>{{convert/4 |5+1/2|to|6+1/3|x|7+1/4|x|8+1/5|m|ft}}</nowiki>{{in5|4}}gives: {{convert/4 |5+1/2|to|6+1/3|x|7+1/4|x|8+1/5|m|ft}}

The range-words are: to, -, and, or, by, +/-, x, but slash ("/"), comma, or anything is allowed. Display types: disp=comma, disp=semi, disp=or, disp=output only, disp=output number only, disp=x and disp=b. The numeric results are identical to using Template:Convert for each amount individually.

===Common problems===
Note the name of this template is "convert/4" and omitting the suffix "/4" can cause the error message: "<font color=darkred>'''Template loop detected:'''</font> Template:Convert/x". Be sure to put a range-word (such as "x") between each of the 4 amounts, to avoid error "<font color=darkgray>'''Convert/4 - Invalid parameter 2'''</font>".

The 4 amounts, with 3 range-words, are followed by a unit-code (such as "m") as the 8th parameter. The output unit-code can be "0" as the 9th parameter, to allow the default output unit to be triggered.
|}<!--
------------------------------------------------------ HISTORY
-03Feb11 Created, based on Convert/3, for 4-amount unit-ranges.
-
-->

[[Category:2011 Convert unit subtemplates]]
[[Category:Extended Convert subtemplates]]
</noinclude>
Anonymous user