বিষয়বস্তুতে চলুন

মডিউল:eo-spel

উইকিঅভিধান, মুক্ত অভিধান থেকে

এই মডিউলের জন্য মডিউল:eo-spel/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে

local u = require("Module:string/char")
local toNFC = mw.ustring.toNFC

local export = {}

local lang = require("Module:languages").getByCode("eo")
local hat = u(0x302)
local breve = u(0x306)

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

function export.spelling(frame)
	return frame:expandTemplate{ title = "spelling of",
		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