Icona de documentació de mòdul Documentació del mòdul[mostra] [modifica] [refresca]

A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]


-- Funcions generals per l'italià.

local p = {}

-- Clau d'ordenació per a categories en italià
local senseDiacritics = {
	["À"] = "A", ["à"] = "a",
	["È"] = "E", ["è"] = "e", ["É"] = "E", ["é"] = "e",
	["Ì"] = "I", ["ì"] = "i",
	["Ò"] = "O", ["ò"] = "o", ["Ó"] = "O", ["ó"] = "o",
	["Ù"] = "U", ["ù"] = "u"}
local senseSignes = {
	["/"] = "",
	["-"] = "",
	["."] = "",
	["'"] = "",
	[" "] = ""}
local ordreAccents = {  -- ordre eéè simulat amb ordre Unicode eèéê
	["è"] = "ê",
	["ò"] = "ô"}

function p.ordena(mot)
	if type(mot) == "table" then mot = mot.args[1] end -- des de plantilles via invoke o des de mòduls via require
	if mot == "" or mot == nil then
		mot = mw.title.getCurrentTitle().text
	end
	local clau	-- format complet: "clau1!clau2!clau3!mot"
	local clau1	-- clau primària: en minúscules i sense diacrítics ni signes
	local clau2	-- clau secundària: prioritat dels diacrítics eéè
	local clau3	-- clau terciària: prioritat minúscules > majúscules
				 -- clau quaternària: prioritat sense signes > amb signes
	local motSenseSignes = mw.ustring.gsub(mot, ".", senseSignes)
	local motLower = mw.ustring.lower(motSenseSignes)
	clau1 = mw.ustring.gsub(motLower, ".", senseDiacritics)
	if clau1 == mot then
		return clau1
	end
	clau2 = mw.ustring.gsub(motLower, ".", ordreAccents)
	clau3 = mw.ustring.gsub(motSenseSignes, ".", senseDiacritics)
	if clau1 == motLower then
		clau = clau1 .. "!"
	else
		clau = clau1 .. "!" .. clau2
	end
	if clau3 ~= clau1 then
		clau = clau .. "!" .. clau3
	elseif motSenseSignes ~= mot then
		clau = clau .. "!"
	end
	if motSenseSignes ~= mot then
		clau = clau .."!" .. mot
	end
	return clau
end

