Module:ie-roots: Difference between revisions

no edit summary
(Created page with "local m_put = require("Module:parse utilities") local m_families = require("Module:families") local gsub = mw.ustring.gsub local PAGENAME = gsub(mw.title.getCurrentTitle().text, "%s", " ") local NAMESPACE = mw.title.getCurrentTitle().nsText local match = mw.ustring.match local gmatch = mw.ustring.gmatch local export = {} local function ncategories(categories) local out_categories = {} for key, cat in ipairs(categories) do out_categories[key] = "[[Category:" ....")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
local m_put = require("Module:parse utilities")
local m_put = require("Module:parse utilities")
local m_families = require("Module:families")


local gsub = mw.ustring.gsub
local gsub = mw.ustring.gsub
Line 20: Line 19:


local function link(term,alt)
local function link(term,alt)
return "[[wikt:Reconstruction:" .. proto .. "/*" .. term .. "|*" .. (alt or term) .. "]]"
return "[[wikt:Reconstruction:Proto-Indo-European/*" .. term .. "|*" .. (alt or term) .. "]]"
end
end


Line 38: Line 37:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local fam, lang = m_families.getByCode(frame.args[1]), require("Module:languages").getByCode(frame.args[2])
local lang = require("Module:languages").getByCode(frame.args[1])
local proto = fam:getProtoLanguage():getCanonicalName()


local links = {}; local categories = {}; local alts = {};
local links = {}; local categories = {}; local alts = {};
Line 65: Line 63:
table.insert(alts, arg)
table.insert(alts, arg)
elseif prefix == "c" then
elseif prefix == "c" then
table.insert(categories, lang:getCanonicalName() .. " terms from " .. proto .. " *" .. arg)
table.insert(categories, lang:getCanonicalName() .. " terms from Proto-Indo-European *" .. arg)
table.insert(alts, term)
table.insert(alts, term)
end
end
elseif prefix == "a" then
elseif prefix == "a" then
table.insert(links, link(term, arg))
table.insert(links, link(term, arg))
table.insert(categories, lang:getCanonicalName() .. " terms from " .. proto .. " *" .. term)
table.insert(categories, lang:getCanonicalName() .. " terms from Proto-Indo-European *" .. 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(term))
table.insert(categories, lang:getCanonicalName() .. " terms from " .. proto .. " *" .. arg)
table.insert(categories, lang:getCanonicalName() .. " terms from Proto-Indo-European *" .. arg)
table.insert(alts, term)
table.insert(alts, term)
end
end
Line 80: Line 78:
else
else
table.insert(links, link(args[a][i]))
table.insert(links, link(args[a][i]))
table.insert(categories, lang:getCanonicalName() .. " terms from " .. proto .. " *" .. args[a][i])
table.insert(categories, lang:getCanonicalName() .. " terms from Proto-Indo-European *" .. args[a][i])
table.insert(alts, args[a][i])
table.insert(alts, args[a][i])
end
end
40,864

edits