Modul:Text: Unterschied zwischen den Versionen
K
Unicodeblock Kombinierende halbe diakritische Zeichen ergänzt
w>Mps KKeine Bearbeitungszusammenfassung |
w>Mps |
||
| Zeile 1: | Zeile 1: | ||
--[=[ | --[=[ 2015-01-15 | ||
Text utilities | Text utilities | ||
]=] | ]=] | ||
| Zeile 336: | Zeile 336: | ||
-- removes all diacritics from the input string, by decomposing the characters, removing the combining diacritical marks and recomposing the remaining characters | -- removes all diacritics from the input string, by decomposing the characters, removing the combining diacritical marks and recomposing the remaining characters | ||
function p.removeDiacritics(frame) | function p.removeDiacritics(frame) | ||
local combiningDiacriticalMarks = "[" .. mw.ustring.char(0x0300) .. "-" .. mw.ustring.char(0x036F) .. mw.ustring.char(0x1AB0) .. "-" .. mw.ustring.char(0x1AFF) .. mw.ustring.char(0x1DC0) .. "-" .. mw.ustring.char(0x1DFF) .. "]" | local combiningDiacriticalMarks = "[" .. | ||
mw.ustring.char(0x0300) .. "-" .. mw.ustring.char(0x036F) .. | |||
mw.ustring.char(0x1AB0) .. "-" .. mw.ustring.char(0x1AFF) .. | |||
mw.ustring.char(0x1DC0) .. "-" .. mw.ustring.char(0x1DFF) .. | |||
mw.ustring.char(0xFE20) .. "-" .. mw.ustring.char(0xFE2F) .. | |||
"]" | |||
return mw.ustring.toNFC(mw.ustring.gsub(mw.ustring.toNFD(frame.args[1] or ""), combiningDiacriticalMarks, "")) | return mw.ustring.toNFC(mw.ustring.gsub(mw.ustring.toNFD(frame.args[1] or ""), combiningDiacriticalMarks, "")) | ||
end | end | ||