Module:qhv-headword: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 79: Line 79:
local class = frame.args[2]; if class == "" then class = nil end
local class = frame.args[2]; if class == "" then class = nil end
local data = {lang = lang, pos_category = poscat, categories = {}, heads = {head}, genders = {}, inflections = {}}
local data = {
lang = lang,
heads = {head},
inflections = {},
genders = {},
pos_category = poscat,
categories = {},
}
if pos_functions[poscat] then
if pos_functions[poscat] then
Line 90: Line 97:
pos_functions.nouns = function(class, args, data)
pos_functions.nouns = function(class, args, data)
local params = {
local params = {
[1] = {list = "g", default = detect_gender(PAGENAME)},
[1] = {default = detect_gender(PAGENAME)},
["gen"] = {default = generate_gen_sg(PAGENAME)},
["nopl"] = {},
["gen"] = {},
["pl"] = {},
["pl"] = {},
["head"] = {},
["head"] = {},
["m"] = {list = true},
["f"] = {list = true},
}
}
Line 101: Line 107:
data.heads = {args["head"]}
data.heads = {args["head"]}
-- Gender
table.insert(data.genders, args[1])
for _, g in ipairs(args[1]) do
table.insert(data.categories, "High Valyrian " .. args[1] .. " " .. data.pos_category)
if legal_gender[g] then
table.insert(data.genders, g)
table.insert(data.categories, "High Valyrian " .. gender_names[g] .. " " .. data.pos_category)
else
table.insert(data.genders, "?")
end
end
if args[1][1] ~= "p" then
if not args["nopl"] then
-- Genitive
table.insert(args["gen"], generate_gen_sg(PAGENAME))
if #generate_gen_sg(PAGENAME) == 1 then
table.insert(args[2], table.concat(generate_gen_sg(PAGENAME)))
end
for i, form in ipairs(args[2]) do
for i, form in ipairs(args[2]) do
args[2][i] = {term = form}
args["gen"][i] = {term = form}
end
args[2].label = "genitive"
table.insert(data.inflections, args[2])
-- Plural
if #generate_nom_pl(PAGENAME) == 1 and data.pos_category == "nouns" then
table.insert(args[3], table.concat(generate_nom_pl(PAGENAME)))
end
end
if #args[3] > 0 then
args["gen"].label = "genitive"
for i, form in ipairs(args[3]) do
table.insert(data.inflections, args["gen"])
args[3][i] = {term = form}
end
args[3].label = "plural"
table.insert(data.inflections, args[3])
end
end
end
end
end