A modult a Modul:saz-translit/doc lapon tudod dokumentálni

local export = {}
 
local consonants = {
	['ꢒ']='k', ['ꢓ']='kh', ['ꢔ']='g', ['ꢕ']='gh', ['ꢖ']='ṅ', 
	['ꢗ']='c', ['ꢘ']='ch', ['ꢙ']='j', ['ꢚ']='jh', ['ꢛ']='ñ', 
	['ꢜ']='ṭ', ['ꢝ']='ṭh', ['ꢞ']='ḍ', ['ꢟ']='ḍh', ['ꢠ']='ṇ', 
	['ꢡ']='t', ['ꢢ']='th', ['ꢣ']='d', ['ꢤ']='dh', ['ꢥ']='n', 
	['ꢦ']='p', ['ꢧ']='ph', ['ꢨ']='b', ['ꢩ']='bh', ['ꢪ']='m', 
	['ꢫ']='y', ['ꢬ']='r', ['ꢭ']='l', ['ꢮ']='v', ['ꢯ']='ś', 
	['ꢰ']='ṣ', ['ꢱ']='s', ['ꢲ']='h', ['ꢳ']='ḷ',
}

local diacritics = {
	['ꢵ']= 'ā', ['ꢶ']='i', ['ꢷ']='ī', ['ꢸ']='u', ['ꢹ']='ū', ['ꢺ']='ṛ', ['ꢻ']='ṝ', ['ꢼ']='ḷ', ['ꢽ']='ḹ',
	['ꢾ']='e', ['ꢿ']='ē', ['ꣀ']='ai', ['ꣁ']='o', ['ꣂ']='ō', ['ꣃ']='au', ['꣄']='', ['ꢴ']='h',
}

local nonconsonants = {
	-- vowels
	['ꢂ']='a', ['ꢃ']='ā', ['ꢄ']='i', ['ꢅ']='ī', ['ꢆ']='u', ['ꢇ']='ū', 
	['ꢈ']='ṛ', ['ꢉ']='ṝ', ['ꢊ']='ḷ', ['ꢋ']='ḹ', ['ꢌ']='e', ['ꢍ']='ē',
	['ꢎ']='ai', ['ꢏ']='o', ['ꢐ']='ō', ['ꢑ']='au',
	-- other symbols
	['ꢀ']='ṃ', -- anusvara
	['ꢁ']='ḥ',  -- visarga
	['ꣅ']='◌̃', 
	['꣎']='.',
	-- digits
	['꣐'] = '0', ['꣑'] = '1', ['꣒'] = '2', ['꣓'] = '3', ['꣔'] = '4',
	['꣕'] = '5', ['꣖'] = '6', ['꣗'] = '7', ['꣘'] = '8', ['꣙'] = '9',
}

-- translit any words or phrases
function export.tr(text, lang, sc)
	text = mw.ustring.gsub(
		text,
		'([ꢒꢓꢔꢕꢖꢗꢘꢙꢚꢛꢜꢝꢞꢟꢠꢡꢢꢣꢤꢥꢦꢧꢨꢩꢪꢫꢬꢭꢮꢯꢰꢱꢲꢳ])'..
		'([ꢵꢶꢷꢸꢹꢺꢻꢼꢽꢾꢿꣀꣁꣂꣃ꣄ꢴ]?)',
		function(c, d)
			-- mw.log('match', c, d)
			c = consonants[c] or c
			if d == "" then        
				return c .. 'a'
			else
				return c .. (diacritics[d] or d)
			end
		end)
	
	text = mw.ustring.gsub(text, '.', nonconsonants)
	
	return text
end
 
return export