မဝ်ဂျူ:eo-spel

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

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

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

local hat = mw.ustring.char(0x302)
local breve = mw.ustring.char(0x306)

function export.convert(word)
	if word:match("[xX]") then
		return word
			:gsub("([cghjsCGHJS])[xX]", "%1" .. hat)
			:gsub("([uU])[xX]", "%1" .. breve)
	else
		return word
			:gsub("([cghjsCGHJS])[hH]", "%1" .. hat)
			:gsub("([aeoAEO][uU])", "%1" .. breve)
	end
end

function export.spelling(frame)
	return frame:expandTemplate{ title = "ခ္ဍံက်လိက်မဆေၚ်စပ်ကဵု",
		args = {[1] = "eo", [2] = (mw.title.getCurrentTitle().text:match("[xX]") and "X" or "H") .. "-system", [3] = frame:getParent() and frame:getParent().args[1] or export.convert(mw.title.getCurrentTitle().text)}}
end

return export