Module:Eo-spel

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 = "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