10,731
edits
TheNightAvl (talk | contribs) No edit summary |
TheNightAvl (talk | contribs) No edit summary |
||
Line 9: | Line 9: | ||
local out = "" | local out = "" | ||
local lang | local lang | ||
if mw.ustring.find(args[1], "%_") then | if mw.ustring.find(args[1], "[%>%_]") then | ||
lang = mw.ustring.match(args[1], "%_([^%_]+)$") | lang = mw.ustring.match(args[1], "[%>%_]([^%>%_]+)$") | ||
lang = m_languages.get_by_code(lang) | lang = m_languages.get_by_code(lang) | ||
else | else | ||
Line 55: | Line 55: | ||
for _, lang in ipairs(list) do | for _, lang in ipairs(list) do | ||
ancestors[lang] = {} | ancestors[lang] = {} | ||
if mw.ustring.find(lang, "%_") then | if mw.ustring.find(lang, "[%>%_]") then | ||
local ancestor_temp | local ancestor_temp = "" | ||
for piece in mw.ustring.gmatch(lang, "([^%_]+ | for piece in mw.ustring.gmatch(lang, "([^%>%_]+[%>%_])") do | ||
mw.log(piece) | |||
ancestor_temp = ancestor_temp .. piece | |||
ancestor_add = mw.ustring.gsub(ancestor_temp, "[%>%_]$", "") | |||
table.insert(ancestors[lang], ancestor_add) | |||
table.insert(ancestors[lang], | |||
end | end | ||
else | else | ||
Line 127: | Line 125: | ||
term = mw.ustring.gsub(term, "^.+%>%:%s*", "") | term = mw.ustring.gsub(term, "^.+%>%:%s*", "") | ||
end | end | ||
if mw.ustring.find(current_lang, "%_") then | if mw.ustring.find(current_lang, "[%>%_][^%:]") then | ||
from_lang, current_lang = mw.ustring.match(current_lang, "^(.* | from_lang, current_lang = mw.ustring.match(current_lang, "^(.*[%>%_])([^%>%_%:]+)$") | ||
if | if mw.ustring.match(from_lang, "%>$") then | ||
if lang_change_arged then | if lang_change_arged then | ||
lang_change_arged = lang_change_arged .. "<bor>" | lang_change_arged = lang_change_arged .. "<bor>" | ||
Line 139: | Line 137: | ||
current_lang = m_languages.get_by_code(current_lang) | current_lang = m_languages.get_by_code(current_lang) | ||
code = current_lang.code | code = current_lang.code | ||
if from_lang then code = from_lang | if from_lang then code = from_lang .. code end | ||
if terms[code] == nil then | if terms[code] == nil then | ||
terms[code] = {} | terms[code] = {} | ||
Line 209: | Line 207: | ||
Debug console test string: | Debug console test string: | ||
=p.descendant(mw.getCurrentFrame():newChild{title="whatever",args={"rad"}}) | =p.descendant(mw.getCurrentFrame():newChild{title="whatever",args={"rad"}}) | ||
=p.desctree(mw.getCurrentFrame():newChild{title="whatever",args={"rad | =p.desctree(mw.getCurrentFrame():newChild{title="whatever",args={"ryn>rad-o:1", "aeg:2", "3", "ryn:4", "ryn>rad-o_rad:5", ">rad-pro:6", "hrd-pro:7", "ryn-o:8", "lfv-pro:9", "lfv-o:10", "lfv:11", "rad-pro:12"}}) | ||
]]-- | ]]-- |