Template:Spellnum per MOS/doc

From Fanverse
Revision as of 04:25, 7 January 2024 by Mob (talk | contribs) (Created page with "{{Documentation subpage}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see Wikipedia:Wikidata) --> {{Lua|Module:Spellnum per MOS}} {{substitution| |unless the argument is dynamic (i.e., generated by another template or module that cannot be substituted)}} Converts numerals to words if appropriate per the style guide '''MOS:NUMERAL'''. The first unnamed parameter is the numeral to be evaluated. All optional p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Substitution

Converts numerals to words if appropriate per the style guide MOS:NUMERAL. The first unnamed parameter is the numeral to be evaluated. All optional parameters of {{number to word}} are accepted by this template.

Editors using this template are responsible for checking its output against the detailed guidance of MOS:NUMERAL.

Behavior[edit source]

  • Non-integers and values less than zero are given in numerals (e.g. 0.5, -3).
  • Integers from zero to nine are spelled out in words (e.g. five).
  • For integers greater than or equal to ten:
    • By default, numbers expressible in one or two words are spelled out (e.g. fifty-six), and numbers requiring three or more words are given as numerals (e.g. 310).
    • If the argument "forcenum" is given with a value of "true" (or equivalent per Template:Yesno), integers greater than or equal to ten are always expressed as a numeral.
  • Numbers greater than one million are rounded to at most two significant figures when expressed with words.

Examples[edit source]

Case Input Output
Default forcenum =
"true" or equivalent
negative or non-integer -3 −3 −3
1.5 1.5 1.5
integer less than 10 9 Lua error: expandTemplate: template "spellnum" does not exist. Lua error: expandTemplate: template "spellnum" does not exist.
integer requiring two or fewer words 54 Lua error: expandTemplate: template "yesno" does not exist. Lua error: expandTemplate: template "yesno" does not exist.
8000 Lua error: expandTemplate: template "yesno" does not exist. Lua error: expandTemplate: template "yesno" does not exist.
integer requiring more than two words 320 Lua error: expandTemplate: template "yesno" does not exist. Lua error: expandTemplate: template "yesno" does not exist.
integer greater than one million 12000000 Lua error: expandTemplate: template "yesno" does not exist. Lua error: expandTemplate: template "yesno" does not exist.
12060000 Lua error: expandTemplate: template "yesno" does not exist. Lua error: expandTemplate: template "yesno" does not exist.
35000000 Lua error: expandTemplate: template "yesno" does not exist. Lua error: expandTemplate: template "yesno" does not exist.

See also[edit source]