Module:pollasena-roots: Difference between revisions

No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 121: Line 121:
separator = item.term
separator = item.term
elseif item.term then
elseif item.term then
if root_index > 1 and match(last_term, "%-$") then -- no asterisk after hyphen
if root_index > 1 and last_term ~= "+" then -- only subsequent asterisks afer space
if not item.alt then
item.alt = gsub(item.alt or item.term, "^%*", "")
item.alt = item.term:gsub("^%*", "")
else
item.alt = item.alt:gsub("^%*", "")
end
end
end
table.insert(terms, item)
table.insert(terms, item)
local cat_term = args.c[root_index] or item.term
local function one_asterisk(str)
cat_term = "*" .. gsub(cat_term, "^*+", "") -- ensure only one asterisk
return "*" .. gsub(str, "^*+", "")
local user_provided_cat_term = cat_term
end
local cat_term = one_asterisk(args.c[root_index] or item.term)
if code == "wasc" then -- Wascotl root and suffix handling
if code == "wasc" then -- Wascotl root and suffix handling
local suffix = match(cat_term, "^*[%w']+(%-[%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
if user_provided_cat_term == cat_term then
require("Module:debug").track("redundant and obsolete c")
end
end
end
end