Modul:nrf-headword
A modult a Modul:nrf-headword/doc lapon tudod dokumentálni
local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("nrf")
-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
local args = frame:getParent().args
PAGENAME = mw.title.getCurrentTitle().text
local head = args["head"]; if head == "" then head = nil end
-- The part of speech. This is also the name of the category that
-- entries go in. However, the two are separate (the "cat" parameter)
-- because you sometimes want something to behave as an adjective without
-- putting it in the adjectives category.
local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local genders = {}
local inflections = {}
local categories = {"Norman " .. poscat}
if pos_functions[poscat] then
pos_functions[poscat](args, genders, inflections, categories)
end
return require("Module:headword").full_headword(lang, nil, head, nil, genders, inflections, categories, nil)
end
-- This only adds categories for now. The rest of {{nrf-noun}} should be added later.
pos_functions["nouns"] = function(args, genders, inflections, categories)
local gender = args[1] or ""
if gender == "" then
table.insert(categories, "Requests for gender in Norman entries")
end
local type = args["type"] or args[2]
local plural = args["pl"] or args["plural"] or PAGENAME .. (type == "-" and "" or "s")
if type == "plural" then
table.insert(categories, "Norman plurals")
table.insert(categories, "Norman pluralia tantum")
elseif plural == PAGENAME then
table.insert(categories, "Norman plurals")
end
end
return export