Module:Syrc-stripdiacritics
Appearance
- The following documentation is located at Module:Syrc-stripdiacritics/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
This module will generate diacritic-stripped text for text in the Syriac script. It is used to strip diacritics for Assyrian Neo-Aramaic, Western Neo-Aramaic, Chaldean Neo-Aramaic, and Turoyo.
The module should preferably not be called directly from templates or other modules.
To use it from a template, use {{strip diacritics}}.
Within a module, use Module:languages#Language:stripDiacritics.
For testcases, see Module:Syrc-stripdiacritics/testcases.
Functions
stripDiacritics(text, lang, sc)- Strips diacritics from a given piece of
textwritten in the script specified by the codesc, and language specified by the codelang. - When diacritic stripping fails, returns
nil.
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