--[[ 
Sil·labificació

	marcatge intern: vocals 0, obertures 1, codes 2
	síl·laba: ·(1*)0(2*)·
]]
function p.sil(mot, accent)
	if type(mot) == "table" then
		accent = mot.args[2]
		mot = mot.args[1]
	end

	-- Si no hi ha cap accent el posem
	if accent ~= nil and accent ~= "" then
		mot = accent
	elseif mot == nil or mot == "" then
		mot = mw.title.getCurrentTitle().text
	end
	if not mw.ustring.find(mot, "[àèéìòóù]") then
		mot = p.accent(mot)
	end
	
	local sil = mw.ustring.lower(mot)
	-- Obertures inseparables, digrammi
	sil = string.gsub(sil, " ", "")
	sil = string.gsub(sil, "'", "")
	sil = string.gsub(sil, "[cg]h", "11")
	sil = mw.ustring.gsub(sil, "[bcfgġpst]l", "11")
	sil = string.gsub(sil, "[st]m", "11")
	sil = string.gsub(sil, "[gp]n", "11")
	sil = string.gsub(sil, "[bcdfgpstv]r", "11")
	sil = string.gsub(sil, "ps", "11")
	sil = string.gsub(sil, "[gq]u([aàeèéiìoòó])", "11%1")
	-- triftongs, o dos diftongs seguits
	sil = mw.ustring.gsub(sil, "iu[aàeèéoòó]", "022")
	sil = mw.ustring.gsub(sil, "[iu][aàeèé][iu][aàeèéoòó]", "0202")
	sil = mw.ustring.gsub(sil, "[iu][aàeèé][iu]", "022")
	sil = mw.ustring.gsub(sil, "[iu][oòóù]i[aàeèéoòó]", "0202")
	sil = mw.ustring.gsub(sil, "[iu][oòóù]i", "022")
	-- diftongs creixents
	sil = mw.ustring.gsub(sil, "i[aàeèéoòóuù]", "02")
	sil = mw.ustring.gsub(sil, "u[aàeèéiìoòó]", "02")
	-- diftongs decreixents
	sil = mw.ustring.gsub(sil, "[aàeèé][iu]", "02")
	sil = mw.ustring.gsub(sil, "[oòóù]i", "02")
	-- Nuclis vocàlics
	sil = mw.ustring.gsub(sil, "[aàeèéiìoòóuù]", "0")
	-- Codes
	sil = string.gsub(sil, "[lmnr]([^0])", "2%1")
	-- Obertures s impura
	sil = string.gsub(sil, "s1", "11")
	sil = string.gsub(sil, "ss", "21")
	sil = string.gsub(sil, "s[^0]", "11")
	-- Obertures simples
	sil = mw.ustring.gsub(sil, "%l0", "10")
	-- Codes finals
	sil = mw.ustring.gsub(sil, "%l$", "2")
	sil = mw.ustring.gsub(sil, "%l2$", "22")
	sil = mw.ustring.gsub(sil, "%l22$", "222")
	-- Codes interiors
	sil = mw.ustring.gsub(sil, "%l([12])", "2%1")
	-- Separació de síl·labes
	local anterior = ""
	local mot_sep = {}
	for i = 1, mw.ustring.len(mot) do
		actual = mw.ustring.sub(sil, i, i)
		if (actual == "0" or actual == "1") and (anterior == "0" or anterior == "2") then
			table.insert(mot_sep, "·")
		end
		table.insert(mot_sep, mw.ustring.sub(mot, i, i))
		anterior = actual
	end
	return table.concat(mot_sep)
end

function p.sil_template(frame)
	local args = {}
	for k, v in pairs(frame:getParent().args) do -- metatable
		args[k] = v
	end
	if args[1] == nil then
		args[1] = mw.title.getCurrentTitle().text
	end
	if string.find(args[1], "[^ ]+ [^ ]+") then
		return
	end
	
	local sil = {}
	for i, w in ipairs(args) do
		if mw.ustring.find(w, "·") then
			sil[i] = {w}
		else
			local word = string.gsub(w, "-", "·")
			sil[i] = {p.sil(word)}
		end
	end
	local lang = {code = "it", name = "italià", sc = "Latn"}
	return require('Mòdul:síl·labes').format_hyphenations{['hyphs'] = sil, ['lang'] = lang}
end

