10,731
edits
TheNightAvl (talk | contribs) (Bug fix) |
TheNightAvl (talk | contribs) No edit summary |
||
Line 71: | Line 71: | ||
-- process ad hoc ancestors | -- process ad hoc ancestors | ||
local ancestor_path = "" | local ancestor_path = "" | ||
for piece, delim in mw.ustring.gmatch(lang, "([^%>%_] | for piece, delim in mw.ustring.gmatch(lang, "([^%>%_]+)([%>%_])") do | ||
ancestor_path = ancestor_path .. piece | ancestor_path = ancestor_path .. piece | ||
table.insert(ancestors[lang], ancestor_path) | table.insert(ancestors[lang], ancestor_path) | ||
Line 78: | Line 78: | ||
if #ancestor_path < 1 then | if #ancestor_path < 1 then | ||
local function de_arrow(code) | |||
return mw.ustring.gsub(code, "^%>", "") | |||
end | |||
if mw.ustring.find(lang, "[0-9]+$") then | if mw.ustring.find(lang, "[0-9]+$") then | ||
local lang_temp, index = mw.ustring.match(lang, "^([^0-9]+)([0-9]+)$") | local lang_temp, index = mw.ustring.match(lang, "^([^0-9]+)([0-9]+)$") | ||
Line 83: | Line 87: | ||
if mw.ustring.find(test, "[^0-9]" .. index .. "$") then -- matches existing historical doublets with identical, e.g. rad-o2, if rad2 is present | if mw.ustring.find(test, "[^0-9]" .. index .. "$") then -- matches existing historical doublets with identical, e.g. rad-o2, if rad2 is present | ||
local test_temp = mw.ustring.gsub(test, index .. "$", "") -- get base | local test_temp = mw.ustring.gsub(test, index .. "$", "") -- get base | ||
if m_languages.get_by_code(lang_temp).lineage[test_temp] then | if m_languages.get_by_code(de_arrow(lang_temp)).lineage[test_temp] then | ||
table.insert(ancestors[lang], test) | table.insert(ancestors[lang], test) | ||
end | end | ||
elseif m_languages.get_by_code(lang_temp).lineage[test] and not m_table.contains(list, test .. index) then -- if test is still an ancestor to current language, e.g. rad-o, if rad2 is present, and checks if rad-o2 is not present | elseif m_languages.get_by_code(de_arrow(lang_temp)).lineage[test] and not m_table.contains(list, test .. index) then -- if test is still an ancestor to current language, e.g. rad-o, if rad2 is present, and checks if rad-o2 is not present | ||
mismatch_check(lang_temp, test) | mismatch_check(lang_temp, test) | ||
table.insert(ancestors[lang], test) | table.insert(ancestors[lang], test) | ||
Line 93: | Line 97: | ||
else | else | ||
for _, test in ipairs(list) do | for _, test in ipairs(list) do | ||
if m_languages.get_by_code(lang).lineage[test] then | if m_languages.get_by_code(de_arrow(lang)).lineage[test] then | ||
mismatch_check(lang, test) | mismatch_check(lang, test) | ||
table.insert(ancestors[lang], test) | table.insert(ancestors[lang], test) |