Module:Thai-sortkey

Hello, you have come here looking for the meaning of the word Module:Thai-sortkey. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:Thai-sortkey, but we will also tell you about its etymology, its characteristics and you will know how to say Module:Thai-sortkey in singular and plural. Everything you need to know about the word Module:Thai-sortkey you have here. The definition of the word Module:Thai-sortkey will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:Thai-sortkey, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

local m_str_utils = require("Module:string utilities")

local gmatch = m_str_utils.gmatch
local gsub = m_str_utils.gsub
local u = m_str_utils.char

local minorMarkSet = "()"

local minorMarks = {
	 = "0",  = "1",  = "2",  = "3",  = "4",
	 = "5",  = "6",  = "7",  = "8",  = "9",  = "A"
}

function export.makeSortKey(text, lang, sc)
	local minorKey = ""
	for mark in gmatch(text, minorMarkSet) do
		minorKey = minorKey .. minorMarks
	end
	text = gsub(text, minorMarkSet, "")
	
	text = gsub(text, "", "")
	text = gsub(text, "()(ʼ?)", "%2%1")
	
	return text .. minorKey
end

return export