跳转到内容

模組:Talu-sortkey

維基詞典,自由的多語言詞典


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

local monographs = {
	["[%p]"] = "", ["᧞"] = "ᦶᦜ", ["᧟"] = "ᦶᦜᧁ", ["᧚"] = "᧑"
}

function export.makeSortKey(text, lang, sc)
	for from, to in pairs(monographs) do
		text = mw.ustring.gsub(text, from, to)
	end
	
	text = mw.ustring.gsub(text, "([ᦵᦶᦷᦺ])([ᦀ-ᦫ])", "%2%1")
	
	return text
end

return export