local u = require("Module:string/char")
local lang = require("Module:languages").getByCode("gn")
local export = {}
local tilde = u(0x0303) -- Unicode code for tilde
-- Converts circumflex accents to tilde
function export.tilde(word)
if type(word) ~= "string" then
return word -- Return the original value if it's not a string
end
return word
:gsub("â", "ã") -- Replace â with ã
:gsub("ê", "ẽ") -- Replace ê with ẽ
:gsub("ô", "õ") -- Replace ô with õ
:gsub("û", "ũ") -- Replace û with ũ
:gsub("î", "ĩ") -- Replace î with ĩ
:gsub("ŷ", "ỹ") -- Replace ŷ with ỹ
end
-- Returns the correct spelling using the title of the entry
function export.spelling(frame)
local title = mw.title.getCurrentTitle().text
return frame:expandTemplate{
title = "spelling of",
args = {
[1] = "gn",
[2] = "circumflex-system",
[3] = export.tilde(title)
}
}
end
return export