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 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 = function(args, data)
pos_functions.nouns = {
local params = {
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)
args = require("Module:parameters").process(args, params)
local function insert_inflection(terms, label, accel)
m_headword_utilities.insert_inflection {
local function insert_inflection(terms, label, accel)
headdata = data,
m_headword_utilities.insert_inflection {
terms = terms,
headdata = data,
label = label,
terms = terms,
accel = accel and {form = accel} or nil,
label = label,
}
accel = accel and {form = accel} or nil,
end
}
end
if args.nopl or (pl and pl[1] == "-") then
insert(data.categories, langname .. " uncountable nouns")
if args.nopl or (pl and pl[1] == "-") then
elseif pl then
insert(data.categories, langname .. " uncountable nouns")
insert_inflection(pl, "plural", "p")
elseif pl then
end
insert_inflection(pl, "plural", "p")
end,
end
}
end


pos_functions.verbs = function(args, data)
pos_functions.verbs = {
local params = {
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)
args = require("Module:parameters").process(args, params)
local function insert_inflection(terms, label, accel)
m_headword_utilities.insert_inflection {
local function insert_inflection(terms, label, accel)
headdata = data,
m_headword_utilities.insert_inflection {
terms = terms,
headdata = data,
label = label,
terms = terms,
accel = accel and {form = accel} or nil,
label = label,
}
accel = accel and {form = accel} or nil,
end
}
end
if pres then
insert_inflection(pres, "first-person singular present", "1|s|pres|ind")
if pres then
end
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")
if past then
end
insert_inflection(past, "first-person singular past", "1|s|past|ind")
end
if part then
insert_inflection(part, "past participle", "pastpart")
if part then
end
insert_inflection(part, "past participle", "pastpart")
end,
end
}
end


return export
return export