Module:root: Difference between revisions
Jump to navigation
Jump to search
(Created page with "local export = {} local m_languages = require("Module:languages") function export.make_categories(language, source, roots) local categories = {} local root_prefix = (source.proto and "*") or "" for _, root in ipairs(roots) do if language.code == source.code then table.insert(categories, "Category:" .. language.name .. " terms belonging to the root " .. root_prefix .. root .. "") else table.insert(categories, "[[Category:" .. language.name .. " terms der...") |
(No difference)
|
Revision as of 08:55, 6 August 2023
Documentation for this module may be created at Module:root/documentation
local export = {}
local m_languages = require("Module:languages")
function export.make_categories(language, source, roots)
local categories = {}
local root_prefix = (source.proto and "*") or ""
for _, root in ipairs(roots) do
if language.code == source.code then
table.insert(categories, "[[Category:" .. language.name .. " terms belonging to the root " .. root_prefix .. root .. "]]")
else
table.insert(categories, "[[Category:" .. language.name .. " terms derived from the " .. source.name .. " root " .. root_prefix .. root .. "]]")
end
end
return table.concat(categories)
end
function export.show(frame)
local params = {
[1] = {required = true},
[2] = {required = true},
[3] = {required = true, list = true},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local language = m_languages.get_by_code(args[1])
local source = m_languages.get_by_code(args[2])
return export.make_categories(language, source, args[3])
end
return export