10,731
edits
TheNightAvl (talk | contribs) No edit summary |
TheNightAvl (talk | contribs) No edit summary |
||
Line 8: | Line 8: | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local links = {} | local links = {} | ||
local nat = m_languages.find_by_code(args[1] or "" | local nat = m_languages.find_by_code(args[1] or "") | ||
local params = { | local params = { | ||
nocap = false, | nocap = false, | ||
nocat = false, | |||
} | } | ||
Line 17: | Line 18: | ||
for lang, _ in pairs(args) do | for lang, _ in pairs(args) do | ||
if type(lang) == "string" then | if type(lang) == "string" then | ||
if m_languages.find_by_code(lang) | if m_languages.find_by_code(lang) then | ||
table.insert(langs, lang) | table.insert(langs, lang) | ||
elseif params[lang] ~= nil then --check for parameters | elseif params[lang] ~= nil then --check for parameters | ||
Line 31: | Line 32: | ||
b = m_languages.get_by_code(b) | b = m_languages.get_by_code(b) | ||
if nat == | if nat == nil then | ||
return a.name < b.name | return a.name < b.name | ||
end | end | ||
Line 50: | Line 51: | ||
data[1], data[2] = lang, term | data[1], data[2] = lang, term | ||
local link = frame:expandTemplate{title = "m+", args = data} | local link = frame:expandTemplate{title = "m+", args = data} | ||
if nat then link = link .. "[[Category:" .. nat.name .. " terms with " .. lang.name .. " cognates]]" end | if nat and nocat == false then link = link .. "[[Category:" .. nat.name .. " terms with " .. m_languages.get_by_code(lang).name .. " cognates]]" end | ||
table.insert(links, link) | table.insert(links, link) | ||
end | end |