Module:qay-headword: Difference between revisions

No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 18: Line 18:
["in"] = true, ["i"] = true,
["in"] = true, ["i"] = true,
["an"] = true, ["a"] = true,
["an"] = true, ["a"] = true,
["in-p"] = true, ["an-p"] = true,
["?"] = true,
["?"] = true,
}
}


local gender_names = {
local gender_names = {
["in"] = "inanimate", ["i"] = "inanimate",
["in"] = "in", ["i"] = "in", ["in-p"] = "in-p",
["an"] = "animate", ["a"] = "animate",
["an"] = "an", ["a"] = "an", ["an-p"] = "an-p",
["?"] = "unknown",
["?"] = "unknown",
}
}
Line 51: Line 52:
local head = parent_args[2] or PAGENAME
local head = parent_args[2] or PAGENAME
local translit = PAGENAME
local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
Line 58: Line 58:
local data = {
local data = {
lang = lang,
lang = lang,
heads = head,
heads = {head},
translits = translit,
inflections = {},
inflections = {},
genders = {},
genders = {},
Line 79: Line 78:
[2] = {required = true},
[2] = {required = true},
["nopl"] = {},
["nopl"] = {},
["pl"] = {},
["pl"] = {list=true},
["affix"] = {list=true},
["affix"] = {list=true},
}
}
Line 87: Line 86:
data.affix = args.affix
data.affix = args.affix
table.insert(data.genders, sub(gender_names[args[1]], 1, 2))
table.insert(data.genders, gender_names[args[1]])
table.insert(data.categories, lang:getCanonicalName() .. " " .. (args[1] == "?" and "" or gender_names[args[1]]) .. " " .. data.pos_category)
--table.insert(data.categories, lang:getCanonicalName() .. " " .. (args[1] == "?" and "" or gender_names[args[1]]) .. " " .. data.pos_category)
if not args["nopl"] then
local plurals = {}
args["pl"] = generate_plural(PAGENAME, sub(gender_names[args[1]], 1, 2))
if not args["nopl"] and not match(gender_names[args[1]],"p") then
plurals = #args.pl ~= 0 and args.pl or generate_plural(PAGENAME, gender_names[args[1]])
for i, form in ipairs(args["pl"]) do
for i, form in ipairs(plurals) do
args["pl"][i] = {term = form}
plurals[i] = {term = form}
args["pl"][i].sc = require("Module:scripts").getByCode("Latn")
plurals[i].sc = require("Module:scripts").getByCode("Latn")
end
end
args["pl"].label = "plural"
plurals.label = "plural"
table.insert(data.inflections, args["pl"])
table.insert(data.inflections, plurals)
else
else
table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns")
table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns")