45,337
edits
No edit summary |
No edit summary |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 29: | Line 29: | ||
{key = "collective", display = "[[wikt:collective number|Collective]]"}, | {key = "collective", display = "[[wikt:collective number|Collective]]"}, | ||
{key = "fractional", display = "[[wikt:fractional|Fractional]]"}, | {key = "fractional", display = "[[wikt:fractional|Fractional]]"}, | ||
{key = "formal", display = "[[wikt:formal|Formal]]"}, | |||
} | } | ||
Line 112: | Line 113: | ||
-- Parse a form with modifiers such as 'vuitanta-vuit<tag:Central>' or 'سیزده<tr:sizdah>' | -- Parse a form with modifiers such as 'vuitanta-vuit<tag:Central>' or 'سیزده<tr:sizdah>' | ||
-- or 'سیزده<tr:sizdah><tag:Iranian>' into its component parts. Return a form object, i.e. an object with fields | -- or 'سیزده<tr:sizdah><tag:Iranian>' into its component parts. Return a form object, i.e. an object with fields | ||
-- `form` for the form, and `tr`, `tag`, `q`, `qq` or `link` for the modifiers. The `tag` field is a tag list | -- `form` for the form, and `alt`, `tr`, `tag`, `q`, `qq` or `link` for the modifiers. The `tag` field is a tag list | ||
-- (see above). | -- (see above). | ||
function export.parse_form_and_modifiers(form_with_modifiers) | function export.parse_form_and_modifiers(form_with_modifiers) | ||
Line 133: | Line 134: | ||
retval.tag = {content} | retval.tag = {content} | ||
end | end | ||
elseif prefix == "q" or prefix == "qq" or prefix == "tr" or prefix == "link" then | elseif prefix == "q" or prefix == "qq" or prefix == "tr" or prefix == "link" or prefix == "alt" then | ||
if retval[prefix] then | if retval[prefix] then | ||
error(("Duplicate modifier '%s' in data module form, already saw value '%s': %s"):format(prefix, | error(("Duplicate modifier '%s' in data module form, already saw value '%s': %s"):format(prefix, | ||
Line 477: | Line 478: | ||
local right_q = formobj.qq and " " .. require("Module:qualifier").format_qualifier(formobj.qq) or "" | local right_q = formobj.qq and " " .. require("Module:qualifier").format_qualifier(formobj.qq) or "" | ||
return left_q .. m_links.full_link({ | return left_q .. m_links.full_link({ | ||
lang = lang, term = maybe_unaffix(m_data, formobj.form), alt = formobj.form, tr = formobj.tr, | lang = lang, term = maybe_unaffix(m_data, formobj.form), alt = formobj.alt or formobj.form, tr = formobj.tr, | ||
}) .. right_q | }) .. right_q | ||
end | end | ||
Line 729: | Line 730: | ||
if m_data.numeral_config then | if m_data.numeral_config then | ||
numeral = export.generate_non_arabic_numeral(m_data.numeral_config, cur_num) | numeral = export.generate_non_arabic_numeral(m_data.numeral_config, cur_num) | ||
if langcode == "qay" then numeral = numeral:gsub("A","¹"):gsub("B","²") end | |||
elseif cur_data["numeral"] then | elseif cur_data["numeral"] then | ||
numeral = export.format_fixed(cur_data["numeral"]) | numeral = export.format_fixed(cur_data["numeral"]) | ||
Line 875: | Line 877: | ||
-- Try looking up the next power of ten. | -- Try looking up the next power of ten. | ||
upper_num = make_greater_power_of_ten(1) | upper_num = make_greater_power_of_ten(1) | ||
if upper_num == next_num then | if upper_num == next_num or cur_num == "0" then | ||
upper_num = nil | upper_num = nil | ||
else | else |