మూస:Val: కూర్పుల మధ్య తేడాలు

Remove non-critical error checking to greatly reduce post-expansion include size
replace with copy of Template:Val/sandboxlua to implement Module:Val per discussions on talk
పంక్తి 1:
<includeonly>{{{{{♥|safesubst:}}}#invoke:val|main}}</includeonly><noinclude>
<includeonly><!--
--><span class="nowrap"><!--
START ERROR CHECKING:
-->{{#ifeq:{{{u}}}{{{ul}}}|{{{u|}}}{{{ul|}}}<!-- Is arg "u" and "ul" specified?
"u" & "ul" both specified -->|{{FormattingError|Error in {{tl|val}}: unit ('''u''') and units with link ('''ul''') are both specified, only one is allowed.|nocategory={{{nocategory|}}}}}<!--
"u" & "ul" not both specified
-->|{{#ifeq:{{{up}}}{{{upl}}}|{{{up|}}}{{{upl|}}}<!-- Is arg "up" and "upl" specified?
"up" & "ulp" both specified -->|{{FormattingError|Error in {{tl|val}}: unit per ('''up''') and units per with link ('''upl''') are both specified, only one is allowed.|nocategory={{{nocategory|}}}}}<!--
"up" & "ulp" not both specified
-->|<!--
END OPENING OF ERROR CHECKING, START OUTPUT
 
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
 
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|}}}|{{{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|}}}|{{{2}}}|nosign=on}}<!-- Output +arg2, formatted.
-->{{{+errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}<!-- Append something and/or add angle/percent symbol.
-->|{{val/delimitnum|fmt={{{fmt|}}}|{{{3}}}|nosign=on}}<!-- Output -arg3, formatted.
-->{{{-errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}<!-- Append something and/or add angle/percent symbol.
-->}}<!-- 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|}}}|{{{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|}}}|{{{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|}}}|{{{e}}}}}</sup><!-- × 10^e
-->}}<!-- End is there an exponent
Second argument is not "(number)".-->|{{#if:{{{e|}}}<!-- Is there an exponent?
There is an exponent. -->|({{val/delimitnum|fmt={{{fmt|}}}|{{{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|}}}|{{{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|}}}|{{{e}}}}}</sup><!-- × 10^e
There is no exponent. -->|{{val/delimitnum|fmt={{{fmt|}}}|{{{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|}}}|{{{2}}}}}<!-- Format number.
-->{{{errend|}}}{{val/angle|{{{u|{{{ul}}}}}}}}<!-- Append something and/or add angle/percent symbol.
-->}}<!-- End Uncertainty = ±X
-->}}<!-- End is there and exponent.
-->}}<!-- End second argument is "(number)"?
-->}}<!-- End Are there 3 arguments?
2 arguments? No -->|{{val/delimitnum|fmt={{{fmt|}}}|{{{1|}}}|u={{{u|{{{ul}}}}}}}}<!-- Output arg1, formatted.
-->{{{end|}}}{{val/angle|{{{u}}}|{{{ul}}}}}<!-- Append something and/or add angle/percent symbol.
-->{{#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|}}}|{{{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|}}}|{{{e|0}}}}}</sup><!-- Output 10^e only.
-->}}<!-- End Are there any arguments?
END NUMERICAL OUTPUT
 
