Template:Val: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>Jimp simpler way to throw out the sign |
meta>Jimp add exponents for errors, move prefix outside brackets, merge exponent part with main part to a numerical part and move errors off to subtemplates. See Template talk:Val#13 May 2015 restructure. |
||
| Line 19: | Line 19: | ||
END OPENING OF ERROR CHECKING, START OUTPUT | END OPENING OF ERROR CHECKING, START OUTPUT | ||
START | START HIDDEN SORT KEY | ||
-->{{# | -->{{#ifeq:{{{sortable}}}|off||{{val/sortkey|{{{sortval|{{{1|1}}}}}}|e={{{e|0}}}|u={{{us|{{{u|{{{ul|}}}}}}}}}|up={{{ups|{{{up|{{{upl|}}}}}}}}}|ls={{{long scale}}}}}}}<!-- hidden sort key based on the SI base unit(s) | ||
END HIDDEN SORT KEY | |||
END | |||
START | START PREFIX | ||
-->{{{p|}}}<!-- If p (prefix) is defined, display it. | |||
END PREFIX | |||
START NUMERICAL OUTPUT | |||
<!-- numerical output -->{{#if:{{{1|}}}<!-- Are there any arguments? | |||
There are arguments. -->|{{#if:{{{2|}}}<!-- Are there 2 or more arguments? | |||
There are 2 or more arguments. -->|{{#if:{{{3|}}}<!-- Are there 3 arguments? | |||
There are 3 arguments. -->|{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{1|}}}|u={{{u|{{{ul}}}}}}}}<!-- Output arg1, formatted. | |||
-->{{{end|}}}{{val/angle|{{{u}}}|{{{ul}}}}}<!-- Append something and/or add angle/percent symbol. | |||
Uncertainty = +X/-Y -->{{val/+-<!-- Add + & - errors. | |||
-->|w={{{w|}}}|a={{{a|r}}}<!-- Option fixed width, default right aligned | |||
-->|{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{2}}}|nosign=on}}<!-- Output +arg2, formatted. | |||
-->{{{+errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}<!-- Append something and/or add angle/percent symbol. | |||
-->{{#if:{{{erre|{{{+erre|}}}}}}<!-- Is there a +error exponent? | |||
There is a +error exponent. -->|<span style="margin-left:0.25em;margin-right:0.15em">×</span>10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{erre|{{{+erre}}}}}}}}</sup><!-- × 10^+erre | |||
-->}}<!-- End is there a +error exponent | |||
-->|{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{3}}}|nosign=on}}<!-- Output -arg3, formatted. | |||
-->{{{-errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}<!-- Append something and/or add angle/percent symbol. | |||
-->{{#if:{{{erre|{{{-erre|}}}}}}<!-- Is there a -error exponent? | |||
There is a -error exponent. -->|<span style="margin-left:0.25em;margin-right:0.15em">×</span>10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{erre|{{{-erre}}}}}}}}</sup><!-- × 10^-erre | |||
-->}}<!-- End is there a +error exponent | |||
-->}}<!-- End are there 3 arguments (Uncertainty = +X/-Y) | |||
-->{{#if:{{{e|}}}<!-- Is there an exponent? | |||
There is an exponent. -->|<span style="margin-left:0.25em;margin-right:0.15em">×</span>10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{e}}}}}</sup><!-- × 10^e | |||
-->}}<!-- End is there an exponent | |||
There are there not three arguments. -->|{{#iferror:{{#expr:0{{{2}}}}}<!-- Is second argument "(number)"? | |||
Second argument is "(number)". -->|{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{1|}}}|u={{{u|{{{ul}}}}}}}}<!-- Output arg1, formatted. | |||
-->{{{end|}}}{{{2}}}<!-- Uncertainty (X) | |||
-->{{val/angle|{{{u}}}|{{{ul}}}}}<!-- Add angle/percent symbol. | |||
-->{{#if:{{{e|}}}<!-- Is there an exponent? | |||
-->|<span style="margin-left:0.25em;margin-right:0.15em">×</span>10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{e}}}}}</sup><!-- × 10^e | |||
-->}}<!-- End is there an exponent | |||
Second argument is not "(number)".-->|{{#if:{{{e|}}}<!-- Is there an exponent? | |||
There is an exponent. -->|{{#if:{{{erre|}}}<!-- Is there an error exponent? | |||
There is an error exponent. -->|{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{1|}}}|u={{{u|{{{ul}}}}}}}}<!-- Output arg1, formatted. | |||
-->{{{end|}}}{{val/angle|{{{u}}}|{{{ul}}}}}<!-- Append something and/or add angle/percent symbol. | |||
--><span style="margin-left:0.25em;margin-right:0.15em">×</span>10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{e}}}}}</sup><!-- × 10^e | |||
Uncertainty = ±X -->{{val/±<!-- Add ± symbol. | |||
-->|{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{2}}}}}<!-- Format number. | |||
-->{{{errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}<!-- Append something and/or add angle/percent symbol. | |||
-->}}<!-- End Uncertainty = ±X | |||
--><span style="margin-left:0.25em;margin-right:0.15em">×</span>10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{erre}}}}}</sup><!-- × 10^erre | |||
There is no error exponent. -->|({{val/delimitnum|fmt={{{fmt|gaps}}}|{{{1|}}}|u={{{u|{{{ul}}}}}}}}<!-- Output arg1, formatted. | |||
-->{{#if:{{{ | -->{{{end|}}}{{val/angle|{{{u}}}|{{{ul}}}}}<!-- Append something and/or add angle/percent symbol. | ||
Uncertainty = ±X -->{{val/±<!-- Add ± symbol. | |||
-->|{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{2}}}}}<!-- Format number. | |||
-->{{{errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}<!-- Append something and/or add angle/percent symbol. | |||
-->}})<!-- End Uncertainty = ±X | |||
--><span style="margin-left:0.25em;margin-right:0.15em">×</span>10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{e}}}}}</sup><!-- × 10^e | |||
-->}}<!-- End is there an error exponent | |||
There is no exponent. -->|{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{1|}}}|u={{{u|{{{ul}}}}}}}}<!-- Output arg1, formatted. | |||
-->{{{end|}}}{{val/angle|{{{u}}}|{{{ul}}}}}<!-- Append something and/or add angle/percent symbol. | |||
Uncertainty = ±X -->{{val/±<!-- Add ± symbol. | |||
-->|{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{2}}}}}<!-- Format number. | |||
-->{{{errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}<!-- Append something and/or add angle/percent symbol. | |||
-->}}<!-- End Uncertainty = ±X | |||
-->{{#if:{{{erre|}}}<!-- Is there an error exponent? | |||
There is an error exponent. -->|<span style="margin-left:0.25em;margin-right:0.15em">×</span>10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{erre}}}}}</sup><!-- × 10^erre | |||
-->}}<!-- End is there an error exponent | |||
-->}}<!-- End is there and exponent. | |||
-->}}<!-- End second argument is "(number)"? | |||
-->}}<!-- End Are there 3 arguments? | |||
2 arguments? No -->|{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{1|}}}|u={{{u|{{{ul}}}}}}}}<!-- Output arg1, formatted. | |||
-->{{{end|}}}{{val/angle|{{{u}}}|{{{ul}}}}}<!-- Append something and/or add angle/percent symbol. | |||
END | -->{{#if:{{{e|}}}<!-- Is there an exponent? | ||
There is an exponent. -->|<span style="margin-left:0.25em;margin-right:0.15em">×</span>10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{e}}}}}</sup><!-- × 10^e | |||
-->}}<!-- End is there an exponent | |||
-->}}<!-- End Are there 2 or more arguments? | |||
There are no arguments. -->|10<sup>{{val/delimitnum|fmt={{{fmt|gaps}}}|{{{e|0}}}}}</sup><!-- Output 10^e only. | |||
-->}}<!-- End Are there any arguments? | |||
END NUMERICAL OUTPUT | |||
START UNITS | START UNITS | ||
| Line 133: | Line 117: | ||
-->{{#if:{{{ul|}}}|{{val/unitswithlink|{{{ul}}}|nbsp|ls={{{long scale}}}}}}}<!-- | -->{{#if:{{{ul|}}}|{{val/unitswithlink|{{{ul}}}|nbsp|ls={{{long scale}}}}}}}<!-- | ||
-->}}<!-- | -->}}<!-- | ||
END UNITS | |||
START SUFFIX | |||
-->{{{s|}}}<!-- If s (suffix) is defined, display it. | -->{{{s|}}}<!-- If s (suffix) is defined, display it. | ||
END PREFIX | |||
END | |||
START CLOSING OF ERROR CHECKING | START CLOSING OF ERROR CHECKING | ||
-->}}<!-- End Is arg "up" and "upl" specified? | -->}}<!-- End Is arg "up" and "upl" specified? | ||
-->}}<!-- End Is arg "u" and "ul" specified? | -->}}<!-- End Is arg "u" and "ul" specified? | ||
-->}}<!-- End Is arg "e" not a valid number? | -->}}<!-- End Is arg "e" not a valid number? | ||
-->}}<!-- End Is arg2 negative? | -->}}<!-- End Is arg2 negative? | ||
-->}}<!-- End Is arg3 not a valid number? | -->}}<!-- End Is arg3 not a valid number? | ||
-->}}<!-- End Is arg2 not a valid number? | -->}}<!-- End Is arg2 not a valid number? | ||
-->}}<!-- End Is arg1 not a valid number? | -->}}<!-- End Is arg1 not a valid number? | ||
END ERROR CHECKING | END ERROR CHECKING | ||
Revision as of 21:58, 12 May 2015
Lua error in Module:Documentation at line 7: Module:Documentation/config returned boolean, table expected.