Module:Roman/doc: Difference between revisions
More actions
Further expand docs |
Remove Year / _Year |
||
| Line 2: | Line 2: | ||
This module contains functions for working with Roman numerals. Currently used by: | This module contains functions for working with Roman numerals. Currently used by: | ||
*{{tl|Roman}} | *{{tl|Roman}} | ||
== Using this module from templates == | == Using this module from templates == | ||
=== Numeral === | === Numeral === | ||
| Line 32: | Line 21: | ||
Example: | Example: | ||
: <code>local roman = require('Module:Roman')</code> | : <code>local roman = require('Module:Roman')</code> | ||
=== _Numeral === | === _Numeral === | ||
Revision as of 00:52, 30 December 2014
Summary
This module contains functions for working with Roman numerals. Currently used by:
Using this module from templates
Numeral
This function converts an Arabic numeral into a Roman numeral. It works for values between 0 and 4999999. The output string may contain HTML tags. Arabic numeral zero is output as an empty string. If the input does not look like it contains a number or the number is outside of the supported range an error message is returned. If an error message is returned, the error message will contain code to categorize pages into Category:Errors reported by Module Roman.
Usage:
{{#invoke:Roman|Numeral|value}}
Example:
{{#invoke:Roman|Numeral|8}}produces VIII
Using this module from Lua code
In order to use the functions in this module from another Lua module you first have to import this module.
Example:
local roman = require('Module:Roman')
_Numeral
This function converts an Arabic numeral into a Roman numeral. It works for values between 0 and 4999999. The output string may contain HTML tags. Arabic numeral zero is output as an empty string. If the input does not look like it contains a number or the number is outside of the supported range an error message is returned. If an error message is returned, the error message will contain code to categorize pages into Category:Errors reported by Module Roman.
Usage:
roman_year = roman._Numeral(value)