Module:vmf-sortkey

Revision as of 05:30, 30 November 2022 by wikt>Theknightwho (Created page with "local export = {} local u = mw.ustring.char local remove_diacritics = u(0x0300) .. "-" .. u(0x0302) .. u(0x0308) .. u(0x030A) -- grave, acute, circumflex, diaeresis, ring above, cedilla local oneChar = { ["ß"] = "ss" } 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 .. "]", ""))) end return export")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:vmf-sortkey/doc

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

local remove_diacritics = u(0x0300) .. "-" .. u(0x0302) .. u(0x0308) .. u(0x030A) -- grave, acute, circumflex, diaeresis, ring above, cedilla

local oneChar = {
	["ß"] = "ss"
}

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 .. "]", "")))
end

return export