मॉड्यूल:StarLing
दिखावट
"इस मॉड्यूल हेतु प्रलेख मॉड्यूल:StarLing/doc पर बनाया जा सकता है"
local export = {}
-- StarLing isn't consistent about Unicode normalization. Some letters are
-- decomposed (NFD), others are composed (NFC).
function export.fix_unicode_and_url_encode(text)
-- Decompose LATIN SMALL LETTER A WITH BREVE
-- to LATIN SMALL LETTER A, COMBINING BREVE.
text = text
:gsub("ă", "a" .. mw.ustring.char(0x306))
:gsub("Ă", "A" .. mw.ustring.char(0x306))
:gsub("ĕ", "e" .. mw.ustring.char(0x306))
:gsub("Ĕ", "E" .. mw.ustring.char(0x306))
:gsub("ĭ", "i" .. mw.ustring.char(0x306))
:gsub("Ĭ", "I" .. mw.ustring.char(0x306))
:gsub("ŏ", "o" .. mw.ustring.char(0x306))
:gsub("Ŏ", "O" .. mw.ustring.char(0x306))
:gsub("ŭ", "u" .. mw.ustring.char(0x306))
:gsub("Ŭ", "U" .. mw.ustring.char(0x306))
return mw.uri.encode(text)
end
function export.fix_unicode_and_url_encode_frame(frame)
return export.fix_unicode_and_url_encode(frame.args[1])
end
return export