Module:Syrc-stripdiacritics

From Linguifex
Revision as of 06:15, 21 December 2025 by wikt>Benwing2 ("entry name" as a concept is going away in favor of "strip diacritics" + logical-to-physical)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Syrc-stripdiacritics/doc

local export = {}

local u = mw.ustring.char

function export.stripDiacritics(text, lang, sc)
	-- tilde, macron, dot above, diaeresis, dot below, breve below, tilde below, macron below, superscript aleph, pthaha, zqapha, rbasa, zlama, hbasa, esasa, rwaha, feminine dot, qushshaya
	local replacements = {
		u(0x303), u(0x304), u(0x307), u(0x308), u(0x323), u(0x32E), u(0x330), u(0x331), u(0x711), "[" .. u(0x730) .. "-" .. u(0x74A) .. "]"
	}

	for _, replacement in ipairs(replacements) do
		text = mw.ustring.gsub(text, replacement, "")
	end

	return text
end

return export