Module:sei-headword

This module implements the following template:


local export = {}
local lang = require("Module:languages").getByCode("sei")

--verbs
function export.show_verb(frame)
	local args = frame:getParent().args
	local data = {lang = lang, pos_category = "verbs", categories = {}, sort_key = args.sort, heads = {args.head}, genders = {"pf-s"}, inflections = {}, nogendercat =1} --the nogendercat parameter is necessary as otherwise plural verbs will be added to "Seri pluralia tantum"
	local tracking_categories = {}
	local stem = mw.title.getCurrentTitle().text
	local stem_s = stem
	local ending = ""
	
	if args[2] == "tr" then
		table.insert(data.inflections, {label = "transitive"})
		table.insert(data.categories, "Seri transitive verbs")
	elseif args[2] == "in" then
		table.insert(data.inflections, {label = "intransitive"})
		table.insert(data.categories, "Seri intransitive verbs")
	else
		error("No transitivity parameter has been provided.")
	end
	
	if args[1] == "pf-s" then
		table.insert(data.categories, "Seri singular verbs")
		table.insert(data.categories, "Seri perfective verbs")
		if args.is then
			table.insert(data.inflections, {label = "imperfective singular", args.is})
		end
		if args.pp then
			table.insert(data.inflections, {label = "perfective plural", args.pp})
		end
		if args.ip then
			table.insert(data.inflections, {label = "imperfective plural", args.ip})
		end
	elseif args[1] == "pf-p" then
		data.genders = {args[1]}
		table.insert(data.categories, "Seri plural verbs")
		table.insert(data.categories, "Seri perfective verbs")
	elseif args[1] == "impf-s" then
		data.genders = {args[1]}
		table.insert(data.categories, "Seri singular verbs")
		table.insert(data.categories, "Seri imperfective verbs")
	elseif args[1] == "impf-p" then
		data.genders = {args[1]}
		table.insert(data.categories, "Seri plural verbs")
		table.insert(data.categories, "Seri imperfective verbs")
	else
		error("No number/perfectivity parameter has been provided.")
	end
	
	return require("Module:headword").full_headword(data) ..
		require("Module:utilities").format_categories(tracking_categories, lang, args.sort)
end

--nouns (the handling of multiple plurals can be done better)
function export.show_noun(frame)
	local args = frame:getParent().args
	local data = {lang = lang, pos_category = "nouns", categories = {}, sort_key = args.sort, heads = {args.head}, inflections = {}, genders = {}}
	local tracking_categories = {}
	local stem = mw.title.getCurrentTitle().text
	local stem_s = stem
	local ending = ""
	
	--add info about article
	if args[1] == "cop" then
		table.insert(data.inflections, {label = "article", "cop"})
	elseif args[1] == "quij" then
		table.insert(data.inflections, {label = "article", "quij"})
	elseif args[1] == "com" then
		table.insert(data.inflections, {label = "article", "com"})
	elseif args[1] == "quih" then
		table.insert(data.inflections, {label = "article", "quih"})
	elseif args[1] == "hac" then
		table.insert(data.inflections, {label = "article", "hac"})
	end
	
	if args[2] == "pl" then
		data.genders = {"p"}
	elseif args[2] then
		if args[3] then
			if args[4] then
				table.insert(data.inflections, {label = "plural", args[2], args[3], args[4]})
			else
				table.insert(data.inflections, {label = "plural", args[2], args[3]})
			end
		else
			table.insert(data.inflections, {label = "plural", args[2] })
		end
	end
	
	if args.pls then
		if args.pls2 then
			if args.pls3 then
				table.insert(data.inflections, {label = "plural with singular possessor", args.pls, args.pls2, args.pls3})
			else
				table.insert(data.inflections, {label = "plural with singular possessor", args.pls, args.pls2})
			end
		else
			table.insert(data.inflections, {label = "plural with singular possessor", args.pls})
		end
	end
	
	if args.plp then
		if args.plp2 then
			if args.plp3 then
				table.insert(data.inflections, {label = "plural with plural possessor", args.plp, args.plp2, args.plp3})
			else
				table.insert(data.inflections, {label = "plural with plural possessor", args.plp, args.plp2})
			end
		else
			table.insert(data.inflections, {label = "plural with plural possessor", args.plp})
		end
	end
	
	return require("Module:headword").full_headword(data) ..
		require("Module:utilities").format_categories(tracking_categories, lang, args.sort)
end

return export