FANDOM


local export = {}
 
local gsub = mw.ustring.gsub
local sub = mw.ustring.sub
local match = mw.ustring.match
 
local iConv = {
	["ก"] = { ["paiboon"] = "g", ["ipa"] = "k", ["type"] = "mid" },
	["จ"] = { ["paiboon"] = "j", ["ipa"] = "t͡ɕ", ["type"] = "mid" },
	["ด"] = { ["paiboon"] = "d", ["ipa"] = "d", ["type"] = "mid" },
	["ฎ"] = { ["paiboon"] = "d", ["ipa"] = "d", ["type"] = "mid" },
	["ฏ"] = { ["paiboon"] = "dt", ["ipa"] = "t", ["type"] = "mid" },
	["ต"] = { ["paiboon"] = "dt", ["ipa"] = "t", ["type"] = "mid" },
	["บ"] = { ["paiboon"] = "b", ["ipa"] = "b", ["type"] = "mid" },
	["ป"] = { ["paiboon"] = "bp", ["ipa"] = "p", ["type"] = "mid" },
	["อ"] = { ["paiboon"] = "", ["ipa"] = "ʔ", ["type"] = "mid" },
 
	["ง"] = { ["paiboon"] = "ng", ["ipa"] = "ŋ", ["type"] = "low" },
	["ณ"] = { ["paiboon"] = "n", ["ipa"] = "n", ["type"] = "low" },
	["น"] = { ["paiboon"] = "n", ["ipa"] = "n", ["type"] = "low" },
	["ม"] = { ["paiboon"] = "m", ["ipa"] = "m", ["type"] = "low" },
	["ญ"] = { ["paiboon"] = "y", ["ipa"] = "j", ["type"] = "low" },
	["ย"] = { ["paiboon"] = "y", ["ipa"] = "j", ["type"] = "low" },
	["ร"] = { ["paiboon"] = "r", ["ipa"] = "r", ["type"] = "low" },
	["ล"] = { ["paiboon"] = "l", ["ipa"] = "l", ["type"] = "low" },
	["ฬ"] = { ["paiboon"] = "l", ["ipa"] = "l", ["type"] = "low" },
	["ว"] = { ["paiboon"] = "w", ["ipa"] = "w", ["type"] = "low" },
 
	["ค"] = { ["paiboon"] = "k", ["ipa"] = "kʰ", ["type"] = "low" }, 
	["ฅ"] = { ["paiboon"] = "k", ["ipa"] = "kʰ", ["type"] = "low" },
	["ฆ"] = { ["paiboon"] = "k", ["ipa"] = "kʰ", ["type"] = "low" },
	["ข"] = { ["paiboon"] = "k", ["ipa"] = "kʰ", ["type"] = "high" },
	["ฃ"] = { ["paiboon"] = "k", ["ipa"] = "kʰ", ["type"] = "high" },
	["ช"] = { ["paiboon"] = "ch", ["ipa"] = "t͡ɕʰ", ["type"] = "low" },
	["ฌ"] = { ["paiboon"] = "ch", ["ipa"] = "t͡ɕʰ", ["type"] = "low" },
	["ฉ"] = { ["paiboon"] = "ch", ["ipa"] = "t͡ɕʰ", ["type"] = "high" },
	["ฑ"] = { ["paiboon"] = "t", ["ipa"] = "tʰ", ["type"] = "low" },
	["ฒ"] = { ["paiboon"] = "t", ["ipa"] = "tʰ", ["type"] = "low" },
	["ท"] = { ["paiboon"] = "t", ["ipa"] = "tʰ", ["type"] = "low" },
	["ธ"] = { ["paiboon"] = "t", ["ipa"] = "tʰ", ["type"] = "low" },
	["ฐ"] = { ["paiboon"] = "t", ["ipa"] = "tʰ", ["type"] = "high" },
	["ถ"] = { ["paiboon"] = "t", ["ipa"] = "tʰ", ["type"] = "high" },
	["พ"] = { ["paiboon"] = "p", ["ipa"] = "pʰ", ["type"] = "low" },
	["ภ"] = { ["paiboon"] = "p", ["ipa"] = "pʰ", ["type"] = "low" },
	["ผ"] = { ["paiboon"] = "p", ["ipa"] = "pʰ", ["type"] = "high" },
	["ฟ"] = { ["paiboon"] = "f", ["ipa"] = "f", ["type"] = "low" },
	["ฝ"] = { ["paiboon"] = "f", ["ipa"] = "f", ["type"] = "high" },
	["ซ"] = { ["paiboon"] = "s", ["ipa"] = "s", ["type"] = "low" },
	["ศ"] = { ["paiboon"] = "s", ["ipa"] = "s", ["type"] = "high" },
	["ษ"] = { ["paiboon"] = "s", ["ipa"] = "s", ["type"] = "high" },
	["ส"] = { ["paiboon"] = "s", ["ipa"] = "s", ["type"] = "high" },
	["ฮ"] = { ["paiboon"] = "h", ["ipa"] = "h", ["type"] = "low" },
	["ห"] = { ["paiboon"] = "h", ["ipa"] = "h", ["type"] = "high" },
 
	["หง"] = { ["paiboon"] = "ng", ["ipa"] = "ŋ", ["type"] = "high" },
	["หน"] = { ["paiboon"] = "n", ["ipa"] = "n", ["type"] = "high" },
	["หม"] = { ["paiboon"] = "m", ["ipa"] = "m", ["type"] = "high" },
	["หญ"] = { ["paiboon"] = "y", ["ipa"] = "j", ["type"] = "high" },
	["หย"] = { ["paiboon"] = "y", ["ipa"] = "j", ["type"] = "high" },
	["หร"] = { ["paiboon"] = "r", ["ipa"] = "r", ["type"] = "high" },
	["หล"] = { ["paiboon"] = "l", ["ipa"] = "l", ["type"] = "high" },
	["หว"] = { ["paiboon"] = "w", ["ipa"] = "w", ["type"] = "high" },
 
	[""] = { ["paiboon"] = "", ["ipa"] = "", ["type"] = "" },
}
 
