မဝ်ဂျူ:id-headword

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

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

local export = {}
local pos_functions = {}

local lang = require("Module:languages").getByCode("id")
local script = require('Module:scripts').getByCode("Latn")
local PAGENAME = mw.title.getCurrentTitle().text

function export.show(frame)

	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 head = args["head"] or ""
	
	local data = {lang = lang, sc = script, pos_category = poscat, categories = {}, heads = {head}, translits = {"-"}, inflections = {}}
	
	if pos_functions[poscat] then
		pos_functions[poscat](args, data)
	end

	return require("Module:headword").full_headword(data)

end

pos_functions["နာမ်"] = function(args, data)

	local pl = {label = "ကိုန်ဗဟုဝစ်"}
	if args["pl"] == nil then
		
	else
		if args["pl"] == "-" then
			
		else
			if args["pl"] == "duplication" then
				-- common plural
				local subwords = mw.text.split(PAGENAME, "%s")
				local firstword = subwords[1]
				subwords[1] = mw.ustring.gsub("[[" .. firstword .. "]]-[[" .. firstword .. "]]", "([a-z]+%-)%1%1", "banyak %1") -- reduplicate only first word
				table.insert(pl, table.concat(subwords, " "))
			else
				table.insert(pl, args["pl"]) -- this is also used for 'para' type
				if args["pl2"] then table.insert(pl, args["pl2"]) end
				if args["pl3"] then table.insert(pl, args["pl3"]) end
			end
			table.insert(data.inflections, pl)
		end
	end
	
	local ku = {label = "first-person possessive"}
	if args["ku"] ~= "-" or args["ku"] == nil then
		table.insert(data.inflections, ku)
		table.insert(ku, mw.ustring.format("%s[[-ku|ku]]", PAGENAME))
	end

	local mu = {label = "second-person possessive"}
	if args["mu"] ~= "-" or args["mu"] == nil then
		table.insert(data.inflections, mu)
		table.insert(mu, mw.ustring.format("%s[[-mu|mu]]", PAGENAME))
	end

	local nya = {label = "third-person possessive"}
	if args["nya"] ~= "-" or args["nya"] == nil then
		table.insert(data.inflections, nya)
		table.insert(nya, mw.ustring.format("%s[[-nya|nya]]", PAGENAME))
	end

end

pos_functions["နာမ်မကိတ်ညဳ"] = function(args, data)

	local pl = {label = "ကိုန်ဗဟုဝစ်"}
	-- not necessary to have plural(s)
	if args["pl"] then table.insert(pl, args["pl"]) end
	if args["pl2"] then table.insert(pl, args["pl2"]) end
	if args["pl3"] then table.insert(pl, args["pl3"]) end
	if #pl > 0 then table.insert(data.inflections, pl) end

end

pos_functions["နာမဝိသေသန"] = function(args, data)

end

return export