Difference between revisions 5551603 and 5551617 on simplewiki<noinclude><!-- -=========================================== - Convert/mix2 - Convert 2 amounts, 2 units -=========================================== - (see NOTES at bottom) --></noinclude>{{#switch:{{{warn|no}}} | y|yes = {{#switch:{{{4|xby}}} | and|or|x|xx|by|-|+/-|,|to = <!--ok--> | #default = '''<span style="color:#DD6600">[[Template:Convert/mix2|Convert/mix2]] - Invalid<!-- --> parameter 4''' "{{{4|??}}}" - try: by, to, and,<!-- --> or, -, +/-, x, xx or comma. </span> }}<!--endswitch {4}--> }}<!--endswitch {warn}-- ------------------------------ Check display -->{{#switch: {{{disp|b}}} <!--switch {disp} #1--> | 2|#|out| output only|number|output number only = | #default = <!-- ---------------------------- Show amount #1 -->{{convert/numdisp|{{formatnum:{{{1|10}}}|R }}}}<!--show amount 1-->{{ #switch:{{{abbr|def}}}{{{adj|off}}}|off | defoff|outoff|offoff|~off = {{ #ifexprq: {{strlen{1|2}}} |{{padleft:|3|{{{1|2}}}|zz}} < 3 | | | | }} | onoff|inoff = {{ #ifexprq: {{strlen|{{{1|2}}}|}} < 5 | | {1|2}}} |{{padleft:|5|{{{1|2}}}zzzz}} | | }} | valuesoff = | #default = - }}<!--endif {adj} off-- ----------------------------- Show unit #1 -->{{convert|{{{1|10}}}|{{{2|cm}}}|{{{3|0}}}|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 ------------------------------------------- -->{{ #switch:{{padleft:|1|{{{4|x}}}}} | ,|&|<|[|/ =<!--then no -/space--> | + = {{#ifeq:{{{4|+}}}|+/-| }}<!--then nobreak space--> | x|- =   | ± = {{#ifexpr: {{formatnum:{{{5|2}}}|R}} < 100 | | }} |#default={{#ifeq:{{{adj|off}}}|all|-| }}<!--if hyphen--> }}<!--endswitch {4} #a-->{{ #switch:{{{4|x}}}| x = ×<!--if {4}=x show small-x #b--> | - = –<!--if {4}=hyphen show dash--> | +/- = ±<!--if {4}=+/- show plus-minus--> | #default={{{4|xx}}}<!--put range-word #1--> }}<!--endswitch {4} word #b-->{{ #switch:{{padleft:|1|{{{4|x}}}}} | / =<!--then no -/space--> | , =  <!--then space--> | x|- = | + = <!--then nobreak space--> | ± = |#default={{#ifeq:{{{adj|off}}}|all|-| }}<!--if hyphen--> }}<!--endswitch {4} #c ----------------------------- Show amount #2 -->{{convert/numdisp|{{formatnum:{{{5|2}}}|R }}}}<!--show amount 2 in param.5-->{{ #switch:{{{abbr|def}}}{{{adj|off}}}|off | defoff|outoff|offoff|~off = {{ #ifexprq: {{strlen{5|2}}} |{{padleft:|3|{{{5|2}}}|zz}} < 3 | | | | }} | onoff|inoff = {{ #ifexprq: {{strlen|{{{5|2}}}|}} < 5 | | {5|2}}} |{{padleft:|5|{{{5|2}}}zzzz}} | | }} | valuesoff = | #default = - }}<!--endif {adj} off-- ----------------------------- Show unit #2 -->{{convert|{{{5|2}}}|{{{6|m}}}|{{{7|0}}}|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 ----------------------------- Show aftertext -->{{#if: {{{8|}}} | {{#switch: {{padleft:|1|{{{8}}} }} | -|&|< = {{{8}}} | #default =  {{{8}}} }}<!--endswitch char of {8}--> }}<!--endif {8} ----------------------------- Show separator -->{{#switch:{{{disp|b}}} | b =  ( | br = <br> | sqbr =  [ | or =  or  | s|/ =  /  | comma = ,  | semi|semicolon = ;  | x = <b/>{{{8| [}}} | #default = '''[[Template:Convert/mix2|Convert/mix2]] - Invalid<!-- --> separator''' "disp={{{disp|xx}}}" - try: disp=x, <!-- --> disp=or, disp=comma, disp=semi, disp=sqbr or disp=b. }}<!--endswitch {2} --> }}<!--endswitch {disp} #1-- ------------------------------- Show results -->{{convert|{{{1|10}}}|{{{2|cm}}}|{{{3|0}}}<!--RESULT #1 -->|<!--param.4-->{{ #if:{{{r|}}} | {{{r}}} |{{<!--else-->#ifeq:{{{disp|b}}}|x |{{#if:{{{11|}}}|{{{11}}} }}<!--endif {11}--> |{{#if:{{{9|}}}|{{{9}}} }}<!--endif {9} -->}}<!--endif {disp}=x -->{{#ifexpr:{{precision|{{{1|0}}}|}} > {{precision|{{{5|0}}}|}} | {{precision|{{{1}}}|}} }}<!--endif prec {1}>{5} -->{{#ifexpr:{{precision|{{{5|0}}}|}} > {{precision|{{{1|0}}}|}} | {{precision|{{{5}}}|}} }}<!--endif prec {5}>{1} -->}}<!--endif {r} -->|sigfig={{#if:{{{sigfig|}}}|{{{sigfig|9}}} }}<!-- -->|disp=out<!-- SHOW RESULT 1 -- -->|abbr={{#ifeq:{{{abbr}}}|comma|comma|def}}<!-- --> }}<!-- --------------------------------- Separator -->{{ #switch:{{ padleft:|1|{{{out|{{{4|x}}}|}}} }} | ,|&|<|[|/ =<!--then no -/space--> | + = {{ #ifeq:{{{out|{{{4|+}}}|}}} |+/- | }}<!--then nobreak space--> | x|- =   | ± = {{#ifexpr: {{formatnum:{{{5|2}}}|R}} < 100 | | }} |#default={{#ifeq:{{{adj|off}}}|all |-| }}<!--if hyphen--> }}<!--endswitch {out|{4}} #d-->{{ #switch:{{{out|{{{4|x}}}|}}} | x = ×<!--if =x show small-x #e--> | - = –<!--if =hyphen show dash--> | +/- = ±<!--if +/- show plus-minus--> | #default= {{{out|{{{4|xx}}}|}}}<!--range #1--> }}<!--endswitch {out|{4}} word #e-->{{ #switch:{{ padleft:|1|{{{out|{{{4|x}}}|}}} }} | / =<!--then no -/space--> | , =  <!--then space--> | x|- = | + = <!--then nobreak space--> | ± = |#default={{#ifeq:{{{adj|off}}}|all |-| }}<!--if hyphen--> }}<!--endswitch {out|{4}} #f ---------------------------------- Result #2 -->{{convert|{{{5|2}}}|{{{6|m}}}|{{{7|0}}}<!-- -->|<!--param.4-->{{ #if:{{{r|}}} | {{{r}}} |{{<!--else-->#ifeq:{{{disp|b}}}|x |{{#if:{{{11|}}}|{{{11}}} }}<!--endif {11}--> |{{#if:{{{9|}}}|{{{9}}} }}<!--endif {9} -->}}<!--endif {disp}=x -->{{#ifexpr:{{precision|{{{1|0}}}|}} > {{precision|{{{5|0}}}|}} | {{precision|{{{1}}}|}} }}<!--endif prec {1}>{5} -->{{#ifexpr:{{precision|{{{5|0}}}|}} > {{precision|{{{1|0}}}|}} | {{precision|{{{5}}}|}} }}<!--endif prec {5}>{1} -->}}<!--endif {r} -->|sigfig={{#if:{{{sigfig|}}}|{{{sigfig|9}}} }}<!-- -->|disp={{#switch: {{{disp|b}}} <!--#2--> | #|number|output number only = number | #default = out<!--show result & unit--> }}<!--endswitch {disp} #2-- -->|lk={{{lk|off}}}<!--use link-mode -->|abbr={{<!--use abbreviation-mode--> #switch:{{{abbr|on}}}<!--condense 7 values to off/on/comma--> | in = off | none|off = off | out|on|mos = on | comma = comma }}<!--endswitch {abbr}-- -->|adj={{{sing|{{{adj|off}}}}}}<!--use adjective-mode -->|sp={{{sp|}}} }}<!--endconvert of 2nd amount ----------------------------------------------- Show aftertext -->{{#if: {{{out2|{{{8|}}}|}}} | {{#switch: {{ padleft:|1|{{{out2|{{{8}}}|}}} }} | -|&|<|/ = {{{out2|{{{8}}}|}}} | #default =  {{{out2|{{{8}}}|}}} }}<!--endswitch char of {out2|{8}}--> }}<!--endif {out2|{8}} -->{{#switch:{{{disp|b}}} | b = ) | sqbr = ] | br = | x = {{#if:{{{8|}}}|{{{9|}}}|]}}<!--put "]" if no {6} --> }}<!--when disp=b put parenthesis- --><noinclude><!-- -------------------------------------------- -NOTES - - NOTE A1: This template converts 2 amounts, of different units - with text between them (and repeated between 2 results). - It allows any other options of Convert, such as disp=x. - Allows any text, unlike ranges which limit the separator. - A hyphen "-" will be displayed as an &ndash, and an "x" - will appear an an elevated small "x". - - NOTE D2: When using parameters 8-10, the output unit-code in - parameters 3 & 7 can be set to "0" for default outputs. - - NOTE P3: The rounding of the output amounts can be set by - passing p=2 to round both results to 2 decimal places. - Also, when disp=x, parameter 10 can be "|2" to round 2; - otherwise, parameter 8 as "|3" can round to 3 decimals. - -------------------------------------------- -HISTORY: -11Jan12 Created, from Convert/3, for 2-unit ranges. -11Jan12 Put NOTES comments to explain template operation. -11Jan12 Put HISTORY comments to log major changes (not typos). -11Jan12 Removed restrictions on separator unless "warn=yes". -11Jan12 For disp=2 (disp=out) shows just output amounts/unit. -11Jan12 For disp=# (disp=number) shows just output amounts. -11Jan12 For disp=x, shows parm.8 before, parm.9 after output. -11Jan12 New p=2 rounds both results to 2 decimal places. -11Jan12 Allows disp=sqbr (or =br) for square brackets "[ ]". -11Jan12 Set to allow "sigfig=n" digits. -04Jan14 Removed deviant tag {Tdeprecated} of confusing reasons. -04Jan14 Expanded to nowrap small numbers or symbols < 9999. -04Jan14 Expanded to allow format tags and HTML entities. -18Mar16 Shorten comments to fit phone view. -18Mar16 Use adj=all for all hyphens. -18Mar16 Default precision to highest of 2. --> {{documentation}} </noinclude> All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://simple.wikipedia.org/w/index.php?diff=prev&oldid=5551617.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|