Module:taln-headword: Difference between revisions
No edit summary |
No edit summary |
||
| Line 26: | Line 26: | ||
["pagename"] = {}, -- for testing | ["pagename"] = {}, -- for testing | ||
} | } | ||
if pos_functions[poscat] then | |||
local posparams = pos_functions[poscat].params | |||
if type(posparams) == "function" then | |||
posparams = posparams(lang) | |||
end | |||
for key, val in pairs(posparams) do | |||
params[key] = val | |||
end | |||
end | |||
local args = require("Module:parameters").process(parargs, params) | |||
local pagename = args.pagename or mw.loadData("Module:headword/data").pagename | local pagename = args.pagename or mw.loadData("Module:headword/data").pagename | ||
| Line 59: | Line 69: | ||
end | end | ||
pos_functions.nouns = | pos_functions.nouns = { | ||
params = { | |||
["g"] = {required = true, type = "genders"}, | ["g"] = {required = true, type = "genders"}, | ||
["nopl"] = {type = "boolean"}, | ["nopl"] = {type = "boolean"}, | ||
["pl"] = {list = true, allow_holes = false}, | ["pl"] = {list = true, allow_holes = false}, | ||
} | }, | ||
func = function(args, data) | |||
local function insert_inflection(terms, label, accel) | |||
m_headword_utilities.insert_inflection { | |||
headdata = data, | |||
terms = terms, | |||
label = label, | |||
accel = accel and {form = accel} or nil, | |||
} | |||
end | |||
if args.nopl or (pl and pl[1] == "-") then | |||
insert(data.categories, langname .. " uncountable nouns") | |||
elseif pl then | |||
insert_inflection(pl, "plural", "p") | |||
end | |||
end, | |||
end | } | ||
pos_functions.verbs = | pos_functions.verbs = { | ||
params = { | |||
["pres"] = {list = true, allow_holes = false}, | ["pres"] = {list = true, allow_holes = false}, | ||
["past"] = {list = true, allow_holes = false}, | ["past"] = {list = true, allow_holes = false}, | ||
["part"] = {list = true, allow_holes = false}, | ["part"] = {list = true, allow_holes = false}, | ||
} | }, | ||
func = function(args, data) | |||
local function insert_inflection(terms, label, accel) | |||
m_headword_utilities.insert_inflection { | |||
headdata = data, | |||
terms = terms, | |||
label = label, | |||
accel = accel and {form = accel} or nil, | |||
} | |||
end | |||
if pres then | |||
insert_inflection(pres, "first-person singular present", "1|s|pres|ind") | |||
end | |||
if past then | |||
insert_inflection(past, "first-person singular past", "1|s|past|ind") | |||
end | |||
if part then | |||
insert_inflection(part, "past participle", "pastpart") | |||
end | |||
end, | |||
end | } | ||
return export | return export | ||