မာတိကာသို့ ခုန်သွားရန်

မဝ်ဂျူ:pox-headword

နူ ဝိက်ရှေန်နရဳ

Documentation for this module may be created at မဝ်ဂျူ:pox-headword/doc

local export = {}

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

local pos_functions = {}

-- 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 poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
	local head = args["head"]; if head == "" then head = nil end
	
	local data = {lang = lang, pos_category = poscat, categories = {}, heads = {head}, genders = {}, inflections = {}}
	
	-- See if a function exists for the particular part-of-speech type, and call it if there is one.
	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)
	-- Gender
	local g = args[1]; if g == "" then g = nil end
	table.insert(data.genders, g)
	
	if g == "m" then
		table.insert(data.categories, "Polabian masculine nouns")
	elseif g == "f" then
		table.insert(data.categories, "Polabian feminine nouns")
	elseif g == "n" then
		table.insert(data.categories, "Polabian neuter nouns")
	elseif g == "p" then
		table.insert(data.categories, "Polabian pluralia tantum")
	end
	
	-- Genitive
	local gen = args["gen"]; if gen == "" then gen = nil end
	
	if gen then
		table.insert(data.inflections, {label = "genitive", gen})
	end
	
	-- Accusative
	local acc = args["acc"]; if acc == "" then acc = nil end
	
	if acc then
		table.insert(data.inflections, {label = "accusative", acc})
	end
	
	-- Locative
	local loc = args["loc"]; if loc == "" then loc = nil end
	
	if loc then
		table.insert(data.inflections, {label = "locative", loc})
	end
	
	if g == "p" then
		table.insert(data.inflections, {label = "plural only"})
	else
		-- Dual
		local dual = args["dual"]; if dual == "" then dual = nil end
		
		if dual then
			table.insert(data.inflections, {label = "dual", dual})
		end
		
		-- Plural
		local pl = args["pl"]; if pl == "" then pl = nil end
		
		if pl then
			table.insert(data.inflections, {label = "plural", pl})
		end
	end
	
	-- Diminutive
	local dim = args["dim"]; if dim == "" then dim = nil end
	
	if dim then
		table.insert(data.inflections, {label = "diminutive", dim})
	end
	
	-- Feminine
	local f = args["f"]; if f == "" then f = nil end
	
	if f then
		table.insert(data.inflections, {label = "feminine equivalent", f})
	end
	
	-- Masculine
	local m = args["m"]; if m == "" then m = nil end
	
	if m then
		table.insert(data.inflections, {label = "masculine equivalent", m})
	end
end

return export