local vConv = {
	["paiboon"] = {
		["open"] = {
			["ะ"] = "a", [""] = "a", ["ิ"] = "i", ["ึ"] = "ʉ", ["ุ"] = "u", ["เะ"] = "e", ["แะ"] = "ɛ", 
			["โะ"] = "o", ["เาะ"] = "ɔ", ["็"] = "ɔ", ["เิ"] = "ə", ["เอะ"] = "ə",
 
			["า"] = "aa", ["ี"] = "ii", ["ู"] = "uu", ["ือ"] = "ʉʉ", ["เ"] = "ee", ["แ"] = "ɛɛ",
			["โ"] = "oo", ["อ"] = "ɔɔ", ["ร"] = "ɔɔn", ["เอ"] = "əə",
 
			["เียะ"] = "ia", ["เือะ"] = "ʉa", ["ัวะ"] = "ua",
			["เีย"] = "iia", ["เือ"] = "ʉʉa", ["ัว"] = "uua",
 
			["ิว"] = "iu", ["เ็ว"] = "eo", ["แ็ว"] = "ɛo", ["เา"] = "ao",
			["เว"] = "eeo", ["แว"] = "ɛɛo", ["าว"] = "aao", ["เอว"] = "əəo",
			["เียว"] = "iao",
 
			["ัย"] = "ai", ["ใ"] = "ai", ["ไ"] = "ai", ["ไย"] = "ai", ["็อย"] = "ɔi", ["ุย"] = "ui",
			["าย"] = "aai", ["อย"] = "ɔɔi", ["โย"] = "ooi", ["เย"] = "əəi", ["ูย"] = "uui",
			["วย"] = "uai", ["เือย"] = "ʉai",
 
			["ำ"] = "am",
		},
 
		["closed"] = {
			["ั"] = "a", ["รร"] = "a", ["ิ"] = "i", ["ึ"] = "ʉ", ["ุ"] = "u",
			["เ"] = "e/ee", ["เ็"] = "e", ["แ็"] = "ɛ", ["แ"] = "ɛ/ɛɛ", 
			[""] = "o", ["็อ"] = "ɔ",
 
			["า"] = "aa", ["ี"] = "ii", ["ื"] = "ʉʉ", ["ู"] = "uu", ["ู"] = "uu",
			["โ"] = "oo", ["อ"] = "ɔɔ", ["เิ"] = "əə", ["เอ"] = "əə",
 
			["เีย"] = "iia", ["เือ"] = "ʉʉa", ["ว"] = "uua",
		}
	},
 
	["ipa"] = {
		["open"] = {
			["ะ"] = "a(ʔ)", [""] = "a", ["ิ"] = "i", ["ึ"] = "ɯ", ["ุ"] = "u", ["เะ"] = "eʔ", ["แะ"] = "ɛʔ", 
			["โะ"] = "oʔ", ["เาะ"] = "ɔʔ", ["็"] = "ɔ", ["เิ"] = "ɤ", ["เอะ"] = "ɤʔ",
 
			["า"] = "aː", ["ี"] = "iː", ["ู"] = "uː", ["ือ"] = "ɯː", ["เ"] = "eː", ["แ"] = "ɛː",
			["โ"] = "oː", ["อ"] = "ɔː", ["ร"] = "ɔːn", ["เอ"] = "ɤː",
 
			["เียะ"] = "ia̯ʔ", ["เือะ"] = "ɯa̯ʔ", ["ัวะ"] = "ua̯ʔ",
			["เีย"] = "i(ː)a̯", ["เือ"] = "ɯ(ː)a̯", ["ัว"] = "u(ː)a̯",
 
			["ิว"] = "iw", ["เ็ว"] = "ew", ["แ็ว"] = "ɛw", ["เา"] = "aw",
			["เว"] = "eːw", ["แว"] = "ɛːw", ["าว"] = "aːw", ["เอว"] = "ɤːw",
			["เียว"] = "ia̯w",
 
			["ัย"] = "aj", ["ใ"] = "aj", ["ไ"] = "aj", ["ไย"] = "aj", ["็อย"] = "ɔj", ["ุย"] = "ui",
			["าย"] = "aːj", ["อย"] = "ɔːj", ["โย"] = "oːj", ["เย"] = "ɤːj", ["ูย"] = "uːj",
			["วย"] = "ua̯j", ["เือย"] = "ɯa̯j",
 
			["ำ"] = "am",
		},
 
		["closed"] = {
			["ั"] = "a", ["รร"] = "a", ["ิ"] = "i", ["ึ"] = "ɯ", ["ุ"] = "u",
			["เ"] = "eː", ["เ็"] = "e", ["แ็"] = "ɛ", ["แ"] = "ɛː", 
			[""] = "o", ["็อ"] = "ɔ",
 
			["า"] = "aː", ["ี"] = "iː", ["ื"] = "ɯː", ["ู"] = "uː", ["ู"] = "uː",
			["โ"] = "oː", ["อ"] = "ɔː", ["เิ"] = "ɤː", ["เอ"] = "ɤː",
 
			["เีย"] = "i(ː)a̯", ["เือ"] = "ɯ(ː)a̯", ["ว"] = "u(ː)a̯",
		}
	}
}
 
