local m_headword = require("Module:headword")
local m_utilities = require("Module:utilities")
local export = {}
local pos_functions = {}
local lang = require("Module:languages").getLanguageByCode("roa-jer")
-- 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 = {"Jèrriais " .. poscat}
if pos_functions[poscat] then
pos_functions[poscat](args, genders, inflections, categories)
end
return
m_headword.format_headword(head, lang, "Latn") ..
m_headword.format_genders(genders, lang) ..
m_headword.format_inflections(inflections, lang, "Latn") ..
m_utilities.format_categories(categories, lang)
end
-- This only adds categories for now. The rest of {{roa-jer-noun}} should be added later.
pos_functions["nouns"] = function(args, genders, inflections, categories)
local gender = args[1] or ""
if gender == "" then
table.insert(categories, "Jèrriais nouns lacking gender")
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, "Jèrriais plurals")
table.insert(categories, "Jèrriais pluralia tantum")
elseif plural == PAGENAME then
table.insert(categories, "Jèrriais plurals")
end
end
return export