Module:kilta-headword: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 20: Line 20:
if word:match("[kh]wa$") or word:match("a$") then
if word:match("[kh]wa$") or word:match("a$") then
pl = {sub(word, 1, -1) .. "úr"}
pl = {term = sub(word, 1, -1) .. "úr"}
elseif word:match("ës$") or word:match("uin$") or word:match("[str]$") then
elseif word:match("ës$") or word:match("uin$") or word:match("[str]$") then
pl = {word .. "á"}
pl = {term = word .. "á"}
elseif word:match("[nml]$") then
elseif word:match("[nml]$") then
pl = {word .. "ur"}
pl = {term = word .. "ur"}
end
end
Line 35: Line 35:
local params = {
local params = {
[1] = {},
[1] = {},
[2] = {list = true},
["pl"] = {list = true},
["w"] = {default = PAGENAME},
["w"] = {default = PAGENAME},
}
}
Line 41: Line 41:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local word = args["w"]
local word = args["w"]
local pos = args[1]; local pl = args[2]
local pos = args[1]; local pl = args["pl"]
local data = {lang = lang, pos_category = deabb[pos], heads = {word}, categories = {}, inflections = {},}
local data = {lang = lang, pos_category = deabb[pos], heads = {word}, categories = {}, inflections = {},}
Line 54: Line 54:
else
else
pl.label = "plural"
pl.label = "plural"
table.insert(data.inflections, pl or plural(word))
if pl then
for _, form in ipairs(pl) do
table.insert(data.inflections, {term = form})
end
else
table.insert(data.inflections, plural(word))
end
end
end