Template:Val: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>SkyLined
(One more small change should do it :()
meta>SkyLined
(Reverted 8 edits by SkyLined; Undoing changes again because of linebreaks problem. (TW))
Line 1: Line 1:
<noinclude>
<noinclude>
{{pp-template|small=yes}}
{{pp-template|small=yes}}
{{documentation}}
{{documentation}}
<!--
<!--
PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS
PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS
Normally, the code for the template is included, but this template is too complex to do that.
Normally, the code for the template is included, but this template is too complex to do that.
Line 9: Line 9:
--><span style="white-space:nowrap"><!--
--><span style="white-space:nowrap"><!--
START ERROR CHECKING:
START ERROR CHECKING:
-->{{#ifeq:{{valid|number={{{1|0}}} }}|false|<!-- If there is an unnamed argument, it must be a valid number
-->{{#ifeq:{{valid|number={{{1}}}}}|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
   -->{{#ifeq:{{valid|number={{{2|0}}}}}|false|<!-- If there are two unnamed arguments, the second must also be a valid number
   -->{{#ifeq:{{valid|number={{{2|0}}}}}|false|<!-- Is arg2 not a valid number?
     -->{{FormattingError|Error in {{tl|val}}: second argument is not a valid number or requires too much precision to display.|nocategory={{{nocategory|}}}}}<!--
     -->{{FormattingError|Error in {{tl|val}}: second argument is not a valid number or requires too much precision to display.|nocategory={{{nocategory|}}}}}<!--
   -->|<!-- Is arg2 not a valid number? NO
   -->|<!-- Is arg2 not a valid number? NO
     -->{{#ifeq:{{valid|number={{{3|0}}}}}|false|<!-- If there are three unnamed arguments, the third must also be a valid number
     -->{{#ifeq:{{valid|number={{{3|0}}}}}|false|<!-- Is arg3 not a valid number?
       -->{{FormattingError|Error in {{tl|val}}: third argument is not a valid number or requires too much precision to display.|nocategory={{{nocategory|}}}}}<!--
       -->{{FormattingError|Error in {{tl|val}}: third argument is not a valid number or requires too much precision to display.|nocategory={{{nocategory|}}}}}<!--
     -->|<!-- Is arg3 not a valid number? NO
     -->|<!-- Is arg3 not a valid number? NO
       -->{{#ifexpr: {{{3|-1}}} >= 0|<!-- If there are three unnamed arguments, the third must be a positive number
       -->{{#ifexpr: {{{3|-1}}} >= 0|<!-- Is arg3 positive?
         -->{{FormattingError|Error in {{tl|val}}: third argument is not negative.|nocategory={{{nocategory|}}}}}<!--
         -->{{FormattingError|Error in {{tl|val}}: third argument is not negative.|nocategory={{{nocategory|}}}}}<!--
       -->|<!-- Is arg3 positive? NO
       -->|<!-- Is arg3 positive? 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.
                 -->{{#if:{{{1|}}}|<!--- Is there at least one unnamed argument?
                 -->{{val/delimitnum|{{{1|}}}}}{{{end|}}}<!-- Output arg1, formatted.
 
                -->{{#if: {{{2|}}}|<!-- Are there 2 or more arguments?
                  -->{{val/delimitnum|{{{1|}}}}}{{{end|}}}<!-- Output arg1, formatted.
                  -->{{#if: {{{3|}}}|<!-- Are there 3 arguments?
                  -->{{#if: {{{2|}}}|<!-- Are there 2 or more unnamed arguments?
                    --><span style="white-space:nowrap;margin-left:0.3em;">{{su|<!-- Uncertainty = +X -Y (3 arguments)
                    -->{{#if: {{{3|}}}|<!-- Are there 3 unnamed arguments?
                      -->w=f|a=r|<!-- Fixed width, right aligned
                      --><span style="white-space:nowrap;margin-left:0.3em;">{{su|<!-- Uncertainty = +X -Y (3 arguments)
                      -->p=+{{val/delimitnum|{{{2}}}}}{{{+errend|}}}|<!-- Output +arg2, formatted.
                        -->w=f|a=r|<!-- Fixed width, right aligned
                      -->b={{val/delimitnum|{{{3}}}}}{{{-errend|}}}<!-- Output -arg3, formatted.
                        -->p=+{{val/delimitnum|{{{2}}}}}{{{+errend|}}}|<!-- Output +arg2, formatted.
                    -->}}</span><!--
                        -->b={{val/delimitnum|{{{3}}}}}{{{-errend|}}}<!-- Output -arg3, formatted.
                  -->|<!-- Are there 3 arguments? NO
                      -->}}</span><!--
                    -->{{#if:{{#ifexpr: 0{{{2}}}}}|<!-- Second argument is "(number)"?
                    -->|<!-- Are there 3 arguments? NO
                      -->{{{2}}}<!-- Significance = (X)
                      -->{{#if:{{#ifexpr: 0{{{2}}}}}|<!-- Second argument is "(number)"?
                    -->|<!-- Second argument is "(number)"? NO
                        -->{{{2}}}<!-- Significance = (X)
                      --><span style="white-space:nowrap;margin-left:0.3em;margin-right:0.15em">±</span>{{val/delimitnum|{{{2}}}}}{{{errend|}}}<!-- Uncertainty = ±X
                      -->|<!-- Second argument is "(number)"? NO
                    -->}}<!-- End second argument is "(number)"?
                        --><span style="white-space:nowrap;margin-left:0.3em;margin-right:0.15em">±</span>{{val/delimitnum|{{{2}}}}}{{{errend|}}}<!-- Uncertainty = ±X
                  -->}}<!-- End Are there 3 arguments?
                      -->}}<!-- End second argument is "(number)"?
                -->}}<!-- End Are there 2 arguments?
                    -->}}<!-- End Are there 3 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
                  -->}}<!-- End Are there 2 arguments?
                  -->{{#if:{{{e|}}}|<span style="white-space:nowrap;margin-left:0.25em;margin-right:0.15em">×</span>}}<!-- e=exponent, output "×"
                -->}}<!-- End is there at least one unnamed argument
                -->{{#if:{{{e|}}} |10{{su |p={{val/delimitnum|{{{e}}}}}}}}}<!-- e=exponent, output "10^e"
                 -->{{#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:05, 21 December 2009