Template:Isotopes/main/format-percent: Difference between revisions
Appearance
Content deleted Content added
m DePiep moved page Template:Infobox element isotopes/isotope/val-format1 to Template:Decay modes/dm-property/format-percent: from sandbox to functional name |
MusikBot II (talk | contribs) m Protected "Template:Isotopes/main/format-percent": High-risk template or module: 557 transclusions (more info) ([Edit=Require autoconfirmed or confirmed access] (indefinite)) |
||
(28 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{#if:{{{raw-perc|}}}|{{Isotopes/main/format-percent/format-number |
|||
<noinclude>* <big><big>../isotope/percent-format</big></big> |
|||
:{{para|type, raw-perc, }} |
|||
:{{tl|Infobox element isotopes/isotope/val-format1}} |
|||
:{{tl|Infobox element isotopes/isotope/val-format3}} |
|||
:{{tl|::{{tl|decay modes/dm-clean-code}} ({{edit|Template:decay modes/dm-clean-code}}) }} - base-patterns (used) |
|||
:U+226A ≪ |
|||
</noinclude>{{#if:{{{raw-perc|}}}|{{Infobox element isotopes/isotope/val-format3 |
|||
|raw-perc ={{{raw-perc|}}}<!-- used? --> |
|raw-perc ={{{raw-perc|}}}<!-- used? --> |
||
|type ={{{type|}}}<!-- |
|type ={{{type|}}}<!-- na, dm --> |
||
|prefix ={{#invoke:String|match|s={{{raw-perc|}}}<!-- |
|prefix ={{#invoke:String|match|s={{{raw-perc|}}}<!-- |
||
-->|pattern=[<≪]*|nomatch=|ignore_errors=true|plain=false}} |
-->|pattern=[<≪]*|nomatch=|ignore_errors=true|plain=false}} |
||
Line 17: | Line 11: | ||
-->|pattern=%%$|replace=|ignore_errors=true|plain=false}}<!-- |
-->|pattern=%%$|replace=|ignore_errors=true|plain=false}}<!-- |
||
-->|default=}} |
-->|default=}} |
||
}}|<!-- raw=blank -->}} |
}}|<!-- raw=blank -->}}<!-- |
||
--><noinclude>{{documentation|1=Template:Isotopes/main/format-percent/doc}}</noinclude> |
Latest revision as of 18:00, 18 March 2023
Usage
- calls: {{Isotopes/main/format-percent/format-number}}
- The template returns a <blank> when the expected pattern is not found
- 1. remove prefix-[<≪]*
- 2. remove any suffix-% (NB suffix "%" is not required; % assumed anyway
- 3. check remaining value as number (bounce
{{BaseConvert{{!}}10to10{{!}}number}})
- 4. WHEN not a number: return BLANK
- 5. rounds the number to 3 sigfig
- 6. dm: when n<0.01%, add prefix "<", when <0.001 add prefix "≪"
- 7. add suffix "%"
- 8. return
- pattern: (<<≪)123.456( %) or (<≪)10e+6(%)
- Other prefixes are not recognied (not "~", "ca.", ..); will return blank
- FOR blank return, consider showing raw input:
{{if empty |1={{Isotopes/main/format-percent|raw-perc={{{raw-input|}}} }} |2={{{raw-input|}}} }}
{{Isotopes/main/format-percent
|raw-perc =
|type =na, dm
}}