local unromLong = {
	["เีย"] = true, ["เือ"] = true, ["ัว"] = true, ["ว"] = true,
	["เือย"] = true, ["วาย"] = true, ["เอว"] = true,
	["เียว"] = true,
}
 
local liveExc = {
	["ัย"] = true, ["ใ"] = true, ["ไ"] = true, ["ไย"] = true,
	["ุย"] = true, ["วย"] = true,
	["เา"] = true, ["ิว"] = true, ["เ็ว"] = true, ["แ็ว"] = true,
	["ำ"] = true,
}
 
-- ย,ว are not included.
-- ซ,ส,ฟ,ล are changed for loanwords.
-- ห,อ,ฮ can never be codas.
local cConv = {
	["paiboon"] = {
		["ก"] = "k", ["ข"] = "k", ["ฃ"] = "k", ["ค"] = "k", ["ฅ"] = "k", ["ฆ"] = "k",
		["จ"] = "t", ["ฉ"] = "t", ["ช"] = "t", ["ซ"] = "s", ["ฌ"] = "t",
		["ฎ"] = "t", ["ฏ"] = "t", ["ฐ"] = "t", ["ฑ"] = "t", ["ฒ"] = "t",
		["ด"] = "t", ["ต"] = "t", ["ถ"] = "t", ["ท"] = "t", ["ธ"] = "t",
		["ศ"] = "t", ["ษ"] = "t", ["ส"] = "s",
		["บ"] = "p", ["ป"] = "p", ["ผ"] = "p", ["ฝ"] = "p", ["พ"] = "p", ["ฟ"] = "f", ["ภ"] = "p",
 
		["ง"] = "ng",
		["ญ"] = "n", ["ณ"] = "n", ["น"] = "n", ["ร"] = "n", ["ล"] = "l", ["ฬ"] = "n",
		["ม"] = "m",
	},
 
	["ipa"] = {
		["ก"] = "k̚", ["ข"] = "k̚", ["ฃ"] = "k̚", ["ค"] = "k̚", ["ฅ"] = "k̚", ["ฆ"] = "k̚",
		["จ"] = "t̚", ["ฉ"] = "t̚", ["ช"] = "t̚", ["ซ"] = "s", ["ฌ"] = "t̚",
		["ฎ"] = "t̚", ["ฏ"] = "t̚", ["ฐ"] = "t̚", ["ฑ"] = "t̚", ["ฒ"] = "t̚",
		["ด"] = "t̚", ["ต"] = "t̚", ["ถ"] = "t̚", ["ท"] = "t̚", ["ธ"] = "t̚",
		["ศ"] = "t̚", ["ษ"] = "t̚", ["ส"] = "s",
		["บ"] = "p̚", ["ป"] = "p̚", ["ผ"] = "p̚", ["ฝ"] = "p̚", ["พ"] = "p̚", ["ฟ"] = "f", ["ภ"] = "p̚",
 
		["ง"] = "ŋ",
		["ญ"] = "n", ["ณ"] = "n", ["น"] = "n", ["ร"] = "n", ["ล"] = "l", ["ฬ"] = "n",
		["ม"] = "m",
	},
}
 
