Module:pollasena-roots: Difference between revisions
No edit summary Tags: Mobile edit Mobile web edit |
No edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 147: | Line 147: | ||
params[termarg_index] = { | params[termarg_index] = { | ||
required = not lang_options.optional, | required = not lang_options.optional, | ||
list = true, | |||
} | |||
params["c"] = { | |||
list = true, | list = true, | ||
allow_holes = true, | allow_holes = true, | ||
} | } | ||
else | else | ||
params[termarg_index] = { | params[termarg_index] = { | ||
required = not lang_options.optional, | required = not lang_options.optional, | ||
} | } | ||
end | end | ||
| Line 181: | Line 182: | ||
local terms | local terms | ||
local separator = "" | local separator = "" | ||
if lang_options.roots then | if lang_options.roots then | ||
local items = m_param_utils.parse_list_with_inline_modifiers_and_separate_params({ | local items = m_param_utils.parse_list_with_inline_modifiers_and_separate_params({ | ||
| Line 193: | Line 194: | ||
local root_index = 1 | local root_index = 1 | ||
for _, item in ipairs(items) do | for _, item in ipairs(items) do | ||
if item.alt and not match(item.alt, "^%*") and ancestor_lang:hasType("reconstructed") then | |||
item.alt = "*" .. item.alt | |||
end | |||
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 | if root_index > 1 and match(items[root_index - 1].term, "%-$") then -- no asterisk after hyphen | ||
if not item.alt then | if not item.alt then | ||
item.alt = item.term:gsub("^%*", "") | item.alt = item.term:gsub("^%*", "") | ||
| Line 202: | Line 207: | ||
item.alt = item.alt:gsub("^%*", "") | item.alt = item.alt:gsub("^%*", "") | ||
end | end | ||
end | end | ||
table.insert(terms, item) | table.insert(terms, item) | ||
local cat_term = item.term | local cat_term = args.c[root_index] or item.term | ||
if code == "wasc" then -- Wascotl root and suffix handling | cat_term = "*" .. gsub(cat_term, "^*+", "") -- ensure only one asterisk | ||
local suffix = match(cat_term, "^* | if code == "wasc" and cat_term ~= item.term then -- Wascotl root and suffix handling | ||
local suffix = match(cat_term, "^*%w+%-(%w+)$") | |||
if wasc_suffixes[suffix] then | if wasc_suffixes[suffix] then | ||