Jump to content

မေႃႇၵျူး:shn-headword

လုၵ်ႉတီႈ ဝိၵ်ႇသျိၼ်ႇၼရီႇ မႃး

Documentation for this module may be created at မေႃႇၵျူး:shn-headword/doc

local export = {}
local pos_functions = {}

local lang = require("Module:languages").getByCode("shn")
local script = require("Module:scripts").getByCode("Mymr")
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 data = {lang = lang, sc = script, pos_category = poscat, categories = {}, heads = {args["head"] or PAGENAME}, inflections = {}}
	
	if args["cat2"] then
		table.insert(data.categories, args["cat2"] .. " တႆးလူင်")
	end
	if args["cat3"] then
		table.insert(data.categories, args["cat3"] ..  " တႆးလူင်")
	end
	
	if pos_functions[poscat] then
		pos_functions[poscat](args, data)
	end

	local content = mw.title.new(PAGENAME):getContent()
	local code = mw.ustring.match(content, "{{shn%-pron[^}]*}}")

	if not code then
		table.insert(data.categories, "ၶေႃႈၵႂၢမ်းတႆးလူင် ဢၼ်ဢမ်ႇပႃးဝႆႉ ထႅမ်းပလဵတ်ႉ shn-pron")
	end

	local letter = true
	local specialLetter = mw.ustring.gmatch(PAGENAME, '.-([ၵၶၸတၼပၽမလသ][ျြ]).-')
	while true do
		letter = specialLetter()
		if (not letter) then break end
		table.insert(data.categories, "ၶေႃႈၵႂၢမ်းတႆးလူင် ဢၼ်လေႃးဝႆႉတင်း " .. letter)
	end

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

end

pos_functions["ႁိၵ်ႈ"] = function(args, data)

	local classifiers = {label = "classifier"}

	if args[1] then
		for _,par in ipairs(args) do
			if par == "*" then
				table.insert(classifiers, PAGENAME) -- shorthand
				table.insert(data.categories, "တူဝ်ၸႅၵ်ႇၽႄ တႆးလူင်")
				table.insert(data.categories, "ႁိၵ်ႈတႆးလူင် ဢၼ်ၸႅၵ်ႇၽႄဝႆႉ ၸွမ်း " .. PAGENAME)
			else
				table.insert(classifiers, par)
				table.insert(data.categories, "ႁိၵ်ႈတႆးလူင် ဢၼ်ၸႅၵ်ႇၽႄဝႆႉ ၸွမ်း " .. par)
			end
		end
		table.insert(data.inflections, classifiers)
	end

end

pos_functions["သၢင်ႈ"] = function(args, data)

	local par1 = args[1]; if par1 == "" then par1 = nil end
	local par2 = args[2]; if par2 == "" then par2 = nil end
	local par3 = args[3]; if par3 == "" then par3 = nil end
	local abstract_forms = {label = "ႁိၵ်ႈဝူၼ်ႉႁူႉ", accel = {form = "ႁိၵ်ႈ-ဝူၼ်ႉႁူႉ"}}

	if par1 ~= "-" then
		if not par1 then
			table.insert(abstract_forms, "လွင်ႈ" .. PAGENAME)
		else
			if par1 == "~" then
				table.insert(abstract_forms, "လွင်ႈ" .. PAGENAME)
				table.insert(abstract_forms, "တၢင်း" .. PAGENAME)
			else
				table.insert(abstract_forms, par1)
				table.insert(abstract_forms, par2)
				table.insert(abstract_forms, par3)
			end
		end
		table.insert(data.inflections, abstract_forms)
	end

end

pos_functions["ၵမ်ႉႁိၵ်ႈ"] = function(args, data)

	local par1 = args[1]; if par1 == "" then par1 = nil end
	local par2 = args[2]; if par2 == "" then par2 = nil end
	local par3 = args[3]; if par3 == "" then par3 = nil end
	local abstract_forms = {label = "ႁိၵ်ႈဝူၼ်ႉႁူႉ", accel = {form = "ႁိၵ်ႈ-ဝူၼ်ႉႁူႉ"}}

	if par1 ~= "-" then
		if not par1 then
			table.insert(abstract_forms, "တၢင်း" .. PAGENAME)
		else
			table.insert(abstract_forms, par1)
			table.insert(abstract_forms, par2)
			table.insert(abstract_forms, par3)
		end
		table.insert(data.inflections, abstract_forms)
	end

end

-- same logic
pos_functions["ၵမ်ႉသၢင်ႈ"] = pos_functions["ၵမ်ႉႁိၵ်ႈ"]
-- same logic
pos_functions["ႁိၵ်ႈသုၼ်ႇလဵဝ်"] = pos_functions["ႁိၵ်ႈ"]

return export