A modult a Modul:Modi-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',
	-- virama
	['𑘿'] = '',
}

local tt = {
	-- vowel signs
	['𑘀'] = 'a', ['𑘂'] = 'i', ['𑘄'] = 'u', ['𑘊'] = 'e', ['𑘌'] = 'o',
	['𑘁'] = 'ā', ['𑘃'] = 'ī', ['𑘅'] = 'ū', 
	['𑘆'] = 'ŕ', 
	['𑘋'] = 'ai', ['𑘍'] = 'au', 
	['𑘁𑙀'] = 'ŏ',
	['𑘀𑙀'] = 'ĕ', ['𑘊𑙀'] = 'ĕ',
	-- anusvara
	['𑘽'] = 'ṁ',
	-- visarga
	['𑘾'] = 'ḥ',
	-- numerals
	['𑙐'] = '0', ['𑙑'] = '1', ['𑙒'] = '2', ['𑙓'] = '3', ['𑙔'] = '4', ['𑙕'] = '5', ['𑙖'] = '6', ['𑙗'] = '7', ['𑙘'] = '8', ['𑙙'] = '9',
	--punctuation        
	['𑙁'] = '.', -- danda
	['𑙂'] = '.', -- double danda
	['+'] = '', -- compound separator
	
	-- abbreviation sign
	['𑙃'] = '.',
    --Om
    ['ॐ']='oṃ',
}

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(
		text,
		'([𑘎𑘏𑘐𑘑𑘒𑘓𑘔𑘕𑘖𑘗𑘘𑘙𑘚𑘛𑘜𑘝𑘞𑘟𑘠𑘡𑘢𑘣𑘤𑘥𑘦𑘧𑘨𑘩𑘪𑘯𑘫𑘬𑘭𑘮])'..
		'([𑘰𑘱𑘲𑘳𑘴𑘵𑘶𑘷𑘸𑘹𑘺𑘻𑘼𑘿]?)',
		function(c, d)
			if d == "" then        
				return consonants[c] .. 'a'
			else
				return consonants[c] .. diacritics[d]
			end
		end)

	text = mw.ustring.gsub(text, '.[𑙀]?', tt)
	
	return text
end
 
return export