A modult a Modul:Khar-translit/doc lapon tudod dokumentálni
local export = {}
local consonants = {
--consonants
='k', ='kh', ='g', ='gh',
='c', ='ch', ='j', ='ñ',
='ṭ', ='ṭh', ='ḍ', ='ḍh', ='ṇ',
='t', ='th', ='d', ='dh', ='n',
='p', ='ph', ='b', ='bh', ='m',
='y', ='r', ='l', ='v',
='ś', ='ṣ', ='s', ='z', ='h',
='ḱ', ='ṭ́h',
}
local diacritics = {
--matras
='i', ='u', ='ṛ',
='e', ='o',
='ī', ='ū', ='ṝ',
='ai', ='au', ='',
}
local tt = {
--vowels
-- anusvara
='ṃ', --until a better method is found
-- visarga
='ḥ',
--numerals
='1', ='2', ='3', ='4',
='10', ='20', ='100', ='1000',
--punctuation
='.', --danda
='.' --double danda
}
function export.tr(text, lang, sc)
if sc ~= "Khar" then
return nil
end
text = mw.ustring.gsub(
text,
'()'..
'(?)'..
'(𐨌?)',
function(c, d, e)
if d == "" and e ~= "" then
return consonants .. 'ā'
elseif d == "" then
return consonants .. 'a'
else
return consonants .. diacritics
end
end)
text = mw.ustring.gsub(
text,
'()'..
'(?)'..
'(𐨌?)',
function(c, d, e)
if d == "" and e ~= "" then
return 'ā'
elseif d == "" then
return 'a'
else
return diacritics
end
end)
text = mw.ustring.gsub(text, '.', tt)
return text
end
return export