Module:inc-obn-translit

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', ['য়']='y', ['ৰ']='r', ['র']='r', ['ল']='l', ['ল়']='ḷ', ['ৱ']='v', ['শ']='ś', ['ষ']='ṣ', ['স']='s', ['হ']='ḣ', ['য়']='ẏ', }

local diacritics = { ['া']='ā', ['ি']='i', ['ী']='ī', ['ু']='u', ['ূ']='ū', ['ৃ']='ṛ', ['ৄ']='ṝ', ['ৢ']='ḷ', ['ৣ']='ḹ', ['ে']='e', ['ৈ']='ai', ['ো']='o', ['ৌ']='au', ['্']='', }

local tt = { -- vowels ['অ']='a', ['আ']='ā', ['ই']='i', ['ঈ']='ī', ['উ']='u', ['ঊ']='ū', ['ঋ']='ṛ', ['ৠ']='ṝ', ['ঌ']='ḷ', ['ৡ']='ḹ', ['এ']='e', ['ঐ']='ai', ['ও']='o', ['ঔ']='au', -- chandrabindu ['ঁ']='m̐', --until a better method is found -- anusvara ['ং']='ṃ', --until a better method is found -- visarga ['ঃ']='ḥ', --    	['ৎ']='t', -- avagraha ['ঽ']='’', --numerals ['০']='0', ['১']='1', ['২']='2', ['৩']='3', ['৪']='4', ['৫']='5', ['৬']='6', ['৭']='7', ['৮']='8', ['৯']='9',	--punctuation ['॥']='.', --double danda ['।']='.', --danda --Vedic extensions -- ['ᳵ']='x', ['ᳶ']='f', --Om ['ওঁ']='oṃ', --reconstructed ['*'] = '', }

function export.tr(text, lang, sc)

text = string.gsub(text, '্ব', '্ৱ')

text = mw.ustring.gsub(		text,		'([কখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযৰরলৱশষসহv]়?)'.. -- য় and ল় are composition exclusions!		'([ািীুূৃৄৢৣেৈোৌ্]?)',		function(c, d)			if d == "" then       				return consonants[c] .. 'a'			else				return consonants[c] .. diacritics[d]			end		end)

text = mw.ustring.gsub(text, '.', tt)

text = string.gsub(text, "([dgḣmr])v", "%1b") text = string.gsub(text, "ḣ", "h") text = string.gsub(text, "kṣ", "khy") return text end return export