User:Wikid77/sandbox/Template:Convert/x/AonSoff

{{#ifexpr:abs( {{formatnum:{{{1|1/2}}}|R}} ) < 1.0001 and {{formatnum:{{{1|9}}}|R}}<>0 |{{#ifeq:{{{u|xnone x }}}|xnone |{{{n}}} |{{#ifeq: { |{{padleft:|1 |{{{u |x }}} }}|{{{n}}} |{{{u}}} }} }} |{{#ifeq:{{{u|xnone}}}|xnone |{{{l|{{{n}}}s}}} |{{#ifeq: { |{{padleft:|1|{{{u}}} }}|{{{l|{{{n}}}s}}} |{{{u}}} }} }} }} &times;&#32;{{ {{formatnum:{{{2|3}}}|R}}<>0 |{{#ifeq:{{{u|xnone x }}}|xnone |{{{n}}} |{{#ifeq: { |{{padleft:|1 |{{{u |x }}} }}|{{{n}}} |{{{u}}} }} }} |{{#ifeq:{{{u|xnone}}}|xnone |{{{l|{{{n}}}s}}} |{{#ifeq: { |{{padleft:|1|{{{u}}} }}|{{{l|{{{n}}}s}}} |{{{u}}} }} }} }}
 * 1) ifexpr: 0*{{formatnum:{{{2|4+6}}}|R}} = 0|{{{2}}}|{{User:Wikid77/Template:Convert/numdisp|{{{2|3+6/7}}}}}}} {{#ifexpr: abs( {{formatnum:{{{2|3/4}}}|R}} ) < 1.0001 and

The Template:Convert/x/AonSoff formats an input or output range where the 2 amounts are separated by an "&times;" between the amounts, with the unit symbol (if available, else shows the unit name).

For unit-codes where the unit symbol is undefined (or blank), then the template also checks for literal "{{{u}}}" with leading curly brace "{" and then shows the unit name (depending on amount singular or plural) instead.