Module:Talu-sortkey

From Wiktionary, the free dictionary
Jump to navigation Jump to search
This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

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