Module:Diacritics Explained

--convertChar returns the non-diacritic version of the supplied character.stripDiacrits replaces words with diacritical characters with their non-diacritic equivalent.strip_diacrits is available for export to other modules.isLike tests two words, returning true if they only differ in diacritics, false otherwise.is_like is available for export to other modules.--

local p =

local chars =

local char_idx = for k1, v1 in pairs(chars) do for k2, v2 in pairs(v1) do char_idx[v2] = k1 endend

p.convertChar = function(frame) local ch = frame.args.char or mw.text.trim(frame.args[1]) or "" return char_idx[ch] or chend

p.strip_diacrits = function(wrd) if not wrd or wrd

"" then return "" end for ch in mw.ustring.gmatch(wrd, "%a") do if char_idx[ch] then wrd = wrd:gsub(ch, char_idx[ch]) end end return wrdend

p.stripDiacrits = function(frame) return p.strip_diacrits(frame.args.word or mw.text.trim(frame.args[1]))end

p.is_like = function(wrd1, wrd2) return p.strip_diacrits(wrd1)

p.strip_diacrits(wrd2)end

p.isLike = function(frame) local wrd1 = frame.args.word1 or frame.args[1] local wrd2 = frame.args.word2 or frame.args[2] if p.strip_diacrits(wrd1)

p.strip_diacrits(wrd2) then return true else return nil endend

return p