Module:pollasena-roots: Difference between revisions
No edit summary |
No edit summary |
||
| (9 intermediate revisions by the same user not shown) | |||
| Line 19: | Line 19: | ||
local wasc_suffixes = m_table.listToSet { | local wasc_suffixes = m_table.listToSet { | ||
"ati", "cosc", "e", "ekan", "i", "ila", | "-ati", "-cosc", "-e", "-ekan", "-i", "-ila", | ||
"kan", "la", "osc", "otl", "que", "scati", "si" | "-kan", "-la", "-osc", "-otl", "-que", "-scati", "-si" | ||
} | } | ||
| Line 133: | Line 133: | ||
end | end | ||
function export.parse_args(parent_args, dest_code, ancestor_codes, extra_params) | |||
local param_mods = m_param_utils.construct_param_mods({{group = {"link", "q", "l"}}}) | local param_mods = m_param_utils.construct_param_mods({{group = {"link", "q", "l"}}}) | ||
| Line 207: | Line 207: | ||
separator = item.term | separator = item.term | ||
elseif item.term then | elseif item.term then | ||
if root_index > 1 and match(items[root_index - 1].term, "%-$") then -- no asterisk after hyphen | if root_index > 1 and separator ~= "+" 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 218: | Line 218: | ||
local cat_term = args.c[root_index] or item.term | local cat_term = args.c[root_index] or item.term | ||
cat_term = "*" .. gsub(cat_term, "^*+", "") -- ensure only one asterisk | cat_term = "*" .. gsub(cat_term, "^*+", "") -- ensure only one asterisk | ||
if code == "wasc" | if code == "wasc" then -- Wascotl root and suffix handling | ||
local suffix = match(cat_term, "^*%w+%- | local suffix = match(cat_term, "^*[%w']+(%-[%w']+)$") | ||
if wasc_suffixes[suffix] then | if wasc_suffixes[suffix] then | ||
cat_term = gsub(cat_term, suffix, "") | cat_term = gsub(cat_term, suffix, "-") | ||
end | end | ||
end | end | ||
| Line 264: | Line 264: | ||
} | } | ||
if lang_options.annotated then | if lang_options.annotated and args.parts then | ||
local referrals = {} | local referrals = {} | ||
for _, part in args.parts do | for _, part in ipairs(args.parts) do | ||
local referral = m_links.full_link { | local referral = m_links.full_link({ | ||
lang = | lang = ancestor_lang, | ||
term = part, | term = part, | ||
} | }, "term") | ||
table.insert(referrals, referral) | table.insert(referrals, referral) | ||
| Line 290: | Line 290: | ||
return etymologies, args, categories | return etymologies, args, categories | ||
end | end | ||
return export | return export | ||