Module:descendants: Difference between revisions

Jump to navigation Jump to search
Bug fix
mNo edit summary
(Bug fix)
Line 53: Line 53:


function export.langtree(list)
function export.langtree(list)
 
-- build in-set ancestry
-- build in-set ancestry
local ancestors = {}
local ancestors = {}
Line 82: Line 82:
for _, test in ipairs(list) do
for _, test in ipairs(list) do
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 .. "$", "")
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(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] then -- if test is still an ancestor to current language, e.g. rad-o, if rad2 is present
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
mismatch_check(lang_temp, test)
mismatch_check(lang_temp, test)
table.insert(ancestors[lang], test)
table.insert(ancestors[lang], test)
Line 184: Line 184:
-- BEGIN TRIAGE --
-- BEGIN TRIAGE --
 
local structure = export.langtree(langs)
local structure = export.langtree(langs)
 
local outs = {}
local outs = {}

Navigation menu