Category:Pages with non-numeric formatnum arguments: Difference between revisions
From WikiMD's Wellness Encyclopedia
Created automatically by the AutoCreateCategoryPages extension. |
en>Materialscientist m Reverted edits by 102.90.48.226 (talk) (HG) (3.4.12) |
||
| Line 1: | Line 1: | ||
This is a | {{Wikipedia category | ||
|hidden=yes | |||
|empty=yes | |||
|polluted=yes | |||
|tracking=yes | |||
|purpose= | |||
}} | |||
{{CatAutoTOC}} | |||
This category collects pages that use the <code>formatnum</code> [[mw:Help:Magic_words#Formatting|parser function]] with a non-numeric or incorrectly formatted value, e.g. <code><nowiki>{{formatnum:foo}}</nowiki></code> or <code><nowiki>{{formatnum:12,345}}</nowiki></code>. | |||
Ways to fix or work around this error inside template code: | |||
*If <code>formatnum</code> is being applied to a string that includes both a number and words, change it to wrap just the number. Example: <code><nowiki>{{formatnum:{{{var}}} dollars}}</nowiki></code> → <code><nowiki>{{formatnum:{{{var}}}}} dollars</nowiki></code> | |||
*Another way to work around invalid input is to remove commas from the input like this: <code><nowiki>{{formatnum:{{replace|{{{var}}}|,|}}}}</nowiki></code>. Note that input using commas as decimal separators, in contravention of [[MOS:DECIMAL]], will cause formatnum to produce invalid values. To fix the problem, use a full stop (period) as a decimal separator. | |||
*A limited way to work around invalid input in templates is to use {{tl|digits}}, e.g. <code><nowiki>{{formatnum:{{digits|{{{votes}}}}}}}</nowiki></code>. This works only for whole numbers and will produce incorrect results for input containing decimal points or other non-numeric characters. | |||
Ways to fix this error in articles: | |||
*When additional text or references exist in a template parameter that expects only numbers, find a way to move the additional text outside the template or into a different parameter. For example: | |||
**Currency templates like {{tl|CAD}} or {{tl|US$}} take only numeric input. Use <code><nowiki>{{US$|123}}{{nbsp}}million</nowiki></code> instead of <code><nowiki>{{US$|123 million}}</nowiki></code> | |||
**The {{para|population_total}} parameter in {{tl|Infobox settlement}} should have only a number in it. Move any references to {{para|population_footnotes}}, as in [https://en.wikipedia.org/w/index.php?title=%27Ajjur&type=revision&diff=980849486&oldid=980504731 this edit]. | |||
Other: | |||
*When <code>formatnum</code> is given a negative number written with the proper U+2212 "minus sign" (instead of the commonly used [[hyphen-minus]] key that appears on most keyboards), e.g. <code><nowiki>{{formatnum:−9000000}}</nowiki></code>, it assigns this error category; see {{phab|T237467}}. A workaround for this incorrect usage was applied to {{tl|US Census population}}, which shows population declines as negative numbers. You should use [[hyphen-minus]] within <code>formatnum</code> to avoid this error category and it will output the proper minus sign (see {{phab|T10327}}). | |||
[[Category:Tracking categories automatically populated by MediaWiki]] | |||
Revision as of 05:30, 18 February 2024
This category collects pages that use the formatnum parser function with a non-numeric or incorrectly formatted value, e.g. {{formatnum:foo}} or {{formatnum:12,345}}.
Ways to fix or work around this error inside template code:
- If
formatnumis being applied to a string that includes both a number and words, change it to wrap just the number. Example:{{formatnum:{{{var}}} dollars}}→{{formatnum:{{{var}}}}} dollars - Another way to work around invalid input is to remove commas from the input like this:
{{formatnum:{{replace|{{{var}}}|,|}}}}. Note that input using commas as decimal separators, in contravention of MOS:DECIMAL, will cause formatnum to produce invalid values. To fix the problem, use a full stop (period) as a decimal separator. - A limited way to work around invalid input in templates is to use {{digits}}, e.g.
{{formatnum:{{digits|{{{votes}}}}}}}. This works only for whole numbers and will produce incorrect results for input containing decimal points or other non-numeric characters.
Ways to fix this error in articles:
- When additional text or references exist in a template parameter that expects only numbers, find a way to move the additional text outside the template or into a different parameter. For example:
- Currency templates like {{CAD}} or {{US$}} take only numeric input. Use
{{US$|123}}{{nbsp}}millioninstead of{{US$|123 million}} - The
|population_total=parameter in {{Infobox settlement}} should have only a number in it. Move any references to|population_footnotes=, as in this edit.
- Currency templates like {{CAD}} or {{US$}} take only numeric input. Use
Other:
- When
formatnumis given a negative number written with the proper U+2212 "minus sign" (instead of the commonly used hyphen-minus key that appears on most keyboards), e.g.{{formatnum:−9000000}}, it assigns this error category; see T237467. A workaround for this incorrect usage was applied to {{US Census population}}, which shows population declines as negative numbers. You should use hyphen-minus withinformatnumto avoid this error category and it will output the proper minus sign (see T10327).
Pages in category "Pages with non-numeric formatnum arguments"
The following 9 pages are in this category, out of 9 total.