local export = {}
local consonants = {
='k' , ='ṅ' , ='c' , ='ñ' , ='ṭ' , ='ṇ' , ='t' ,
='n' , ='p', ='m' , ='y' , ='r' , ='l' , ='v' ,
='ḻ' , ='ḷ' , ='ṟ' , ='ṉ' , ='ś' , ='j' , ='ṣ' ,
='s' , ='h' , ='f' , ='z' , ='x' ,
='ḥ' ,
}
local diacritics = {
= 'ā' , ='i' , ='ī' , ='u' , ='ū' , ='e' ,
='ē' , ='ai' , ='o' , ='ō' , ='au' ,
='', --halant, supresses the inherent vowel "a"
-- no diacritic
= 'a'
}
local nonconsonants = {
-- vowels
='a' , ='ā' , ='i' , ='ī' , ='u' , ='ū' ,
='e' , ='ē' , ='ai' , ='o' , ='ō' , ='au' ,
-- other symbols
-- ='' ,
}
-- translit any words or phrases
function export.tr(text, lang, sc)
text = mw.ustring.gsub(
text,
'(ஃ?)()'..
'(?)',
function(h, c, d)
return (consonants or consonants .. (consonants or c)) .. diacritics
end)
text = mw.ustring.gsub(text, '.', nonconsonants)
return text
end
return export