START UNITS
-->{{#if:{{{up|}}}{{{upl|}}}
|
{{#if:{{{u|}}}
| <!-- if u= has any multiplier or divider symbols -->
&nbsp;{{#ifexpr:{{#invoke:String|find|source={{{u}}}|target=[./*]|plain=false}}
|
{{#invoke:String|replace
|source =
{{#invoke:String|replace
|source =
{{#invoke:String|match
|s = {{Val/units|{{{u}}}}}
<!-- from "what is not [ or |" up to: where next char is ] -->
|pattern = [^%[{{!}}]+%f[%]]
|ignore_errors = true
}}
|pattern = ^
|replace = (
|plain = false
}}
|pattern = $
|replace = )
|plain = false
}}
| <!-- Same thing, but without replace with parentheses -->
{{#invoke:String|match
|s = {{Val/units|{{{u}}}}}
|pattern = [^%[{{!}}]+%f[%]]
|ignore_errors = true
}}
}}
}}<!-- end up/upl AND u
-->{{#if:{{{ul|}}} <!-- With up/upl its possible to have neither u nor ul.-->
|
&nbsp;{{#ifexpr:{{#invoke:String|find|source={{{ul}}}|target=[./*]|plain=false}}
| <!-- Grouping parentheses -->
{{#invoke:String|replace
|source =
{{#invoke:String|replace
|source = {{Val/units|{{{ul}}}|ls={{{long scale}}}}}
|pattern = ^
|replace = (
|plain = false
|ignore_errors = true
}}
|pattern = $
|replace = )
|plain = false
}}
| <!-- normal call -->
{{val/units|{{{ul}}}|ls = {{{long scale}}}}}
}}
}}<!-- End up/upl AND ul
-->{{#if:{{{up|}}}
|
{{#ifexpr:{{#invoke:String|find|source={{{up}}}|target=[./*]|plain=false}}
|
{{#invoke:String|replace
|source =
{{#invoke:String|replace
|source =
{{#invoke:String|match
|s = {{Val/units|{{{up}}}}}
|pattern = [^%[{{!}}]+%f[%]]
|ignore_errors = true
}}
|pattern = ^
|replace = /(
|plain = false
}}
|pattern = $
|replace = )
|plain = false
}}
| <!-- Same thing, but without replace with parentheses -->
{{#invoke:String|replace
|source =
{{#invoke:String|match
|s = {{Val/units|{{{up}}}}}
|pattern = [^%[{{!}}]+%f[%]]
|ignore_errors = true
}}
|pattern = ^
|replace = /
|plain = false
}}
}}
| <!-- upl -->
{{#ifexpr:{{#invoke:String|find|source={{{upl}}}|target=[./*]|plain=false}}
|
{{#invoke:String|replace
|source =
{{#invoke:String|replace
|source = {{Val/units|{{{upl}}}}}
|pattern = ^
|replace = /(
|plain = false
|ignore_errors = true
}}
|pattern = $
|replace = )
|plain = false
}}
| <!-- Same thing, but without replace with parentheses -->
{{#invoke:String|replace
|source = {{val/units|{{{upl}}}}}
|pattern = ^
|replace = /
|plain = false
|ignore_errors = true
}}
}}
}}
| <!-- No up/upl -->
{{#if:{{{u|}}}
|
{{#ifexpr:{{#invoke:String|find|source={{{u}}}|target=[%[<]|plain=false}}
|&nbsp;{{{u}}}<!--sole u has [[mark<up>]] chars [ or <, just return it.
-->|&nbsp;{{#invoke:String|match
|s = [{{val/units|{{{u}}}|lk=off}}] <!-- fake links added -->
<!-- lk=off is just in case we default to Convert, for some cases
because the pattern on the next line only ever handles one link
per compound unit -->
|pattern = [^%[{{!}}]+%f[%]]
<!-- that pattern extracts link displays like this: [this] [or|this]
convert can send [this]/[that], but we can't do that. So above I had to
add fake links s = [added]. -->
|ignore_errors = true
}}
}}
}}<!--
-->{{#if:{{{ul|}}}
|&nbsp;{{val/units|{{{ul}}}|ls = {{{long scale}}}}}
}}
}}<!-- end up/upl
END UNITS
 
START SUFFIX
-->{{{s|}}}<!-- If s (suffix) is defined, display it.
END PREFIX
 
START CLOSING OF ERROR CHECKING
-->}}<!-- End Is arg "up" and "upl" specified?
-->}}<!-- End Is arg "u" and "ul" specified?
END ERROR CHECKING
--></span></includeonly><noinclude>
{{documentation}}
</noinclude>
"https://te.wikipedia.org/wiki/మూస:Val" నుండి వెలికితీశారు