Template:Val: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>SkyLined
Reverted 8 edits by SkyLined; Undoing changes again because of linebreaks problem. (TW)
meta>SkyLined
A third attempt to allow use without any unnamed arguments
Line 9: Line 9:
--><span style="white-space:nowrap"><!--
--><span style="white-space:nowrap"><!--
START ERROR CHECKING:
START ERROR CHECKING:
-->{{#ifeq:{{valid|number={{{1}}}}}|false|<!-- Is arg1 not a valid number?
-->{{#ifeq:{{valid|number={{{1|0}}}}}|false|<!-- Is arg1 not a valid number?
   -->{{FormattingError|Error in {{tl|val}}: first argument is not a valid number or requires too much precision to display.|nocategory={{{nocategory|}}}}}<!--
   -->{{FormattingError|Error in {{tl|val}}: first argument is not a valid number or requires too much precision to display.|nocategory={{{nocategory|}}}}}<!--
-->|<!-- Is arg1 not a valid number? NO
-->|<!-- Is arg1 not a valid number? NO
Line 35: Line 35:
END ERROR CHECKING, START OUTPUT
END ERROR CHECKING, START OUTPUT
                 -->{{{p|}}}<!-- If p (prefix) is defined, display it.
                 -->{{{p|}}}<!-- If p (prefix) is defined, display it.
                 -->{{val/delimitnum|{{{1|}}}}}{{{end|}}}<!-- Output arg1, formatted.
 
                -->{{#if: {{{2|}}}|<!-- Are there 2 or more arguments?
                 -->{{#if: {{{1|}}}|<!-- Are there any arguments?
                  -->{{#if: {{{3|}}}|<!-- Are there 3 arguments?
                  -->{{val/delimitnum|{{{1|}}}}}{{{end|}}}<!-- Output arg1, formatted.
                    --><span style="white-space:nowrap;margin-left:0.3em;">{{su|<!-- Uncertainty = +X -Y (3 arguments)
                  -->{{#if: {{{2|}}}|<!-- Are there 2 or more arguments?
                      -->w=f|a=r|<!-- Fixed width, right aligned
                    -->{{#if: {{{3|}}}|<!-- Are there 3 arguments?
                      -->p=+{{val/delimitnum|{{{2}}}}}{{{+errend|}}}|<!-- Output +arg2, formatted.
                      --><span style="white-space:nowrap;margin-left:0.3em;">{{su|<!-- Uncertainty = +X -Y (3 arguments)
                      -->b={{val/delimitnum|{{{3}}}}}{{{-errend|}}}<!-- Output -arg3, formatted.
                        -->w=f|a=r|<!-- Fixed width, right aligned
                    -->}}</span><!--
                        -->p=+{{val/delimitnum|{{{2}}}}}{{{+errend|}}}|<!-- Output +arg2, formatted.
                  -->|<!-- Are there 3 arguments? NO
                        -->b={{val/delimitnum|{{{3}}}}}{{{-errend|}}}<!-- Output -arg3, formatted.
                    -->{{#if:{{#ifexpr: 0{{{2}}}}}|<!-- Second argument is "(number)"?
                      -->}}</span><!--
                      -->{{{2}}}<!-- Significance = (X)
                    -->|<!-- Are there 3 arguments? NO
                    -->|<!-- Second argument is "(number)"? NO
                      -->{{#if:{{#ifexpr: 0{{{2}}}}}|<!-- Second argument is "(number)"?
                      --><span style="white-space:nowrap;margin-left:0.3em;margin-right:0.15em">±</span>{{val/delimitnum|{{{2}}}}}{{{errend|}}}<!-- Uncertainty = ±X
                        -->{{{2}}}<!-- Significance = (X)
                    -->}}<!-- End second argument is "(number)"?
                      -->|<!-- Second argument is "(number)"? NO
                  -->}}<!-- End Are there 3 arguments?
                        --><span style="white-space:nowrap;margin-left:0.3em;margin-right:0.15em">±</span>{{val/delimitnum|{{{2}}}}}{{{errend|}}}<!-- Uncertainty = ±X
                -->}}<!-- End Are there 2 arguments?
                      -->}}<!-- End second argument is "(number)"?
                -->{{#if:{{{e|}}}|<span style="white-space:nowrap;margin-left:0.25em;margin-right:0.15em">×</span>10{{su|p={{val/delimitnum|{{{e}}}}}}}}}<!-- e=exponent
                    -->}}<!-- End Are there 3 arguments?
                  -->}}<!-- End Are there 2 arguments?
                  -->{{#if:{{{e|}}}|<span style="white-space:nowrap;margin-left:0.25em;margin-right:0.15em">×</span>10{{su|p={{val/delimitnum|{{{e}}}}}}}}}<!-- e=exponent
                -->|<!-- Are there any arguments? NO
                  -->{{#if:{{{e|}}}|10{{su|p={{val/delimitnum|{{{e}}}}}}}}}<!-- e=exponent
                -->}}<!-- End Are there any arguments?
                 -->{{#if:{{{u|}}}|&nbsp;{{val/units|{{{u}}}}}}}<!-- u=units  
                 -->{{#if:{{{u|}}}|&nbsp;{{val/units|{{{u}}}}}}}<!-- u=units  
                 -->{{#if:{{{ul|}}}|&nbsp;{{val/unitswithlink|{{{ul}}}}}}}<!-- u=units with link
                 -->{{#if:{{{ul|}}}|&nbsp;{{val/unitswithlink|{{{ul}}}}}}}<!-- u=units with link

Revision as of 10:08, 21 December 2009