local data = {}

local U = require("Module:string/char")

local consonants = "𑊄𑊅𑊆𑊈𑊊𑊋𑊌𑊏𑊐𑊑𑊒𑊔𑊕𑊖𑊗𑊘𑊙𑊚𑊛𑊜𑊝𑊟𑊠𑊢𑊣𑊤𑅰𑊦𑊧"
local consonant = "[" .. consonants .. "]"
local acute = U(0x301)		-- combining acute

data["skr"] = {
	-- Vowels and modifiers. Do the diphthongs and diaereses first.
	{"ai", "𑊁"},
	{"au", "𑊂"},
	{"ä", "𑊀"},
	-- {"ö", ""},
	{"ï", "𑊁"},
	{"ü", "𑊂"},
	{"a", "𑊀"},
	{"ā", "𑊀"},
	{"i", "𑊁"},
	{"ī", "𑊁"},
	{"u", "𑊂"},
	{"ū", "𑊂"},
	{"e", "𑊃"},
	-- {"o", ""},
	{"(𑊀)[%-/]([𑊁𑊂])", "%1%2"},		-- a-i, a-u for 𑊀𑊁, 𑊀𑊂; must follow rules for "ai", "au"

	-- Two-letter consonants must go before h.
	{"kh", "𑊅"},
	{"gh", "𑊈"},
	-- {"ch", "𑊋"},
	{"jh", ""},
	{"ṭh", "𑊑"},
	{"ḍh", "𑊔"},
	{"th", "𑊗"},
	{"dh", "𑊙"},
	{"ph", "𑊜"},
	{"bh", "𑊟"},
	{"h", "𑊦"},

	-- Other stops.
	{"k", "𑊄"},
	{"g", "𑊆"},
	{"c", "𑊊"},
	{"j", "𑊌"},
	{"ṭ", "𑊐"},
	{"ḍ", "𑊒"},
	{"ṛ", "𑊧"},
	{"t", "𑊖"},
	{"d", "𑊘"},
	{"p", "𑊛"},
	{"b", "𑊝"},

	-- Nasals.
	{"ñ", "𑊏"},
	{"ṇ", "𑊕"},
	{"n", "𑊚"},
	{"m", "𑊠"},

	-- Remaining consonants.
	{"y", "𑊌"},
	{"r", "𑊢"},
	{"l", "𑊣"},
	{"v", "𑊤"},
	-- {"ś", ""},
	{"s", "𑊥"},
	-- {"ṣ", ""},
	-- {"ṃ", ""},

}

-- This must go last, after independent vowels are converted to diacritics, or "aï", "aü" won't work.
table.insert(data["skr"], {"(" .. consonant .. ")𑊀", "%1"})

-- [[w:Harvard-Kyoto]] to [[w:International Alphabet of Sanskrit Transliteration]]
data["skr-tr"] = {
	[1] = {
		["A"] = "ā",
		["I"] = "ī",
		["U"] = "ū",
		["J"] = "ñ",
		["T"] = "ṭ",
		["D"] = "ḍ",
		["N"] = "ṇ",
		["z"] = "ś",
		["S"] = "ṣ",
		["M"] = "ṃ",
		["/"] = acute,
	},
	[2] = {
		["R"] = "ṛ",
	},
}

return data