Module:auto cat: Difference between revisions

From Laenkea
Jump to navigation Jump to search
No edit summary
Tag: Manual revert
No edit summary
Line 1: Line 1:
local export = {}
local export = {}


local function get_language_and_label(title)
local auto_categories = {
local find_by_name = require("Module:languages").find_by_name
{match = "Rhymes:{{language}}/{{rhyme}}", parents = {"Rhymes:{{language}}"}},
local language, label
{match = "Rhymes:{{language}}", parents = {"Rhymes"}},
{match = "{{language}} terms derived from {{source}}", parents = {"Terms derived from {{source}}", "{{language}} derived terms"}},
local words = mw.text.split(title, " ")
{match = "{{language}} terms inherited from {{source}}", parents = {"Terms inherited from {{source}}", "{{language}} inherited terms"}},
for i = 1, #words do
{match = "{{language}} terms borrowed from {{source}}", parents = {"Terms borrowed from {{source}}", "{{language}} borrowed terms"}},
name = table.concat(words, " ", 1, i)
{match = "{{language}} terms derived from the {{source}} root {{root}}", parents = {"{{language}} terms by {{source}} root", "Terms derived from the {{source}} root {{root}}"}}
label = table.concat(words, " ", i + 1)
}
language = find_by_name(name)
if language then break end
end
return language, label
end


return export
return export

Revision as of 08:43, 6 August 2023

local export = {}

local auto_categories = {
	{match = "Rhymes:{{language}}/{{rhyme}}", parents = {"Rhymes:{{language}}"}},
	{match = "Rhymes:{{language}}", parents = {"Rhymes"}},
	{match = "{{language}} terms derived from {{source}}", parents = {"Terms derived from {{source}}", "{{language}} derived terms"}},
	{match = "{{language}} terms inherited from {{source}}", parents = {"Terms inherited from {{source}}", "{{language}} inherited terms"}},
	{match = "{{language}} terms borrowed from {{source}}", parents = {"Terms borrowed from {{source}}", "{{language}} borrowed terms"}},
	{match = "{{language}} terms derived from the {{source}} root {{root}}", parents = {"{{language}} terms by {{source}} root", "Terms derived from the {{source}} root {{root}}"}}
}

return export