local tFromMark = {
	["่"] = { ["high"] = "low",     ["mid"] = "low",     ["low"] = "falling" },
	["้"] = { ["high"] = "falling", ["mid"] = "falling", ["low"] = "high" },
	["๊"] = { ["high"] = "high",    ["mid"] = "high",    ["low"] = "high" },
	["๋"] = { ["high"] = "rising",  ["mid"] = "rising",  ["low"] = "rising" },
}
 
local tNoMark = {
	["dead-short"] = { ["high"] = "low",    ["mid"] = "low",  ["low"] = "high" },
	["dead-long"]  = { ["high"] = "low",    ["mid"] = "low",  ["low"] = "falling" },
	["live"]       = { ["high"] = "rising", ["mid"] = "mid",  ["low"] = "mid" },
}
 
local tRomMarks = {
	["high"] = "́", ["mid"] = "", ["low"] = "̀",
	["rising"] = "̌", ["falling"] = "̂",
}
 
local tLevels = {
	["high"] = "˦˥", ["mid"] = "˧", ["low"] = "˨˩",
	["rising"] = "˩˩˦", ["falling"] = "˥˩",
}
 
function export.translit(text, lang, sc, mode)
	if mode == "charOrtho" or mode == "charPhon" then
		return getCharSeq(text)
	else
		for word in mw.ustring.gmatch(text, "[ก-๛]+") do
			local orig_word, class, tMark, tone, long = word, "", false, false, false
			if match(word, "[่้๊๋].?[่้๊๋]") then
				return nil
			end
 
			word = gsub(word, "ฺ", "")
 
			word = gsub(word, "^([เแโใไ]?)(ห?[กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรลวศษสหฬอฮ])([รลว]?)([ิึุ็ีืัู]?[่้๊๋]?[าอรยวำ]?[วยร]?ะ?)([คฅฆกขฃพฟภบปชฌฑฒทธจฎฏดตฐถศษสมญณนรลฬง]?)$", function(v1, main, glide, v2, coda)
				mw.log("v1",v1,"main",main,"glide",glide,"v2",v2,"coda",coda)
				tMark = match(v2, "[่้๊๋]")
				v2 = gsub(v2, "[่้๊๋]", "")
				if mw.ustring.len(main) == 2 and match(main, "^ห") and (glide..v1..v2..coda == "" or not iConv[main]) then
					glide, v2, coda = match(sub(main, 2, 2)..glide..v2..coda, "^([รลว]?)([ิึุ็ีืัำู]?[าอรยว]?[วยร]?ะ?)([คฅฆกขฃพฟภบปชฌฑฒทธจฎฏดตฐถศษสมญณนรลฬง]?)$")
					main = "ห"
				end
				if glide .. v2 == "รร" then glide, v2 = "", "รร" end
				mw.log("v1",v1,"main",main,"glide",glide,"v2",v2,"coda",coda)
				openness = coda ~= "" and "closed" or "open"
				if vConv[mode][openness][v1..glide..v2] then
					orig_v = v1..glide..v2
					vowel, glide = vConv[mode][openness][v1..glide..v2], ""
				else
					orig_v = v1..v2
					vowel = vConv[mode][openness][v1 .. v2] or v1 .. v2
					glide = iConv[glide][mode]
				end
				if not iConv[main] then return main..glide..v1..v2..coda end
				initial, class = iConv[main][mode], iConv[main]["type"]
				length = (match(vowel, "([aiʉueɛoɔə])%1") or match(vowel, "ː") or unromLong[orig_v]) and "long" or "short"
				life = (match(coda, "[มญณนรลฬง]") or (match(orig_v, "ย$") and match(vowel, "i$")) or
					coda..length == "long" or liveExc[orig_v]) and "live" or "dead"
				coda = cConv[mode][coda] or coda
				if orig_v == "แ" then
					vowel = (tMark == "่" and life == "live" and class ~= "low") and "ɛ" or (mode == "ipa" and "ɛː" or "ɛɛ")
				end
				if orig_v == "เ" then
					vowel = tMark and "e" or (mode == "ipa" and "eː" or "ee")
				end
				tone = tMark and tFromMark[tMark][class] or (tNoMark[life.."-"..length] or tNoMark[life])[class]
				if mode == "paiboon" then
					vowel = gsub(vowel, "^([^aiʉueɛoɔə]*)([aiʉueɛoɔə])", "%1%2" .. tRomMarks[tone])
				else
					coda = coda .. tLevels[tone]
				end
				return initial .. glide .. vowel .. coda end)
 
			text = gsub(text, orig_word, word)
		end
	end
	if match(text, "[ก-๛]") then
		return nil
	else
		return mw.ustring.toNFC(text)
	end
