模組:Gmw-pro-sortkey



local export = {}
local u = mw.ustring.char

local remove_diacritics = u(0x0304) .. u(0x0328) -- macron, ogonek

local oneChar = {
	["ʀ"] = "r"
}

function export.makeSortKey(text, lang, sc)
	return mw.ustring.upper(mw.ustring.toNFC(mw.ustring.gsub(mw.ustring.toNFD(mw.ustring.gsub(mw.ustring.lower(text), ".", oneChar)), "[" .. remove_diacritics .. "]", ""))) -- decompose, remove appropriate diacritics, then recompose again
end

return export