Module:number list: Difference between revisions

no edit summary
(Undo revision 313962 by Sware (talk))
No edit summary
Line 21: Line 21:


local form_types = {
local form_types = {
{key = "cardinal", display = "[[cardinal number|Cardinal]]"},
{key = "cardinal", display = "[[wikt:cardinal number|Cardinal]]"},
{key = "ordinal", display = "[[ordinal number|Ordinal]]"},
{key = "ordinal", display = "[[wikt:ordinal number|Ordinal]]"},
{key = "ordinal_abbr", display = "[[ordinal number|Ordinal]] [[abbreviation]]"},
{key = "ordinal_abbr", display = "[[wikt:ordinal number|Ordinal]] [[wikt:abbreviation]]"},
{key = "adverbial", display = "[[adverbial number|Adverbial]]"},
{key = "adverbial", display = "[[wikt:adverbial number|Adverbial]]"},
{key = "multiplier", display = "[[multiplier|Multiplier]]"},
{key = "multiplier", display = "[[wikt:multiplier|Multiplier]]"},
{key = "distributive", display = "[[distributive number|Distributive]]"},
{key = "distributive", display = "[[wikt:distributive number|Distributive]]"},
{key = "collective", display = "[[collective number|Collective]]"},
{key = "collective", display = "[[wikt:collective number|Collective]]"},
{key = "fractional", display = "[[fractional|Fractional]]"},
{key = "fractional", display = "[[wikt:fractional|Fractional]]"},
}
}


Line 177: Line 177:
-- Given a number form, convert it to its independent (un-affixed) form. This only makes sense for certain languages
-- Given a number form, convert it to its independent (un-affixed) form. This only makes sense for certain languages
-- where there is a difference between independent and affixed forms of numerals. Currently the only such language
-- where there is a difference between independent and affixed forms of numerals. Currently the only such language
-- is Swahili, where e.g. the cardinal number form for 3 is affixed [[-tatu]], independent [[tatu]], and the ordinal
-- is Swahili, where e.g. the cardinal number form for 3 is affixed [[wikt:-tatu]], independent [[wikt:tatu]], and the ordinal
-- number form is [[-a tatu]], independent [[tatu]]. We rely on a set of Lua pattern substitutions to convert from
-- number form is [[wikt:-a tatu]], independent [[wikt:tatu]]. We rely on a set of Lua pattern substitutions to convert from
-- affixed to independent form.
-- affixed to independent form.
--
--
Line 498: Line 498:
local lang = require("Module:languages").getByCode(langcode, "1")
local lang = require("Module:languages").getByCode(langcode, "1")


-- Get the data from the data module. Some modules (e.g. currently [[Module:number list/data/ka]]) have to be
-- Get the data from the data module. Some modules (e.g. currently [[wikt:Module:number list/data/ka]]) have to be
-- loaded with require() because the exported numbers table has a metatable.
-- loaded with require() because the exported numbers table has a metatable.
local module_name = export.get_data_module_name(langcode, "must exist")
local module_name = export.get_data_module_name(langcode, "must exist")
Line 509: Line 509:


-- We represent all numbers as strings in this function to deal with the limited precision inherent in Lua numbers.
-- We represent all numbers as strings in this function to deal with the limited precision inherent in Lua numbers.
-- These large numbers do occur, such as 100 trillion ([[རབ་བཀྲམ་ཆེན་པོ]]), 1 sextillion, etc. Lua represents all
-- These large numbers do occur, such as 100 trillion ([[wikt:རབ་བཀྲམ་ཆེན་པོ]]), 1 sextillion, etc. Lua represents all
-- numbers as 64-bit floats, meaning that some numbers above 2^53 cannot be represented exactly. The first power of
-- numbers as 64-bit floats, meaning that some numbers above 2^53 cannot be represented exactly. The first power of
-- 10 that cannot be represented exactly is 10^22 (ten sextillion in short scale, ten thousand trillion in long
-- 10 that cannot be represented exactly is 10^22 (ten sextillion in short scale, ten thousand trillion in long
Line 1,152: Line 1,152:


if cardinal_term then
if cardinal_term then
table.insert(forms, "     ''[[cardinal number|Cardinal]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = cardinal_term, alt = cardinal_alt, tr = cardinal_tr}))
table.insert(forms, "     ''[[wikt:cardinal number|Cardinal]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = cardinal_term, alt = cardinal_alt, tr = cardinal_tr}))
end
end


if ordinal_term then
if ordinal_term then
table.insert(forms, "     ''[[ordinal number|Ordinal]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = ordinal_term, alt = ordinal_alt, tr = ordinal_tr}))
table.insert(forms, "     ''[[wikt:ordinal number|Ordinal]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = ordinal_term, alt = ordinal_alt, tr = ordinal_tr}))
end
end


if adverbial_term then
if adverbial_term then
table.insert(forms, "     ''[[adverbial number|Adverbial]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = adverbial_term, alt = adverbial_alt, tr = adverbial_tr}))
table.insert(forms, "     ''[[wikt:adverbial number|Adverbial]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = adverbial_term, alt = adverbial_alt, tr = adverbial_tr}))
end
end


if multiplier_term then
if multiplier_term then
table.insert(forms, "     ''[[multiplier|Multiplier]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = multiplier_term, alt = multiplier_alt, tr = multiplier_tr}))
table.insert(forms, "     ''[[wikt:multiplier|Multiplier]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = multiplier_term, alt = multiplier_alt, tr = multiplier_tr}))
end
end


if distributive_term then
if distributive_term then
table.insert(forms, "     ''[[distributive number|Distributive]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = distributive_term, alt = distributive_alt, tr = distributive_tr}))
table.insert(forms, "     ''[[wikt:distributive number|Distributive]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = distributive_term, alt = distributive_alt, tr = distributive_tr}))
end
end


if collective_term then
if collective_term then
table.insert(forms, "     ''[[collective number|Collective]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = collective_term, alt = collective_alt, tr = collective_tr}))
table.insert(forms, "     ''[[wikt:collective number|Collective]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = collective_term, alt = collective_alt, tr = collective_tr}))
end
end


if fractional_term then
if fractional_term then
table.insert(forms, "     ''[[fractional|Fractional]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = fractional_term, alt = fractional_alt, tr = fractional_tr}))
table.insert(forms, "     ''[[wikt:fractional|Fractional]]'' : " .. m_links.full_link({lang = lang, sc = sc, term = fractional_term, alt = fractional_alt, tr = fractional_tr}))
end
end