Module:one-headword

From Wiktionary, the free dictionary
Jump to navigation Jump to search


local export = {}
local pos_functions = {}

local lang = require("Module:languages").getByCode("one")

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	PAGENAME = mw.title.getCurrentTitle().text
	local args = frame:getParent().args
	local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
	
	local cat = args["cat"]; if cat == "" then cat = nil end
	local cat2 = args["cat2"]; if cat2 == "" then cat2 = nil end
	local cat3 = args["cat3"]; if cat3 == "" then cat3 = nil end
	local head = args["head"]; if head == "" then head = nil end

	local data = {lang = lang, pos_category = cat or poscat, categories = {}, heads = {PAGENAME}, genders = {}, inflections = {}}
	
	if cat2 then table.insert(data.categories, "Oneida " .. cat2) end
	if cat3 then table.insert(data.categories, "Oneida " .. cat3) end
	
	if pos_functions[poscat] then
		pos_functions[poscat](args, data)
	end
	
	return require("Module:headword").full_headword(data)
end

pos_functions["nouns"] = function(args, data)
	local isolating_form = args["isol"]
	if isolating_form ~= nil then
		table.insert(data.inflections, {label = "isolation form", isolating_form})
	end
end

pos_functions["proper nouns"] = function(args, data)
end

pos_functions["adverbs"] = function(args, data)
	table.insert(data.categories, "Oneida adverbs")
end

return export