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' , ='ṛ' ,
='ts' , ='dz' , ='rrr' ,
}
local diacritics = {
= 'ā' , ='i' , ='ī' , ='u' , ='ū' , ='r̥' , ='r̥̄' ,
='e' , ='ē' , ='ai' , ='o' , ='ō' , ='au' , ='' ,
}
local tt = {
-- vowels
='a' , ='ā' , ='i' , ='ī' , ='u' , ='ū' ,
='r̥' , ='r̥̄' , ='l̥' , ='l̥̄', ='e' , ='ē' ,
='ai' , ='o' , ='ō' , ='au' , ='aṅ' , ='aṃ' , ='ah' ,
-- other symbols
='ṃ',-- anusvara
='ḥ' , -- visarga
='ṅ' , -- candrabindu/arthanusvāra/aranusa
='’' , -- avagraha
-- digits
= '0', = '1', = '2', = '3', = '4',
= '5', = '6', = '7', = '8', = '9',
='0⁄4', ='¼', ='2⁄4', ='¾',
='0⁄16', ='1⁄16', ='2⁄16', ='3⁄16' ,
}
-- translit any words or phrases
function export.tr(text, lang, sc)
text = mw.ustring.gsub(
text,
'()'..
'(?)',
function(c, d)
if d == "" then
return consonants .. 'a'
else
return consonants .. diacritics
end
end)
text = mw.ustring.gsub(text, '.', tt)
return text
end
return export