Pergi ke kandungan

Modul:mfa-buang calit

Daripada Wikikamus

Delete Laman ini telah dicadangkan untuk dihapuskan kerana tidak digunakan lagi. (+)
Jika anda tidak bersetuju dengan usul ini, sila nyatakan sebabnya di laman perbincangan atau di laman permohonan memadam laman.


local p = {}

function p.convert(frame)
	-- Get text passed from the template
	local text = frame:getParent().args[1] or ""

	-- Define the mapping of special letters to replacements
	local replacements = {
		["ó"] = "o",
		["é"] = "e",
		["è"] = "e",
		["ã"] = "a",
		["ẽ"] = "e",
		["õ"] = "o",
		["ũ"] = "u",
	}

	-- Perform replacement for each listed character
	for accented, plain in pairs(replacements) do
		text = mw.ustring.gsub(text, accented, plain)
	end

	return text
end

return p