Die Dokumentation für dieses Modul kann unter Modul:Defaultsort/Doku erstellt werden

-- Stand 2022-09-03
-- Erzeugt den Standardzeichensatz für die Kategorisierung eines Eintrags in anderer Schriftart 
local Defaultsort = {}

function Defaultsort.main(frame)
	if (frame.args.spr == "grc") then
		return Defaultsort.grc(frame.args[1])
	end
end

-- Erzeugt den Standardzeichensatz für die Kategorisierung eines Eintrags in altgriechischer Schrift
function Defaultsort.grc(str)
  local normal = "ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκΛλΜμΝνΞξΟοΠπΡρΣσςΤτΥυΦφΧχΨψΩω"
  local newstr = ""
  local newcp = 0
  local cp = 0
  local element = ""
  local strlen = mw.ustring.len(str)
  local j = 0
	for cp = 1, strlen do
		element = (mw.ustring.sub(str, cp, cp))
		if (mw.ustring.find(normal, element, 1, true)) then
			newstr = newstr .. element
		elseif (mw.ustring.find("άὰᾰᾱᾷἀἄἂᾆᾶᾳᾴᾲἆᾀᾄᾂἁἅἃᾇἇᾁᾅᾃ", element, 1, true)) then
			newstr = newstr .. "α"
		elseif (mw.ustring.find("ΆᾺᾸᾹἈἌἊᾎᾼἎᾈᾌᾊἉἍἋᾏἏᾉᾍᾋ", element, 1, true)) then
			newstr = newstr .. "Α"
		elseif (mw.ustring.find("ΈῈἘἜἚἙἝἛ", element, 1, true)) then
			newstr = newstr .. "Ε"
		elseif (mw.ustring.find("έὲἐἔἒἑἕἓ", element, 1, true)) then
			newstr = newstr .. "ε"
		elseif (mw.ustring.find("ἩΉῊἨἬἪᾞῌἮᾘᾜᾚῊ", element, 1, true)) then
			newstr = newstr .. "Η"
		elseif (mw.ustring.find("ἡᾓᾕᾔᾑᾐἧἦῂῄῃῆᾗᾖἣἢἤἠῇὴήᾕ", element, 1, true)) then
			newstr = newstr .. "η"
		elseif (mw.ustring.find("ΙΊῚῘῙἸἼἺἾΪ", element, 1, true)) then
			newstr = newstr .. "Ι"
		elseif (mw.ustring.find("ἱἵἳἷίὶῐῑἰἴἲῖἶϊΐῒῗ", element, 1, true)) then
			newstr = newstr .. "ι"
		elseif (mw.ustring.find("ὉὍὋΟΌῸὈὌὊ", element, 1, true)) then
			newstr = newstr .. "Ο"
		elseif (mw.ustring.find("ὁὅὃόὸὀὄὂ", element, 1, true)) then
			newstr = newstr .. "ο"
		elseif (mw.ustring.find("ὙὝὛὟΥΎῪῨῩΫ", element, 1, true)) then
			newstr = newstr .. "Υ"
		elseif (mw.ustring.find("ὑὕὓὗύὺῠῡὐὔὒῦὖϋΰῢῧ", element, 1, true)) then
			newstr = newstr .. "υ"
		elseif (mw.ustring.find("ὩὭὫᾯὯᾩᾭᾫΩΏῺὨὬὪᾮῼὮᾨᾬᾪ", element, 1, true)) then
			newstr = newstr .. "Ω"
		elseif (mw.ustring.find("ὡὥὣᾧὧᾡᾥᾣώὼῷὠὤὢᾦῶῳῴὦᾠᾤᾢ", element, 1, true)) then
			newstr = newstr .. "ω"
		else
			newstr = newstr .. element
		end
	end
  return newstr
end

return Defaultsort