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"] = " | ["in"] = "in", ["i"] = "in", ["in-p"] = "in-p", | ||
["an"] = " | ["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 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}, | ||
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, | 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 | |||
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( | for i, form in ipairs(plurals) do | ||
plurals[i] = {term = form} | |||
plurals[i].sc = require("Module:scripts").getByCode("Latn") | |||
end | end | ||
plurals.label = "plural" | |||
table.insert(data.inflections, | table.insert(data.inflections, plurals) | ||
else | else | ||
table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns") | table.insert(data.categories, lang:getCanonicalName() .. " uncountable nouns") | ||