end
 
-- ISO 11940
local charTable = {
	["ก"] = "k", ["ข"] = "k̄h", ["ฃ"] = "ḳ̄h", ["ค"] = "kh", ["ฅ"] = "k̛h", ["ฆ"] = "ḳh", ["ง"] = "ng",
	["จ"] = "c", ["ฉ"] = "c̄h", ["ช"] = "ch", ["ซ"] = "s", ["ฌ"] = "c̣h", ["ญ"] = "ỵ", 
	["ฎ"] = "ḍ", ["ฏ"] = "ṭ", ["ฐ"] = "ṭ̄h", ["ฑ"] = "ṯh", ["ฒ"] = "t̛h", ["ณ"] = "ṇ",
	["ด"] = "d", ["ต"] = "t", ["ถ"] = "t̄h", ["ท"] = "th", ["ธ"] = "ṭh", ["น"] = "n",
	["บ"] = "b", ["ป"] = "p", ["ผ"] = "p̄h", ["ฝ"] = "f̄", ["พ"] = "ph", ["ฟ"] = "f", ["ภ"] = "p̣h", ["ม"] = "m",
	["ย"] = "y", ["ร"] = "r", ["ฤ"] = "v", ["ล"] = "l", ["ฦ"] = "ł", ["ว"] = "w",
	["ศ"] = "ṣ̄", ["ษ"] = "s̛̄", ["ส"] = "s̄", ["ห"] = "h̄", ["ฬ"] = "ḷ", ["อ"] = "x", ["ฮ"] = "ḥ",
 
	["ะ"] = "a", ["ั"] = "ạ", ["า"] = "ā", ["ำ"] = "å", ["ิ"] = "i", ["ี"] = "ī",
	["ึ"] = "ụ", ["ื"] = "ụ̄", ["ุ"] = "u", ["ู"] = "ū", ["ๅ"] = "ɨ", ["ฺ"] = "˳", ["฿"] = "฿", -- uses spacing marks
	["เ"] = "vSpanFronte</span>",
	["แ"] = "vSpanFrontæ</span>",
	["โ"] = "vSpanFronto</span>",
	["ใ"] = "vSpanFrontı</span>",
	["ไ"] = "vSpanFrontị</span>", 
 
	["่"] = "ˋ", ["้"] = "ˆ", ["๊"] = "ˊ", ["๋"] = "ˇ", -- uses spacing marks
 
	["ฯ"] = "ǂ", ["ๆ"] = "«", ["็"] = "˘", -- uses spacing marks
	["์"] = "ʻ", ["ํ"] = "˚", ["๎"] = "~", ["๏"] = "§", -- uses spacing marks
	["๚"] = "ǁ", ["๛"] = "»",
 
	["๐"] = "0", ["๑"] = "1", ["๒"] = "2", ["๓"] = "3", ["๔"] = "4", 
	["๕"] = "5", ["๖"] = "6", ["๗"] = "7", ["๘"] = "8", ["๙"] = "9", 
 
	[" "] = "&ensp;", -- for visibility
	["-"] = "&ndash;", -- for visibility
}
 
function annotate(main_text, annotation)
	return "<span style=\"border-bottom: 1px dotted #000; cursor:help\" " ..
		"title=\"" .. annotation .. "\">" .. main_text .. "</span>"
