Module:User:Erutuon/grc-utilities/sandbox

Hello, you have come here looking for the meaning of the word Module:User:Erutuon/grc-utilities/sandbox. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:Erutuon/grc-utilities/sandbox, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:Erutuon/grc-utilities/sandbox in singular and plural. Everything you need to know about the word Module:User:Erutuon/grc-utilities/sandbox you have here. The definition of the word Module:User:Erutuon/grc-utilities/sandbox will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:Erutuon/grc-utilities/sandbox, 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 decompose = mw.ustring.toNFD
local upper = mw.ustring.upper

local UTF8Char = "*"

local m_data = mw.loadData("Module:grc-utilities/data")
local diacritics = m_data.diacritics
local macron = diacritics.macron
local breve = diacritics.breve
local rough = diacritics.rough
local smooth = diacritics.smooth
local diaeresis = diacritics.diaeresis
local acute = diacritics.acute
local grave = diacritics.grave
local circumflex = diacritics.circum
local subscript = diacritics.subscript

--[=[
-- Copy of data from ].
local sort_key = {
		from = {"", "", "", "", "", "", "", "ῥ", "ς",""},
		to   = {"α"							 , "ε"		   , "η"						, "ι"				, "ο"		 , "υ"					  , "ω"							, "ρ", "σ",""}
}
local entry_name = {
		from = {"", "", "", "", "", "", "µ", "", "" },
		to   = {"Α", "α", "Ι", "ι", "Υ", "υ", "μ", "'", ""}
}
--]=]

local function replaceWithEmpty(listOfChars)
	local set = {}
	for _, char in ipairs(listOfChars) do
		set = ""
	end
	return set
end

local function removeDiacritics(text, diacriticList)
	return (string.gsub(decompose(text), UTF8Char, replaceWithEmpty(diacriticList)))
end

function export.makeSortKey(text)
	return upper(removeDiacritics(text, {
		macron, breve, rough, smooth, diaeresis, acute, grave, circumflex,
		subscript
	}))
end

function export.makeEntryName(text)
	return removeDiacritics(text, { macron, breve })
end
	
return export