Module:ábḫ-ipa: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:
for i,val in ipairs(word) do
for i,val in ipairs(word) do
if val == "b" then
if val == "b" then
if not mw.ustring.match(word[i], "[m]") then
if not mw.ustring.match(word[i-1], "[m]") then
table.insert(result, "β")
table.insert(result, "β")
end
end

Revision as of 21:27, 21 February 2020



local export = {}

function export.convert(frame)
	local word = type(frame) == "table" and frame.args[1] or frame
	
	word = mw.text.split(word, "", true)
	
	result = {}
	
	for i,val in ipairs(word) do
		if val == "b" then
			if not mw.ustring.match(word[i-1], "[m]") then
				table.insert(result, "β")
			end
		else
			table.insert(result, val)
		end
	end
	
	return table.concat(result)
end

return export