Module:pollasena-roots: Difference between revisions

No edit summary
No edit summary
Line 11: Line 11:


local gsub = mw.ustring.gsub
local gsub = mw.ustring.gsub
local PAGENAME = gsub(mw.title.getCurrentTitle().text, "%s", " ")
local NAMESPACE = mw.title.getCurrentTitle().nsText
local match = mw.ustring.match
local match = mw.ustring.match
local gmatch = mw.ustring.gmatch


local export = {}
local export = {}
Line 199: Line 196:
terms = {}
terms = {}
local root_index = 1
local root_index = 1
local last_term = ""
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
if item.alt and not match(item.alt, "^%*") and ancestor_lang:hasType("reconstructed") then
Line 207: Line 205:
separator = item.term
separator = item.term
elseif item.term then
elseif item.term then
if root_index > 1 and separator ~= "+" and match(items[root_index - 1].term, "%-$") then -- no asterisk after hyphen
if root_index > 1 and match(last_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 230: Line 228:
root_index = root_index + 1
root_index = root_index + 1
end
end
last_term = item.term
end
end