Module:pollasena-roots: Difference between revisions

No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 145: Line 145:
list = true,
list = true,
allow_holes = true,
allow_holes = true,
default = lang_options.default,
}
}
else
else
params[termarg_index] = {
params[termarg_index] = {
required = not lang_options.optional,
required = not lang_options.optional,
default = lang_options.default,
}
}
end
end
Line 161: Line 159:
local args = m_param.process(parent_args, params)
local args = m_param.process(parent_args, params)


local dest_lang = lang_from_code(dest_code)
local dest_lang = m_lang.getByCode(dest_code)
local etymologies = {}
local etymologies = {}
Line 168: Line 166:
local code = ancestor.code
local code = ancestor.code
local lang_options = ancestor.options or {}
local lang_options = ancestor.options or {}
local ancestor_lang = lang_from_code(code)
local ancestor_lang = m_lang.getByCode(code)
local terms
local terms
Line 182: Line 180:
terms = {}
terms = {}
local root_index = 1
for _, item in ipairs(items) do
for _, item in ipairs(items) do
if item.term == "-" or item.term == "+" then
if item.term == "-" or item.term == "+" then
separator = item.term
separator = item.term
elseif item.term then
elseif item.term then
if root_index > 1 and separator == "-" then -- no asterisk after hyphen
if not item.alt then
item.alt = item.term:gsub("^%*", "")
else
item.alt = item.alt:gsub("^%*", "")
end
item.no_alt_ast = true
end
table.insert(terms, item)
table.insert(terms, item)
root_index = root_index + 1
end
end
end
end
Line 233: Line 242:
local ancestor_codes = {
local ancestor_codes = {
{ code = "sekh", options = {default = "asʰilavən"} },
{ code = "sekh" },
{ code = "wasc", options = {optional = true, roots = true, default = "asł-ila"} }
{ code = "wasc", options = {optional = true, roots = true } }
}
}