Module:roa-jer-headword

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
The following documentation is located at Module:roa-jer-headword/documentation. [edit]
Useful links: subpage listtransclusionstestcases

local export = {}
local pos_functions = {}
 
local lang = require("Module:languages").getByCode("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 require("Module:headword").full_headword(lang, nil, head, nil, genders, inflections, categories, nil)
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 terms with incomplete 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