Module:pollasena-roots: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
Line 19: Line 19:
end
end


local function link(term,alt)
local function link(lang, term, alt)
return "[[Contionary:*" .. term .. "|*" .. (alt or term) .. "]]"
local natlang = lang:getWikidataItem() or false
-- true if the language declaration has a wikidata item, a marginal amount of conlangs have it
local data = {term = term, alt = alt, lang = lang, nocont = natlang}
return require('Module:links').full_link(data)
end
end


Line 62: Line 66:
if item:match("><") then
if item:match("><") then
if prefix == "a" then
if prefix == "a" then
table.insert(links, link(term, arg))
table.insert(links, link(fam, term, arg))
table.insert(alts, arg)
table.insert(alts, arg)
elseif prefix == "c" then
elseif prefix == "c" then
Line 69: Line 73:
end
end
elseif prefix == "a" then
elseif prefix == "a" then
table.insert(links, link(term, arg))
table.insert(links, link(fam, term, arg))
table.insert(categories, lang:getCanonicalName() .. " terms from " .. proto .. " *" .. term)
table.insert(categories, lang:getCanonicalName() .. " terms from " .. proto .. " *" .. term)
table.insert(alts, arg)
table.insert(alts, arg)
elseif prefix == "c" then
elseif prefix == "c" then
table.insert(links, link(term))
table.insert(links, link(fam, term))
table.insert(categories, lang:getCanonicalName() .. " terms from " .. proto .. " *" .. arg)
table.insert(categories, lang:getCanonicalName() .. " terms from " .. proto .. " *" .. arg)
table.insert(alts, term)
table.insert(alts, term)
Line 79: Line 83:
end
end
else
else
table.insert(links, link(args[a][i]))
table.insert(links, link(fam, args[a][i]))
table.insert(categories, lang:getCanonicalName() .. " terms from " .. proto .. " *" .. args[a][i])
table.insert(categories, lang:getCanonicalName() .. " terms from " .. proto .. " *" .. args[a][i])
table.insert(alts, args[a][i])
table.insert(alts, args[a][i])