function p.accent(mot)
	if type(mot) == "table" then mot = mot.args[1] end -- des de plantilles via invoke o des de mòduls via require
	if mot == "" or mot == nil then
		mot = mw.title.getCurrentTitle().text
	end
	if string.find(mot, "e[^aeiou]+[aeiou]") then
		-- Casos é generals
		mot = mw.ustring.gsub(mot, "ecc([ao])$", "écc%1")
		mot = mw.ustring.gsub(mot, "ecc(h?[ei])$", "écc%1")
		mot = mw.ustring.gsub(mot, "ecc(h?)i([ao])$", "écc%1i%2")
		mot = mw.ustring.gsub(mot, "([^i])e([dgt][aeio])$", "%1é%2")
		mot = mw.ustring.gsub(mot, "eggi([ao])$", "éggi%1")
		mot = mw.ustring.gsub(mot, "egg([ei])$", "égg%1")
		mot = mw.ustring.gsub(mot, "eg([nr])([aeio])$", "ég%1%2")
		mot = mw.ustring.gsub(mot, "emplic([ei])$", "émplic%1")
		mot = mw.ustring.gsub(mot, "eṣim([aeio])$", "éṣim%1")
		mot = mw.ustring.gsub(mot, "ment([aeio])$", "mént%1")
		mot = mw.ustring.gsub(mot, "erono$", "érono")
		mot = mw.ustring.gsub(mot, "es(s?[aeio])$", "és%1")
		mot = mw.ustring.gsub(mot, "esc(h?[aeio])$", "ésc%1")
		mot = mw.ustring.gsub(mot, "e(s+)ero$", "é%1ero")
		mot = mw.ustring.gsub(mot, "ett([aeio])$", "étt%1")
		mot = mw.ustring.gsub(mot, "evol([ei])$", "évol%1")
		mot = mw.ustring.gsub(mot, "evr([aeio])$", "évr%1")
		mot = mw.ustring.gsub(mot, "ezz([aeio])$", "ézz%1")
	end
	if string.find(mot, "o[^aeiou]+[aeiou]") or string.find(mot, "o[^aeiou]$") then
		-- Casos ó generals
		mot = mw.ustring.gsub(mot, "oc([ei])$", "óc%1")
		mot = mw.ustring.gsub(mot, "o([gn]n[aeio])$", "ó%1")
		mot = mw.ustring.gsub(mot, "oi([aeio]?)$", "ói%1")
		mot = mw.ustring.gsub(mot, "om([bp]r?[aeio])$", "óm%1")
		mot = mw.ustring.gsub(mot, "omplic([aeio])$", "ómplic%1")
		mot = mw.ustring.gsub(mot, "([^u])o([nr])$", "%1ó%2")
		mot = mw.ustring.gsub(mot, "([^fu])o([nr][aei])$", "%1ó%2")
		mot = mw.ustring.gsub(mot, "([^aeio])fon([aei])$", "%1fón%2")
		mot = mw.ustring.gsub(mot, "onc(i?[aeio])$", "ónc%1")
		mot = mw.ustring.gsub(mot, "on([dfgtz]r?[aeio])$", "ón%1")
		mot = mw.ustring.gsub(mot, "on([dgtz])ol([aeio])$", "ón%1ol%2")
		mot = mw.ustring.gsub(mot, "orci([ao])$", "órci%1")
		mot = mw.ustring.gsub(mot, "orc([ei])$", "órc%1")
		mot = mw.ustring.gsub(mot, "orn([aeio])$", "órn%1")
		mot = mw.ustring.gsub(mot, "([^u])or([ei])$", "%1ór%2")
		mot = mw.ustring.gsub(mot, "ors([aeio])$", "órs%1")
		mot = mw.ustring.gsub(mot, "os([aeio])$", "ós%1")
		mot = mw.ustring.gsub(mot, "osero$", "ósero")
	end
	if string.find(mot, "^%l[eo]") then
		mot = mw.ustring.gsub(mot, "^(%l?)(%l?)e$", "%1%2é")
		mot = mw.ustring.gsub(mot, "^(%l?)(%l?)oh$", "%1%2ó")
	end
	if string.find(mot, "[aeiou][^aeiou]+[aeiou]+[^aeiou]+[aeiou]") then -- 3 vocals entre consonants
		-- Casos d'estrúixoles generals
		mot = mw.ustring.gsub(mot, "([aeiou])tric([ei])$", "%1trìc%2")
		mot = mw.ustring.gsub(mot, "a([bcdfglmnprsṣtvzẓ][bcdfghmnprstvzẓ]?l?)i([cdlmt]h?)([aeio])$", "à%1i%2%3")
		mot = mw.ustring.gsub(mot, "e([bcdfglmnpqrsṣtvzẓ][bcdfghmnprstvzẓ]?l?)i([cdlmt]h?)([aeio])$", "è%1i%2%3")
		mot = mw.ustring.gsub(mot, "i([bcdfglmnpqrsṣtvzẓ][bcdfghmnprstvzẓ]?l?)i([cdlmt]h?)([aeio])$", "ì%1i%2%3")
		mot = mw.ustring.gsub(mot, "o([bcdfglmnpqrsṣtvzẓ][bcdfghmnprstvzẓ]?l?)i([cdlmt]h?)([aeio])$", "ò%1i%2%3")
		mot = mw.ustring.gsub(mot, "([^ae])u([bcdfglmnpqrsṣtvzẓ][bcdfghmnprstvzẓ]?l?)i([cdlmt]h?)([aeio])$", "%1ù%2i%3%4")
		mot = mw.ustring.gsub(mot, "au([bcdfglmnpqrsṣtvzẓ][bcdfghmnprstvzẓ]?l?)i([cdlmt]h?)([aeio])$", "àu%1i%2%3")
		mot = mw.ustring.gsub(mot, "eu([bcdfglmnpqrsṣtvzẓ][bcdfghmnprstvzẓ]?l?)i([cdlmt]h?)([aeio])$", "èu%1i%2%3")
		mot = mw.ustring.gsub(mot, "acciol([aeio])$", "àcciol%1")
		mot = mw.ustring.gsub(mot, "a([sc]?)cher([aeio])$", "à%1cher%2")
		mot = mw.ustring.gsub(mot, "afo([bn][aeio])$", "àfo%1")
		mot = mw.ustring.gsub(mot, "ag(g?)in([ei])$", "àg%1in%2")
		mot = mw.ustring.gsub(mot, "ag([eio])n([aeio])$", "àg%1n%2")
		mot = mw.ustring.gsub(mot, "alog(h?[aeio])$", "àlog%1")
		mot = mw.ustring.gsub(mot, "arono$", "àrono")
		mot = mw.ustring.gsub(mot, "a([smc]?[bcgmnpt][pbndgt]?)ol([aeio])$", "à%1ol%2")
		mot = mw.ustring.gsub(mot, "asser([aeio])$", "àsser%1")
		mot = mw.ustring.gsub(mot, "avol([aeio])$", "àvol%1")
		mot = mw.ustring.gsub(mot, "e([dt])ere$", "è%1ere")
		mot = mw.ustring.gsub(mot, "e([smc]?[bcgmnpt][pbndgt]?)ol([aeio])$", "è%1ol%2")
		mot = mw.ustring.gsub(mot, "efon([io])$", "èfon%1")
		mot = mw.ustring.gsub(mot, "endere$", "èndere")
		mot = mw.ustring.gsub(mot, "evol([ao])$", "èvol%1")
		mot = mw.ustring.gsub(mot, "iac(h?[aeio])$", "ìac%1")
		mot = mw.ustring.gsub(mot, "i([sc]?)cher([aeio])$", "ì%1cher%2")
		mot = mw.ustring.gsub(mot, "icciol([aeio])$", "ìcciol%1")
		mot = mw.ustring.gsub(mot, "ifo([nr][aeio])$", "ìfo%1")
		mot = mw.ustring.gsub(mot, "i([fn]?)fer([aeio])$", "ì%1fer%2")
		mot = mw.ustring.gsub(mot, "i([ng]?)gere$", "ì%1gere")
		mot = mw.ustring.gsub(mot, "ig(g?)in([ei])$", "ìg%1in%2")
		mot = mw.ustring.gsub(mot, "ig([eo])n([aeio])$", "ìg%1n%2")
		mot = mw.ustring.gsub(mot, "irono$", "ìrono")
		mot = mw.ustring.gsub(mot, "i([smc]?[bcgmnpt][pbndgt]?)ol([aeio])$", "ì%1ol%2")
		mot = mw.ustring.gsub(mot, "issero$", "ìssero")
		mot = mw.ustring.gsub(mot, "ivol([aeio])$", "ìvol%1")
		mot = mw.ustring.gsub(mot, "logi([ae])$", "logì%1")
		mot = mw.ustring.gsub(mot, "og([aeio])n([aeio])$", "òg%1n%2")
		mot = mw.ustring.gsub(mot, "olog(h?[aeio])$", "òlog%1")
		mot = mw.ustring.gsub(mot, "ona([cd]h?[aeio])$", "òna%1")
		mot = mw.ustring.gsub(mot, "o([smc]?[bcgmnpt][pbndgt]?)ol([aeio])$", "ò%1ol%2")
		mot = mw.ustring.gsub(mot, "o([sc]?)cher([aeio])$", "ò%1cher%2")
		mot = mw.ustring.gsub(mot, "or([cdg])ere$", "òr%1ere")
		mot = mw.ustring.gsub(mot, "ossero$", "òssero")
		mot = mw.ustring.gsub(mot, "o(s?)fo([bnr][aeio])$", "ò%1fo%2")
		mot = mw.ustring.gsub(mot, "ovol([aeio])$", "òvol%1")
		mot = mw.ustring.gsub(mot, "u([sc]?)cher([aeio])$", "ù%1cher%2")
		mot = mw.ustring.gsub(mot, "ucciol([aeio])$", "ùcciol%1")
		mot = mw.ustring.gsub(mot, "udin([ei])$", "ùdin%1")
		mot = mw.ustring.gsub(mot, "ug(g?)in([ei])$", "ùg%1in%2")
		mot = mw.ustring.gsub(mot, "uotere$", "uòtere")
		mot = mw.ustring.gsub(mot, "u([smc]?[bcgmnpt][pbndgt]?)ol([aeio])$", "ù%1ol%2")
		mot = mw.ustring.gsub(mot, "urono$", "ùrono")
		mot = mw.ustring.gsub(mot, "ussero$", "ùssero")
		mot = mw.ustring.gsub(mot, "u([dt])er([eio])$", "ù%1er%2")
		mot = mw.ustring.gsub(mot, "uvol([aeio])$", "ùvol%1")
		mot = mw.ustring.gsub(mot, "uzzol([aeio])$", "ùzzol%1")
	end
	if string.find(mot, "[aeiou][aeiou]") then -- bisíl·lab amb vocals
		mot = mw.ustring.gsub(mot, "^([^aeiou]?[^aeiou]?[^aeou])i([aeiou])$", "%1ì%2")
		mot = mw.ustring.gsub(mot, "([^aeiou]?[^aeo]?[^aeo]?)a(i?[aeiou])$", "%1à%2")
		mot = mw.ustring.gsub(mot, "([^aeiou]?[^aeo]?[^aeo]?)e(i?[aeiou])$", "%1è%2")
		mot = mw.ustring.gsub(mot, "([^aeiou]?[^aeio]?[^aeo]?)o(i?[aeiou])$", "%1ò%2")
		mot = mw.ustring.gsub(mot, "^([^aeiouq]?[^aeiouq]?[^aeiouq]?)u(i?[aeiou])$", "%1ù%2")
		mot = mw.ustring.gsub(mot, "qui([aeiou])$", "quì%1")
		mot = mw.ustring.gsub(mot, "^([^aeiou]?[^aeiou]?[^aeiou]?)qui$", "%1quì")
	end
	if not mw.ustring.find(mot, "[àèéìòóù]") then
		-- Altrament, oberta
		local accentuar = {["a"]="à", ["e"]="è", ["i"]="ì", ["o"]="ò", ["u"]="ù"}
		-- Vocal a accentuar, des del final
		local accent = 2
		if mw.ustring.find(mot, "^[^aeiou]+[aeiou]+$") then -- monosíl·lab
			if not (string.find(mot, "[ae][iu]$") or string.find(mot, "[ou]i$")) then -- ... sense diftong creixent
				accent = 1
			end
		elseif string.find(mot, "i[ao]$") or string.find(mot, "[gq]u[aeio]$") then
			accent = 3
		elseif mw.ustring.find(mot, "[ae][iu][^aeoiu]+[aeoiu]") or mw.ustring.find(mot, "[^qg][ou]i[^aeoiu]+[aeoiu]") then -- diftong decreixent paroxíton
			accent = 3
		elseif not string.find(mot, "[aeiou]$") then
			accent = 1
		end
		local vocals = 0
		for i = mw.ustring.len(mot), 1, -1 do
			local lletra = mw.ustring.sub(mot, i, i)
			if string.find(lletra, "[aeiou]") then
				vocals = vocals + 1
				if vocals == accent then
					local accentuat = mw.ustring.gsub(lletra, ".", accentuar) .. mw.ustring.sub(mot, i+1)
					if i>1 then
						accentuat = mw.ustring.sub(mot, 1, i-1) .. accentuat
					end
					return accentuat
				end
			end
		end
		if not mw.ustring.find(mot, "[àèéìòóù]") then
			mot = mw.ustring.gsub(mot, "[aeiou]", accentuar, 1)
		end
	end
	return mot
