Template:Val: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Jimp
No edit summary
m (233 revisions imported)
 
(69 intermediate revisions by 14 users not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly>{{{{{|safesubst:}}}#invoke:val|main}}</includeonly><noinclude>
--><span style="white-space:nowrap"><!--
START ERROR CHECKING:
-->{{#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|}}}}}<!--
-->|<!-- Is arg1 not a valid number? NO
  -->{{#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|}}}}}<!--
  -->|<!-- Is arg2 not a valid number? NO
    -->{{#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|}}}}}<!--
    -->|<!-- Is arg3 not a valid number? NO
      -->{{#ifexpr: {{{3|-1}}} >= 0|<!-- Is arg3 positive?
        -->{{FormattingError|Error in {{tl|val}}: third argument is not negative.|nocategory={{{nocategory|}}}}}<!--
      -->|<!-- Is arg3 positive? NO
        -->{{#ifeq:{{valid|number={{{e|0}}}}}|false|<!-- Is arg "e" not a valid number?
          -->{{FormattingError|Error in {{tl|val}}: exponent ('''e''') is not a valid number or requires too much precision to display.|nocategory={{{nocategory|}}}}}<!--
        -->|<!-- Is arg "e" not a valid number? NO
          -->{{#ifeq:{{{u|{{{ul|{{{up|{{{upl|}}}}}}}}}}}}|{{{up|{{{upl}}}}}}|<!-- Is arg "up" or "upl" specified but not arg "u" or "ul"?
            -->{{FormattingError|Error in {{tl|val}}: unit ('''u''' or '''ul''') is not specified but units per ('''up''' or '''upl''') is.|nocategory={{{nocategory|}}}}}<!--
          -->|<!-- Is arg "up" specified but not arg "u"? NO
            -->{{#ifeq:{{{u}}}{{{ul}}}|{{{u|}}}{{{ul|}}}|<!-- Is arg "u" and "ul" specified?
              -->{{FormattingError|Error in {{tl|val}}: unit ('''u''') and units with link ('''ul''') are both specified, only one is allowed.|nocategory={{{nocategory|}}}}}<!--
            -->|<!-- Is arg "u" and "ul" specified? NO
              -->{{#ifeq:{{{up}}}{{{upl}}}|{{{up|}}}{{{upl|}}}|<!-- Is arg "up" and "upl" specified?
                -->{{FormattingError|Error in {{tl|val}}: unit per ('''up''') and units per with link ('''upl''') are both specified, only one is allowed.|nocategory={{{nocategory|}}}}}<!--
              -->|<!-- Is arg "up" and "upl" specified? NO
END OPENING OF ERROR CHECKING, START OUTPUT
 
START OPENING BRACKET
-->{{#if:{{{1|}}}|<!-- Are there any argument?
-->{{#if:{{{2|}}}|<!-- Are there 2 arguments?
  -->{{#if:{{{3|}}}|<!-- Are there 3 arguments?
  -->|<!-- There are 2, but not 3 arguments
    -->{{#if:{{#ifexpr:0{{{2}}}}}|<!-- Second argument is "(number)"? YES, do not check for bracket
                              -->|<!-- Second argument is "(number)"? NO, check for bracket
                              -->{{#if:{{{e|}}}|(<!-- Is there an exponent? YES, open bracket
                              -->}}<!-- End is there an exponent?
    -->}}<!-- End is second argument "(number)"?
  -->}}<!-- end Are there 3 arguments?
-->}}<!-- end Are there 2 arguments?
-->}}<!-- end Are there any arguments?
END OPENING BRACKET
 
START MAIN OUTPUT
                -->{{{p|}}}<!-- If p (prefix) is defined, display it.
                -->{{#if: {{{1|}}}|<!-- Are there any arguments?
                  -->{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{1|}}}}}{{{end|}}}<!-- Output arg1, formatted.
                  -->{{#if: {{{2|}}}|<!-- Are there 2 or more arguments?
                    -->{{#if: {{{3|}}}|<!-- Are there 3 arguments?
                      -->{{val/angle|{{{u}}}|{{{ul}}}}}<span style="white-space:nowrap;margin-left:0.3em;">{{su|<!-- Uncertainty = +X -Y (3 arguments)
                        -->w=f|a=r|<!-- Fixed width, right aligned
                        -->p=+{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{2}}}}}{{{+errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}|<!-- Output +arg2, formatted.
                        -->b={{val/delimitnum|fmt={{{fmt|gaps}}}|{{{3}}}}}{{{-errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}<!-- Output -arg3, formatted.
                      -->}}</span><!--
                    -->|<!-- Are there 3 arguments? NO
                      -->{{#if:{{#ifexpr: 0{{{2}}}}}|<!-- Second argument is "(number)"?
                        -->{{{2}}}{{val/angle|{{{u}}}|{{{ul}}}}}<!-- Significance = (X)
                      -->|<!-- Second argument is "(number)"? NO
                        -->{{val/angle|{{{u}}}|{{{ul}}}}}<span style="white-space:nowrap;margin-left:0.3em;margin-right:0.15em">±</span>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{2}}}}}{{{errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}<!-- Uncertainty = ±X
                      -->}}<!-- End second argument is "(number)"?
                    -->}}<!-- End Are there 3 arguments?
                  -->}}<!-- End Are there 2 arguments?
                -->}}<!-- End Are there any arguments?
END MAIN OUTPUT
 
START CLOSING BRACKET
-->{{#if:{{{1|}}}|<!-- Are there any argument?
-->{{#if:{{{2|}}}|<!-- Are there 2 arguments?
  -->{{#if:{{{3|}}}|<!-- Are there 3 arguments?
  -->|<!-- There are 2, but not 3 arguments
    -->{{#if:{{#ifexpr:0{{{2}}}}}|<!-- Second argument is "(number)"? YES, do not check for bracket
                              -->|<!-- Second argument is "(number)"? NO, check for bracket
                              -->{{#if:{{{e|}}}|)<!-- Is there an exponent? YES, close bracket
                              -->}}<!-- End is there an exponent?
    -->}}<!-- End is second argument "(number)"?
  -->}}<!-- end Are there 3 arguments?
-->}}<!-- end Are there 2 arguments?
-->}}<!-- end Are there any arguments?
END OPENING BRACKET
 
START EXPONENT
-->{{#if:{{{e|}}}<!-- Is there an exponent?
          YES -->|{{#if:{{{1|}}}<!-- Are there any argument?
                        YES -->|<span style="white-space:nowrap;margin-left:0.25em;margin-right:0.15em">×</span>10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{e}}}}}</sup><!--
                        NO  -->|10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{e}}}}}</sup><!--
              -->}}<!-- End are there any argument?<!--
-->}}<!-- End is there an exponent?
END EXPONENT
 
START UNITS
-->{{#if:{{{u|}}}|{{val/units|{{{u}}}|nbsp=1}}}}<!-- u=units
-->{{#if:{{{ul|}}}|{{val/unitswithlink|{{{ul}}}|nbsp=1}}}}<!-- u=units with link
  -->{{#if:{{{up|}}}|/{{val/units|{{{up}}}}}}}<!-- up=per units
  -->{{#if:{{{upl|}}}|/{{val/unitswithlink|{{{upl}}}}}}}<!-- up=per units with link
    -->{{{s|}}}<!-- If s (suffix) is defined, display it.
  -->}}<!-- End Is arg "up" and "upl" specified?
  -->}}<!-- End Is arg "u" and "ul" specified?
-->}}<!-- End Is arg "up" specified but not arg "u"?
-->}}<!-- End Is arg "e" not a valid number?
 
END UNITS
 
START CLOSING OF ERROR CHECKING
-->}}<!-- End Is arg3 positive?
-->}}<!-- End Is arg3 not a valid number?
-->}}<!-- End Is arg2 not a valid number?
-->}}<!-- End Is arg1 not a valid number?
END ERROR CHECKING
--></span></includeonly><noinclude>
{{documentation}}
{{documentation}}
<!--PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS-->
</noinclude>
</noinclude>

Latest revision as of 14:07, 3 September 2020