Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Documentation for this module may be created at Module:Solandu/doc

local p = {}

local map = {
	["a"] = "",
	["b"] = "",
	["c"] = "",
	["k"] = "",
	["d"] = "",
	["e"] = "",
	["h"] = "",
	["i"] = "",
	["k"] = "",
	["l"] = "",
	["m"] = "",
	["n"] = "",
	["o"] = "",
	["p"] = "",
	["r"] = "",
	["s"] = "",
	["t"] = "",
	["u"] = "",
	["v"] = "",
	["x"] = "",
	["y"] = "",
	["z"] = "",
	["ā"] = "",
	["ē"] = "",
	["ī"] = "",
	["ō"] = "",
	["ū"] = "",
	["hua"] = "",
	["hue"] = "",
	["hui"] = "",
	["huo"] = "",
	["huu"] = "",
	["huā"] = "",
	["huē"] = "",
	["huī"] = "",
	["huō"] = "",
	["huū"] = "",
	["ñ"] = "",
	["qua"] = "",
	["que"] = "",
	["qui"] = "",
	["quo"] = "",
	["quu"] = "",
	["quā"] = "",
	["quē"] = "",
	["quī"] = "",
	["quō"] = "",
	["quū"] = "",
}

local function transliterate(text)
	text = mw.ustring.lower(text or "")

	local output = {}
	local i = 1

	while i <= mw.ustring.len(text) do
		local two = mw.ustring.sub(text, i, i + 1)
		local one = mw.ustring.sub(text, i, i)

		if map[two] then
			table.insert(output, map[two])
			i = i + 2
		elseif map[one] then
			table.insert(output, map[one])
			i = i + 1
		else
			table.insert(output, mw.text.nowiki(one))
			i = i + 1
		end
	end

	return table.concat(output)
end

function p.render(frame)
	local text = frame.args[1] or ""
	return '<span class="solandu">' .. transliterate(text) .. '</span>'
end

return p