end

-- Pronunciació
function p.pron(mot)
	if type(mot) == "table" then mot = mot.args[1] or mw.title.getCurrentTitle().text end
	mot_sil = {}
	for mot_i in string.gmatch(mw.ustring.lower(mot), "%S+") do
		mot_sil[#mot_sil+1] = p.sil(mot_i)
	end
	mot = table.concat(mot_sil, " ")
	-- dígrafs
	mot = string.gsub(mot, "ch", "k")
	mot = string.gsub(mot, "qu", "kw")
	mot = string.gsub(mot, "gui([aàeèéoòoóuù])", "gwj%1")
	mot = mw.ustring.gsub(mot, "gn", "ɲ")
	-- consonants
	mot = string.gsub(mot, "y", "i")
	mot = string.gsub(mot, "q", "k")
	mot = mw.ustring.gsub(mot, "sci([aàoòóuù)])", "ʃ%1")
	mot = mw.ustring.gsub(mot, "sc([eèéiì])", "ʃ%1")
	mot = mw.ustring.gsub(mot, "sh", "ʃ")
	mot = mw.ustring.gsub(mot, "ci([aàoòóuù])", "tʃ%1")
	mot = mw.ustring.gsub(mot, "c([eèéiì])", "tʃ%1")
	mot = mw.ustring.gsub(mot, "c·tʃ", "t·tʃ")
	mot = string.gsub(mot, "c", "k")
	mot = mw.ustring.gsub(mot, "gi([aàoòóuù])", "dʒ%1")
	mot = mw.ustring.gsub(mot, "g([eèéiì])", "dʒ%1")
	mot = mw.ustring.gsub(mot, "g·dʒ", "d·dʒ")
	mot = mw.ustring.gsub(mot, "gh", "g")
	mot = mw.ustring.gsub(mot, "ġl", "ɡl")
	mot = mw.ustring.gsub(mot, "([^n])·gli([aàeèéoòóuù])", "%1·ʎ%2")
	mot = mw.ustring.gsub(mot, "([^n])·gl([iì])", "%1·ʎ%2")
	mot = mw.ustring.gsub(mot, "^gli([aàeèéoòóuù])", "ʎ%1")
	mot = mw.ustring.gsub(mot, "^gl([iì])", "ʎ%1")
	mot = mw.ustring.gsub(mot, "([aàeèéiìoòóuù])·ʎ", "%1ʎ·ʎ")
	mot = mw.ustring.gsub(mot, "n·gl([iì])", "ŋ·gl%1")
	mot = mw.ustring.gsub(mot, "([aàeèéiìoòóuù])·ɲ([aàeèéiìoòóuù])", "%1ɲ·ɲ%2")
	mot = mw.ustring.gsub(mot, "n(·?)([kg])", "ŋ%1%2")
	mot = string.gsub(mot, "h", "")
	mot = mw.ustring.gsub(mot, "([mn])(·?)([fv])", "ɱ%2%3")
	mot = mw.ustring.gsub(mot, "n(·?)([bmp])", "m%1%2")
	mot = mw.ustring.gsub(mot, "([aàeèéiìoòóuù])·ʃ([aàeèéiìoòóuù])", "%1ʃ·ʃ%2")
	mot = mw.ustring.gsub(mot, "z(·?)z", "t%1ts")
	mot = mw.ustring.gsub(mot, "([aàeèéiìoòóuù])·z([aàeèéiìoòóuù])", "%1t·ts%2")
	mot = mw.ustring.gsub(mot, "z", "ts")
	mot = mw.ustring.gsub(mot, "ẓ(·?)ẓ", "d%1dz")
	mot = mw.ustring.gsub(mot, "([aàeèéiìoòóuù])·ẓ([aàeèéiìoòóuù])", "%1d·dz%2")
	mot = mw.ustring.gsub(mot, "ẓ", "dz")
	mot = mw.ustring.gsub(mot, "·([ʃɲ{ts}{dz}])$", "%1")
	-- essa sonora o sorda
	mot = string.gsub(mot, "s([bdglmnrv])", "z%1")
	mot = mw.ustring.gsub(mot, "ṣ", "z")
	mot = string.gsub(mot, "x", "ks")
	-- vocals
	mot = mw.ustring.gsub(mot, "i([aàeèéoòóuù])", "j%1")
	mot = mw.ustring.gsub(mot, "ɲj", "ɲ")
	mot = mw.ustring.gsub(mot, "ʃj", "ʃ")
	mot = mw.ustring.gsub(mot, "dʒj", "dʒ")
	mot = mw.ustring.gsub(mot, "tʃj", "tʃ")
	mot = mw.ustring.gsub(mot, "u([aàeèéiìoòó])", "w%1")
	mot = mw.ustring.gsub(mot, "([àèéìòóù])·", "%1ː·")
	mot = mw.ustring.gsub(mot, "([àèéìòóù])ː·([sz])([fkptbdglmnv])", "%1·%2%3")
	mot = mw.ustring.gsub(mot, "([àèéìòóù])ː·([pt])([mns])", "%1·%2%3")
	-- accent
	if mw.ustring.find(mot, "[àèéìóòù]") then
		mot = mw.ustring.gsub(mot, "·(%l-[àèéìòóù])", "ˈ%1")
	else
		mot = mw.ustring.gsub(mot, "·(%l-)·(%l-)$", "ˈ%1·%2")
	end
	if not mw.ustring.find(mot, "ˈ") then -- monosíl·lab o accent en la primera
		mot = "ˈ" .. mot
	end
	mot = mw.ustring.gsub(mot, "ˈ(.+)ˈ", "ˌ%1ˈ")
	mot = mw.ustring.gsub(mot, "ˈ(.+)ˈ(.+)ˈ", "ˌ%1ˌ%2ˈ")
	mot = mw.ustring.gsub(mot, "ˌ(.+)ˈ(.+)ˈ", "ˌ%1ˌ%2ˈ")
	mot = mw.ustring.gsub(mot, "ˈ(.+)ˌ(.+)ˈ", "ˌ%1ˌ%2ˈ")
	mot = mw.ustring.gsub(mot, "ˌ(%l-)ː", "ˌ%1")
	mot = mw.ustring.gsub(mot, "ː(.+)ˈ", "%1ˈ")
	mot = mw.ustring.gsub(mot, "^(%l-[àèéìòóù])(.+)ˈ", "ˌ%1%2ˈ")
	mot = mw.ustring.gsub(mot, "è", "ɛ")
	mot = mw.ustring.gsub(mot, "ò", "ɔ")
	mot = mw.ustring.gsub(mot, ".", senseDiacritics)
	mot = mw.ustring.gsub(mot, "tʃ", "t͡ʃ")
	mot = mw.ustring.gsub(mot, "dʒ", "d͡ʒ")
	mot = mw.ustring.gsub(mot, "g", "ɡ")
	mot = mw.ustring.gsub(mot, "ts", "t͡s")
	mot = mw.ustring.gsub(mot, "dz", "d͡z")
	mot = mw.ustring.gsub(mot, "'", "")
	return '/' .. mw.ustring.gsub(mot, "·", ".") .. '/'
end

function p.plantilla_pron(frame)
	local args = frame:getParent().args
	local mot = args[1] or mw.title.getCurrentTitle().text
	local ret = ':*<span style="font-weight: bold;">Pronúncia</span><sup>[[Viccionari:Pronúncia de l\'italià|&#9432;]]</sup>: '
	ret = ret .. '<span class="IPA" title="pronúncia AFI">' .. p.pron(mot) .. '</span>'
	if args[2] then
		ret = ret .. ', <span class="IPA" title="pronúncia AFI">' .. p.pron(args[2]) .. '</span>'
	end
	return ret
end

return p