end
 
function getCharSeq(text)
	local result = {}
	for character in mw.text.gsplit(text, "") do
		local charDetail = charTable[character] or nil
		if charDetail and charDetail[2] then
			table.insert(result, annotate(charDetail[1], charDetail[2]))
		else
			table.insert(result, charDetail)
		end
	end
	return table.concat(result, "&thinsp;") -- thin space
end
 
local nSet = {
	["redup"] = annotate("Reduplication", "This word exhibits reduplication in pronunciation, i.e. one written consonant is used as the final consonant of a syllable as well as the initial consonant of the next syllable."),
	["short"] = annotate("Short", "The vowel in this word is pronounced irregularly short."),
	["unortho"] = annotate("Unorthographical", "This phonetic respelling violates Thai alphabet rules to indicate an irregular pronunciation."),
}
 
function export.show(frame)
	local lang, sc = "th", "Thai"
	local args = frame:getParent().args
	local pagename = args.pagename or mw.title.getCurrentTitle().text
	local p, result = {}, { ["paiboon"] = {}, ["ipa"] = {}, ["charOrtho"] = {}, ["charPhon"] = {} }
	local systems = { "paiboon", "ipa", "charOrtho", "charPhon" }
	local note = {}
 
	if args["note"] then
		for ind_note in mw.text.gsplit(args["note"], ",") do
			table.insert(note, nSet[ind_note])
		end
	end
	if args[1] then
		for index, item in ipairs(args) do
			table.insert(p, (item ~= "") and item or nil)
		end
	else
		table.insert(p, pagename)
	end
	if match(table.concat(p, "/"), "็[ก-๛]*[่้๊๋]") or match(table.concat(p, "/"), "[่้๊๋][ก-๛]*็") then
		table.insert(note, nSet["unortho"])
		if not match(args["note"] or "", "short") then
			table.insert(note, nSet["short"])
		end
	end
	for _, system in ipairs(systems) do
		for _, spelling in ipairs(system == "charOrtho" and { pagename } or p) do
			table.insert(result[system], export.translit(spelling, lang, sc, system))
		end
	end
 
	local function tidyChar(text)
		text = gsub(text, "%+ %+", " &nbsp;")
		text = gsub(text, "%+%-%+", "&thinsp;—&thinsp;")
		text = gsub(text, "vSpanFront", "<span style=\"border:1px dotted gray; border-radius:50%; cursor:help\" title=\"Vowel sign appearing in front of the initial consonant.\">")
		return text
	end
 
	if pagename == table.concat(p) then
		orthographic = ""
		phonemic = "\n* ''Orthographic/Phonemic'': <span class=\"Thai\" lang=\"th\">" .. table.concat(p, ", ") .. "</span>" ..
			(#note > 0 and " &nbsp;<small>{" .. table.concat(note, "; ") .. "}</small>" or "") ..
			"\n*: <small>Sequence of characters: " .. tidyChar(table.concat(result["charPhon"], ", ")) .. "</small>"
 
	else
		phonemic = "\n* ''Phonemic'': <span class=\"Thai\" lang=\"th\">" .. table.concat(p, ", ") .. "</span>" ..
			(#note > 0 and " &nbsp;<small>{" .. table.concat(note, "; ") .. "}</small>" or "") ..
			"\n*: <small>Sequence of characters: " .. tidyChar(table.concat(result["charPhon"], ", ")) .. "</small>"
 
		if mw.title.getCurrentTitle().nsText ~= "" and not args.pagename then
			orthographic = ""
		else
			orthographic = "* ''Orthographic'': <span class=\"Thai\" lang=\"th\">" .. pagename ..
				"</span>\n*: <small>Sequence of characters: " .. tidyChar(table.concat(result["charOrtho"], ", ")) ..
				"</small>"
		end
	end
 
	paiboon = "\n* ''[[แม่แบบ:IPA-th/doc|การถอดอักษรเป็นภาษาอังกฤษ]]'': " .. table.concat(result["paiboon"], ", ") .. ""
	ipa = "\n* [[สัทอักษรสากล|IPA]]" ..
		"<sup>([[ประชาสังเคราะห์:IPA|?]])</sup>: <span class=\"IPA\">/" ..
		gsub(table.concat(result["ipa"], "/, /"), "-", ".") .. "/</span>"
 
	return orthographic .. phonemic .. paiboon .. ipa
end
 
return export

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on FANDOM

Random Wiki