La documentazione per questo modulo può essere creata in Modulo:Es-conj/man

-- Questo modulo contiene il codice per il template:Es-conj, che genera la coniugazione di tutti i verbi spagnoli
-- La funzione esconj genera la tabella di coniugazione utilizzando i parametri passati dal template

p = {}

local function categorizza(cat, titolo) --funzione per categorizzare, by Wim_b
local NS = tostring(mw.title.getCurrentTitle().namespace);

	if NS == '100' then
		return string.format('[[%s:%s|%s]]', mw.site.namespaces[14].name, cat, titolo)
	else
		return ''
	end
end

function p.esconj(frame)
    pframe = frame:getParent()
    config = frame.args
    args = pframe.args
    titolo = mw.title.getCurrentTitle().subpageText --il titolo della pagina, senza 'Appendice/Coniugazioni/Spagnolo'
    
    -- Argomenti passati dal template
    radice = args[1]
    
-- Inizializzazione di tutte le stringhe come nulle, per evitare errori di concatenazione
	descr = ""; conjdescr = ""; conjcat = ""; reg_irreg = ""; irregolare = ""; irregolarecat = ""; irregolaredescr = ""
	refl_exist = ""; refl_link = ""; refl_conjlink = ""
    ausiliare = ""
    inf = ""; ger = ""; par= ""; pp = ""; pplur = ""; pprifl = ""
    pres1s = ""; pres1s2 = ""; pres2s=""; pres2sform = ""; pres3s = ""; pres1p = ""; pres2p = ""; pres3p = ""
    imperf1s = ""; imperf2s=""; imperf3s = ""; imperf1p = ""; imperf2p = ""; imperf3p = ""
    prem1s = ""; prem1s2 = ""; prem2s = ""; prem3s = ""; prem3s2 = ""; prem1p = ""; prem2p = ""; prem3p = ""; prem3p2 = ""
    fut1s = ""; fut2s=""; fut3s = ""; fut1p =" "; fut2p = ""; fut3p = ""
    cond1s = ""; cond2s=""; cond3s = ""; cond1p = ""; cond2p = ""; cond3p = ""
    cong1s = ""; cong2s = ""; cong2sform = ""; cong3s = ""; cong1p = ""; cong2p = ""; cong3p = ""
    congimp1s =""; congimp1s2 = ""; congimp2s = ""; congimp2s2 = ""; congimp3s = ""; congimp3s2 = ""; congimp1p = ""; congimp1p2 = ""; congimp2p = ""; congimp2p2 = ""; congimp3p = ""; congimp3p2 = ""
    congfut1s = ""; congfut2s = ""; congfut3s = ""; congfut1p = ""; congfut2p = ""; congfut3p = ""
    imp2s=""; imp2s2 = ""; imp2sform = ""; imp2sneg = ""; imp2s3 = ""; imp3s = ""; imp1p = ""; imp2p = ""; imp2pneg = "" imp3p = ""
    me = ""; te = ""; se = ""; nos = ""; os = ""
    paspros = ""; trappros = ""; traprem = ""; futant = ""; condpas = ""; congpas = ""; congtrap = ""
    paspros1s = ""; paspros2s=""; paspros3s = ""; paspros1p = ""; paspros2p = ""; paspros3p = ""
    trappros1s = ""; trappros2s=""; trappros3s = ""; trappros1p = ""; trappros2p = ""; trappros3p = ""
    traprem1s = ""; traprem2s=""; traprem3s = ""; traprem1p = ""; traprem2p = ""; traprem3p = ""
    futant1s = ""; futant2s=""; futant3s = ""; futant1p = ""; futant2p = ""; futant3p = ""
    condpas1s = ""; condpas2s=""; condpas3s = ""; condpas1p = ""; condpas2p = ""; condpas3p = ""
    congpas1s = ""; congpas2s=""; congpas3s = ""; congpas1p = ""; congpas2p = ""; congpas3p = ""
    congtrap1s = ""; congtrap2s=""; congtrap3s = ""; congtrap1p = ""; congtrap2p = ""; congtrap3p = ""
    congfutant1s = ""; congfutant2s=""; congfutant3s = ""; congfutant1p = ""; congfutant2p = ""; congfutant3p = ""
    
-- A partire dalla coniugazione, genera le forme coniugate standard per ciascuna tipologia di verbo
    type = config["type"]
    if type == nil then
        inf = p.wiki(args["inf"])
    elseif (type == "ar") or (type == "arse") then
    	inf = p.wiki(radice .. "ar")
    	ger = p.wiki(radice.."ando")
    	pp = p.wiki(radice .. "ado"); pplur = p.wiki(radice.."ados")
        pres1s = p.wiki(radice .. "o");  pres2s = p.wiki(radice .. "as"); pres2sform = p.wiki(radice.."ás")  pres3s = p.wiki(radice .. "a")
        pres1p = p.wiki(radice .. "amos");  pres2p = p.wiki(radice .. "áis");  pres3p = p.wiki(radice .. "an")        
        imperf1s = p.wiki(radice .. "aba");  imperf2s = p.wiki(radice .. "abas");  imperf3s = p.wiki(radice .. "aba")
        imperf1p = p.wiki(radice .. "ábamos");  imperf2p = p.wiki(radice .. "abais");  imperf3p = p.wiki(radice .. "aban") 
        prem1s = p.wiki(radice .. "é");  prem2s = p.wiki(radice .. "aste");  prem3s = p.wiki(radice .. "ó")
        prem1p = p.wiki(radice .. "amos");  prem2p = p.wiki(radice .. "asteis");  prem3p = p.wiki(radice .. "aron") 
        fut1s = p.wiki(radice .. "aré");  fut2s = p.wiki(radice .. "arás");  fut3s = p.wiki(radice .. "ará")
        fut1p = p.wiki(radice .. "aremos");  fut2p = p.wiki(radice .. "aréis");  fut3p = p.wiki(radice .. "arán") 
        cond1s = p.wiki(radice .. "aría");  cond2s = p.wiki(radice .. "arías");  cond3s = p.wiki(radice .. "aría")
        cond1p = p.wiki(radice .. "aríamos");  cond2p = p.wiki(radice .. "aríais");  cond3p = p.wiki(radice .. "arían") 
        cong1s = p.wiki(radice .. "e"); cong2s = p.wiki(radice .. "es"); cong2sform = p.wiki(radice.. "és"); cong3s = p.wiki(radice .. "e")
        cong1p = p.wiki(radice .. "emos");  cong2p = p.wiki(radice .. "éis");  cong3p = p.wiki(radice .. "en")
        congimp1s_ra = p.wiki(radice .. "ara"); congimp2s_ra = p.wiki(radice.. "aras");  congimp3s_ra = p.wiki(radice .. "ara")
        congimp1p_ra = p.wiki(radice .. "áramos");  congimp2p_ra = p.wiki(radice .. "arais");  congimp3p_ra = p.wiki(radice .. "aran")
        congimp1s_se = p.wiki(radice .. "ase"); congimp2s_se = p.wiki(radice.. "ases");  congimp3s_se = p.wiki(radice .. "ase")
        congimp1p_se = p.wiki(radice .. "ásemos");  congimp2p_se = p.wiki(radice .. "aseis");  congimp3p_se = p.wiki(radice .. "asen")
        congfut1s = p.wiki(radice .. "are"); congfut2s = p.wiki(radice.. "ares");  congfut3s = p.wiki(radice .. "are")
        congfut1p = p.wiki(radice .. "áremos");  congfut2p = p.wiki(radice .. "areis");  congfut3p = p.wiki(radice .. "aren")
        imp2s = p.wiki(radice .. "a");  imp2sform = p.wiki(radice.."á"); imp3s = p.wiki(radice.."e")
        imp1p = p.wiki(radice .. "emos");  imp2p = p.wiki(radice .. "ad");  imp3p = p.wiki(radice.."en") 
        imp2sneg = p.wiki(radice .. "es"); imp2pneg = p.wiki(radice.."éis")
    elseif (type == "er") or (type == "erse") then
    	inf = p.wiki(radice .. "er")
    	ger = p.wiki(radice.."iendo")
    	pp = p.wiki(radice .. "ido"); pplur = p.wiki(radice.."idos")
        pres1s = p.wiki(radice .. "o");  pres2s = p.wiki(radice .. "es"); pres2sform = p.wiki(radice.."és")  pres3s = p.wiki(radice .. "e")
        pres1p = p.wiki(radice .. "emos");  pres2p = p.wiki(radice .. "éis");  pres3p = p.wiki(radice .. "en")        
        imperf1s = p.wiki(radice .. "ía");  imperf2s = p.wiki(radice .. "ías");  imperf3s = p.wiki(radice .. "ía")
        imperf1p = p.wiki(radice .. "íamos");  imperf2p = p.wiki(radice .. "íais");  imperf3p = p.wiki(radice .. "ían") 
        prem1s = p.wiki(radice .. "í");  prem2s = p.wiki(radice .. "iste");  prem3s = p.wiki(radice .. "ió")
        prem1p = p.wiki(radice .. "imos");  prem2p = p.wiki(radice .. "isteis");  prem3p = p.wiki(radice .. "ieron") 
        fut1s = p.wiki(radice .. "eré");  fut2s = p.wiki(radice .. "erás");  fut3s = p.wiki(radice .. "erá")
        fut1p = p.wiki(radice .. "eremos");  fut2p = p.wiki(radice .. "eréis");  fut3p = p.wiki(radice .. "erán") 
        cond1s = p.wiki(radice .. "ería");  cond2s = p.wiki(radice .. "erías");  cond3s = p.wiki(radice .. "ería")
        cond1p = p.wiki(radice .. "eríamos");  cond2p = p.wiki(radice .. "eríais");  cond3p = p.wiki(radice .. "erían") 
        cong1s = p.wiki(radice .. "a"); cong2s = p.wiki(radice .. "as"); cong2sform = p.wiki(radice.. "ás"); cong3s = p.wiki(radice .. "a")
        cong1p = p.wiki(radice .. "amos");  cong2p = p.wiki(radice .. "áis");  cong3p = p.wiki(radice .. "an")
        congimp1s_ra = p.wiki(radice .. "iera"); congimp2s_ra = p.wiki(radice.. "ieras");  congimp3s_ra = p.wiki(radice .. "iera")
        congimp1p_ra = p.wiki(radice .. "iéramos");  congimp2p_ra = p.wiki(radice .. "ierais");  congimp3p_ra = p.wiki(radice .. "ieran")
        congimp1s_se = p.wiki(radice .. "iese"); congimp2s_se = p.wiki(radice.. "ieses");  congimp3s_se = p.wiki(radice .. "iese")
        congimp1p_se = p.wiki(radice .. "iésemos");  congimp2p_se = p.wiki(radice .. "ieseis");  congimp3p_se = p.wiki(radice .. "iesen")
        congfut1s = p.wiki(radice .. "iere"); congfut2s = p.wiki(radice.. "ieres");  congfut3s = p.wiki(radice .. "iere")
        congfut1p = p.wiki(radice .. "iéremos");  congfut2p = p.wiki(radice .. "iereis");  congfut3p = p.wiki(radice .. "ieren")
        imp2s = p.wiki(radice .. "e");  imp2sform = p.wiki(radice.."é"); imp3s = p.wiki(radice.."a")
        imp1p = p.wiki(radice .. "amos");  imp2p = p.wiki(radice .. "ed");  imp3p = p.wiki(radice.."an") 
        imp2sneg = p.wiki(radice .. "as"); imp2pneg = p.wiki(radice.. "áis")
    elseif (type == "ir") or (type == "irse") then
    	inf = p.wiki(radice .. "ir")
    	ger = p.wiki(radice.."iendo")
    	pp = p.wiki(radice .. "ido"); pplur = p.wiki(radice.."idos")
        pres1s = p.wiki(radice .. "o");  pres2s = p.wiki(radice .. "es"); pres2sform = p.wiki(radice.."ís")  pres3s = p.wiki(radice .. "e")
        pres1p = p.wiki(radice .. "imos");  pres2p = p.wiki(radice .. "ís");  pres3p = p.wiki(radice .. "en")        
        imperf1s = p.wiki(radice .. "ía");  imperf2s = p.wiki(radice .. "ías");  imperf3s = p.wiki(radice .. "ía")
        imperf1p = p.wiki(radice .. "íamos");  imperf2p = p.wiki(radice .. "íais");  imperf3p = p.wiki(radice .. "ían") 
        prem1s = p.wiki(radice .. "í");  prem2s = p.wiki(radice .. "iste");  prem3s = p.wiki(radice .. "ió")
        prem1p = p.wiki(radice .. "imos");  prem2p = p.wiki(radice .. "isteis");  prem3p = p.wiki(radice .. "ieron") 
        fut1s = p.wiki(radice .. "iré");  fut2s = p.wiki(radice .. "irás");  fut3s = p.wiki(radice .. "irá")
        fut1p = p.wiki(radice .. "iremos");  fut2p = p.wiki(radice .. "iréis");  fut3p = p.wiki(radice .. "irán") 
        cond1s = p.wiki(radice .. "iría");  cond2s = p.wiki(radice .. "irías");  cond3s = p.wiki(radice .. "iría")
        cond1p = p.wiki(radice .. "iríamos");  cond2p = p.wiki(radice .. "iríais");  cond3p = p.wiki(radice .. "irían") 
        cong1s = p.wiki(radice .. "a"); cong2s = p.wiki(radice .. "as"); cong2sform = p.wiki(radice.. "ás"); cong3s = p.wiki(radice .. "a")
        cong1p = p.wiki(radice .. "amos");  cong2p = p.wiki(radice .. "áis");  cong3p = p.wiki(radice .. "an")
        congimp1s_ra = p.wiki(radice .. "iera"); congimp2s_ra = p.wiki(radice.. "ieras");  congimp3s_ra = p.wiki(radice .. "iera")
        congimp1p_ra = p.wiki(radice .. "iéramos");  congimp2p_ra = p.wiki(radice .. "ierais");  congimp3p_ra = p.wiki(radice .. "ieran")
        congimp1s_se = p.wiki(radice .. "iese"); congimp2s_se = p.wiki(radice.. "ieses");  congimp3s_se = p.wiki(radice .. "iese")
        congimp1p_se = p.wiki(radice .. "iésemos");  congimp2p_se = p.wiki(radice .. "ieseis");  congimp3p_se = p.wiki(radice .. "iesen")
        congfut1s = p.wiki(radice .. "iere"); congfut2s = p.wiki(radice.. "ieres");  congfut3s = p.wiki(radice .. "iere")
        congfut1p = p.wiki(radice .. "iéremos");  congfut2p = p.wiki(radice .. "iereis");  congfut3p = p.wiki(radice .. "ieren")
        imp2s = p.wiki(radice .. "e");  imp2sform = p.wiki(radice.."í"); imp3s = p.wiki(radice.."a")
        imp1p = p.wiki(radice .. "amos");  imp2p = p.wiki(radice .. "id");  imp3p = p.wiki(radice.."an") 
        imp2sneg = p.wiki(radice .. "as"); imp2pneg = p.wiki(radice.. "áis")
    else error("Verb type " .. type .. "not supported.")
    end
    
--sistema automaticamente le particolarità della prima coniugazione
	if type == "ar" or type == "arse" then
--VERBI IN -CAR: la -c- diventa qu davanti alle uscite in -e
		if mw.ustring.sub(radice, -1) == "c" then
			radice2 = mw.ustring.sub(radice, 1, -2).. "qu"
			prem1s = p.wiki(radice2.. "é")
			cong1s = p.wiki(radice2 .. "e"); cong2s = p.wiki(radice2 .. "es"); cong2sform = p.wiki(radice2.. "és"); cong3s = p.wiki(radice2 .. "e")
        	cong1p = p.wiki(radice2 .. "emos");  cong2p = p.wiki(radice2 .. "éis");  cong3p = p.wiki(radice2 .. "en")
    		imp3s = p.wiki(radice2.."e")
        	imp1p = p.wiki(radice2 .. "emos");  imp3s = p.wiki(radice2.."en") 
        end
    end
-- Determina se il verbo è riflessivo 
	if type == "arse" or type == "erse" or type == "irse" then refl = true else	refl = false end
		
-- Genera le voci verbali specifiche per i verbi riflessivi
	if type == "arse" then
		refl = true
		inf = p.wiki(radice.. "arse")

	elseif type == "erse" then
		refl = true
		inf = p.wiki(radice.. "erse")

	elseif type == "irse" then
		refl = true
		inf = p.wiki(radice.. "irse")
	end
		
-- Genera i pronomi riflessivi
    if refl == true then
		me = "me "; te = "te "; se = "se "; nos = "nos "; os = "os "
	end
	
--genera il link ai riflessivi
	if refl == false then
		if mw.title.new("Appendice:Coniugazioni/Spagnolo/".. titolo.. "se").exists == true then
			refl_exist = true; refl_link = p.wiki(titolo.. "se"); refl_conjlink = " ([[Appendice:Coniugazioni/Spagnolo/".. titolo.. "se|coniugazione]])" --se esiste il riflessivo, genera link al verbo in ns0 e alla relativa coniugazione in appendice
		else
			refl_exist = false; refl_link = ""; refl_conjlink = "" --se non esiste il riflessivo, annulla i link
		end
	elseif refl == true then
		infattivo = mw.ustring.sub(titolo, 1, -3) --l'infinito del verbo attivo, uguale al titolo senza il "se" alla fine
		if mw.title.new("Appendice:Coniugazioni/Spagnolo/".. infattivo).exists == true then
			refl_exist = true; refl_link = p.wiki(infattivo); refl_conjlink = " ([[Appendice:Coniugazioni/Spagnolo/".. infattivo.. "|coniugazione]])" --se esiste il verbo attivo, genera link al verbo in ns0 e alla relativa coniugazione in appendice
		else
			refl_exist = false; refl_link = ""; refl_conjlink = "" --se non esiste il verbo attivo, annulla i link
		end
	end
	
-- Recupera le eventuali forme irregolari o varianti, rimpiazziandole o aggiungendole a quelle standard
-- Forme impersonali e participi
    inf = p.over(inf,args["inf"])
    ger = p.over(ger,args["ger"])
    ger2 = p.wiki(args["ger2"])
    ger = p.alts(ger, ger2)
    pp = p.over(pp,args["pp"])
    pp2 = p.wiki(args["pp2"]);  pp3 = p.wiki(args["pp3"]);  pp3 = p.wiki(args["pp3"]);  pp4 = p.wiki(args["pp4"]);  pp5 = p.wiki(args["pp5"])
    pp = p.alts(pp, pp2); pp = p.alts(pp, pp3); pp = p.alts(pp, pp4); pp = p.alts(pp, pp5)
-- Presente indicativo
    pres1s = p.over(pres1s,args["pres1s"]); pres2s = p.over(pres2s,args["pres2s"]); pres2sform = p.over(pres2sform,args["pres2sform"]); pres3s = p.over(pres3s,args["pres3s"])
    pres1p = p.over(pres1p,args["pres1p"]); pres2p = p.over(pres2p,args["pres2p"]); pres3p = p.over(pres3p,args["pres3p"])
    pres1s2 = p.wiki(args["pres1s2"]);  pres2s2 = p.wiki(args["pres2s2"]);  pres3s2 = p.wiki(args["pres3s2"])
    pres1p2 = p.wiki(args["pres1p2"]);  pres2p2 = p.wiki(args["pres2p2"]);  pres3p2 = p.wiki(args["pres3p2"])
    pres1s = p.alts(pres1s, pres1s2); pres2s = p.alts(pres2s, pres2s2); pres3s = p.alts(pres3s, pres3s2) 
    pres1p = p.alts(pres1p, pres1p2); pres2p = p.alts(pres2p, pres2p2); pres3p = p.alts(pres3p, pres3p2)     
-- Imperfetto
    imperf1s = p.over(imperf1s,args["imperf1s"]); imperf2s = p.over(imperf2s,args["imperf2s"]); imperf3s = p.over(imperf3s,args["imperf3s"])
    imperf1p = p.over(imperf1p,args["imperf1p"]); imperf2p = p.over(imperf2p,args["imperf2p"]); imperf3p = p.over(imperf3p,args["imperf3p"])
    imperf1s2 = p.wiki(args["imperf1s2"]);  imperf2s2 = p.wiki(args["imperf2s2"]);  imperf3s2 = p.wiki(args["imperf3s2"])
    imperf1p2 = p.wiki(args["imperf1p2"]);  imperf2p2 = p.wiki(args["imperf2p2"]);  imperf3p2 = p.wiki(args["imperf3p2"])
    imperf1s = p.alts(imperf1s, imperf1s2); imperf2s = p.alts(imperf2s, imperf2s2); imperf3s = p.alts(imperf3s, imperf3s2)
    imperf1p = p.alts(imperf1p, imperf1p2); imperf2p = p.alts(imperf2p, imperf2p2); imperf3p = p.alts(imperf3p, imperf3p2)
-- Preterito (Passato REMoto)
    prem1s = p.over(prem1s,args["prem1s"]); prem2s = p.over(prem2s,args["prem2s"]); prem3s = p.over(prem3s,args["prem3s"])
    prem1p = p.over(prem1p,args["prem1p"]); prem2p = p.over(prem2p,args["prem2p"]); prem3p = p.over(prem3p,args["prem3p"])
    prem1s = p.alts(prem1s, prem1s2); prem2s = p.alts(prem2s, prem2s2); prem3s = p.alts(prem3s, prem3s2)
    prem1p = p.alts(prem1p, prem1p2); prem2p = p.alts(prem2p, prem2p2); prem3p = p.alts(prem3p, prem3p2)
-- Futuro
    fut1s = p.over(fut1s,args["fut1s"]); fut2s = p.over(fut2s,args["fut2s"]); fut3s = p.over(fut3s,args["fut3s"])
    fut1p = p.over(fut1p,args["fut1p"]); fut2p = p.over(fut2p,args["fut2p"]); fut3p = p.over(fut3p,args["fut3p"])
    fut1s2 = p.wiki(args["fut1s2"]);  fut2s2 = p.wiki(args["fut2s2"]);  fut3s2 = p.wiki(args["fut3s2"])
    fut1p2 = p.wiki(args["fut1p2"]);  fut2p2 = p.wiki(args["fut2p2"]);  fut3p2 = p.wiki(args["fut3p2"])
    fut1s = p.alts(fut1s, fut1s2); fut2s = p.alts(fut2s, fut2s2); fut3s = p.alts(fut3s, fut3s2)
    fut1p = p.alts(fut1p, fut1p2); fut2p = p.alts(fut2p, fut2p2); fut3p = p.alts(fut3p, fut3p2)
-- Condizionale
    cond1s = p.over(cond1s,args["cond1s"]); cond2s = p.over(cond2s,args["cond2s"]); cond3s = p.over(cond3s,args["cond3s"])
    cond1p = p.over(cond1p,args["cond1p"]); cond2p = p.over(cond2p,args["cond2p"]); cond3p = p.over(cond3p,args["cond3p"])
    cond1s2 = p.wiki(args["cond1s2"]);  cond2s2 = p.wiki(args["cond2s2"]);  cond3s2 = p.wiki(args["cond3s2"])
    cond1p2 = p.wiki(args["cond1p2"]);  cond2p2 = p.wiki(args["cond2p2"]);  cond3p2 = p.wiki(args["cond3p2"])
    cond1s = p.alts(cond1s, cond1s2); cond2s = p.alts(cond2s, cond2s2); cond3s = p.alts(cond3s, cond3s2)
    cond1p = p.alts(cond1p, cond1p2); cond2p = p.alts(cond2p, cond2p2); cond3p = p.alts(cond3p, cond3p2)
-- Presente congiuntivo
    cong1s = p.over(cong1s,args["cong1s"]); cong2s = p.over(cong2s,args["cong2s"]); cong3s = p.over(cong3s,args["cong3s"])
    cong1p = p.over(cong1p,args["cong1p"]); cong2p = p.over(cong2p,args["cong2p"]); cong3p = p.over(cong3p,args["cong3p"])
    cong1s2 = p.wiki(args["cong1s2"]); cong2s2 = p.wiki(args["cong2s2"]); cong3s2 = p.wiki(args["cong3s2"])
    cong1p2 = p.wiki(args["cong1p2"]);  cong2p2 = p.wiki(args["cong2p2"]);  cong3p2 = p.wiki(args["cong3p2"])
    cong1s = p.alts(cong1s, cong1s2); cong2s = p.alts(cong2s, cong2s2) cong3s = p.alts(cong3s, cong3s2)
    cong1p = p.alts(cong1p, cong1p2); cong2p = p.alts(cong2p, cong2p2); cong3p = p.alts(cong3p, cong3p2)
-- Imperfetto congiuntivo
    congimp1s = p.over(congimp1s,args["congimp1s"]); congimp2s = p.over(congimp2s,args["congimp2s"]); congimp3s = p.over(congimp3s,args["congimp3s"])
    congimp1p = p.over(congimp1p,args["congimp1p"]); congimp2p = p.over(congimp2p,args["congimp2p"]); congimp3p = p.over(congimp3p,args["congimp3p"])
    congimp1s2 = p.wiki(args["congimp1s2"]); congimp2s2 = p.wiki(args["congimp2s2"]);  congimp3s2 = p.wiki(args["congimp3s2"])
    congimp1p2 = p.wiki(args["congimp1p2"]);  congimp2p2 = p.wiki(args["congimp2p2"]);  congimp3p2 = p.wiki(args["congimp3p2"])
    congimp1s = p.alts(congimp1s, congimp1s2); congimp2s = p.alts(congimp2s, congimp2s2); congimp3s = p.alts(congimp3s, congimp3s2)
    congimp1p = p.alts(congimp1p, congimp1p2); congimp2p = p.alts(congimp2p, congimp2p2); congimp3p = p.alts(congimp3p, congimp3p2)    
-- Imperativo
	imp2s = p.over(imp2s,args["imp2s"]); imp3s = p.over(imp3s,args["imp3s"])
    imp1p = p.over(imp1p,args["imp1p"]); imp2p = p.over(imp2p,args["imp2p"]); imp3p = p.over(imp3p,args["imp3p"])
    imp2s2 = p.over(imp2s2, args["imp2s2"]);  imp3s2 = p.wiki(args["imp3s2"])
    imp1p2 = p.wiki(args["imp1p2"]);  imp2p2 = p.wiki(args["imp2p2"]);  imp3p2 = p.wiki(args["imp3p2"])
    imp2s = p.alts(imp2s, imp2s2); imp3s = p.alts(imp3s, imp3s2)
    imp1p = p.alts(imp1p, imp1p2); imp2p = p.alts(imp2p, imp2p2); imp3p = p.alts(imp3p, imp3p2)
-- Alternativa extra per l'imperativo
     imp2s3 = p.over(imp2s3, args["imp2s3"]); imp2s = p.alts(imp2s, imp2s3)
     
--cerca se uno qualsiasi dei parametri è definito, e in base a questo definisce la stringa reg_irreg come "irregolare" o "regolare"
    if 
	    args["inf"] ~= nil or args["ger"] ~= nil or args["par"] ~= nil or args["pp"] ~= nil
	    or args["pres1s"] ~= nil or args["pres1s2"] ~= nil or args["pres2s"] ~= nil or args["pres3s"] ~= nil or args["pres1p"] ~= nil or args["pres2p"] ~= nil or args["pres3p"] ~= nil
	    or args["imperf1s"] ~= nil or args["imperf2s"] ~= nil or args["imperf3s"] ~= nil or args["imperf1p"] ~= nil or args["imperf2p"] ~= nil or args["imperf3p"] ~= nil
	    or args["prem1s"] ~= nil or args["prem1s2"] ~= nil or args["prem2s"] ~= nil or args["prem3s"] ~= nil or args["prem3s2"] ~= nil or args["prem1p"] ~= nil or args["prem2p"] ~= nil or args["prem3p"] ~= nil or args["prem3p2"] ~= nil
	    or args["fut1s"] ~= nil or args["fut2s"] ~= nil or args["fut3s"] ~= nil or args["fut1p"] ~= nil or args["fut2p"] ~= nil or args["fut3p"] ~= nil
	    or args["cond1s"] ~= nil or args["cond2s"] ~= nil or args["cond3s"] ~= nil or args["cond1p"] ~= nil or args["cond2p"] ~= nil or args["cond3p"] ~= nil
	    or args["cong1s"] ~= nil or args["cong2s"] ~= nil or args["cong3s"] ~= nil or args["cong1p"] ~= nil or args["cong2p"] ~= nil or args["cong3p"] ~= nil
	    or args["imp1s"] ~= nil or args["imp2s"] ~= nil or args["imp3s"] ~= nil or args["imp1p"] ~= nil or args["imp2p"] ~= nil or args["imp3p"] ~= nil
	    or args["imp2s2"] ~= nil or args["imp2s3"] ~= nil or args["imp3s"] ~= nil or args["imp1p"] ~= nil or args["imp2p"] ~= nil or args["imp3p"] ~= nil
    then 
    	if args["irregolare"] == "no" then
    		irregolaredescr = ""; reg_irreg = " regolari "
    	else
    		irregolaredescr = " '''(irregolare)'''"; reg_irreg = " irregolari "
		end
    else --se nessun parametro è definito...
    		irregolaredescr = ""; reg_irreg = " regolari "
	end

--in base alla desinenza "type", costruisce la descizione e aggiunge le categorie
    if type == "ar" then
    		conjdescr = "'''verbo di prima coniugazione'''"; conjcat = categorizza("Coniugazioni dei verbi di prima coniugazione in spagnolo",titolo)
    		irregolarecat = categorizza("Coniugazioni dei verbi".. reg_irreg.. "in spagnolo",titolo).." "..categorizza("Coniugazioni dei verbi".. reg_irreg.. "di prima coniugazione in spagnolo",titolo)
    elseif type == "er" then
    		conjdescr = "'''verbo di seconda coniugazione'''"; conjcat = categorizza("Coniugazioni dei verbi di seconda coniugazione in spagnolo", titolo)
    		irregolarecat = categorizza("Coniugazioni dei verbi".. reg_irreg.. "in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi".. reg_irreg.. "di seconda coniugazione in spagnolo", titolo)
    elseif type == "ir" then
    		conjdescr = "'''verbo di terza coniugazione'''"; conjcat = categorizza("Coniugazioni dei verbi di terza coniugazione in spagnolo", titolo)
    		irregolarecat = categorizza("Coniugazioni dei verbi".. reg_irreg.. "in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi".. reg_irreg.. "di terza coniugazione in spagnolo", titolo)
    elseif type == "arse" then
    		conjdescr = "'''verbo riflessivo pronominale di prima coniugazione'''"; conjcat = categorizza("Coniugazioni dei verbi di prima coniugazione in spagnolo",titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali di prima coniugazione in spagnolo", titolo)
    		irregolarecat = categorizza("Coniugazioni dei verbi".. reg_irreg.. "in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi".. reg_irreg.. "di prima coniugazione in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali".. reg_irreg.. "in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali".. reg_irreg.. "di prima coniugazione in spagnolo", titolo)
    		irregolarecat = categorizza("Coniugazioni dei verbi".. reg_irreg.. "in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi".. reg_irreg.. "di prima coniugazione in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali".. reg_irreg.. "in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali".. reg_irreg.. "di prima coniugazione in spagnolo", titolo)
    elseif type == "erse" then
    		conjdescr = "'''verbo riflessivo pronominale di seconda coniugazione'''"; conjcat = categorizza("Coniugazioni dei verbi di seconda coniugazione in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali di seconda coniugazione in spagnolo", titolo)
    		irregolarecat = categorizza("Coniugazioni dei verbi".. reg_irreg.. "in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi".. reg_irreg.. "di seconda coniugazione in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali".. reg_irreg.. "in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali".. reg_irreg.. "di seconda coniugazione in spagnolo", titolo)
    elseif type == "irse" then
    		conjdescr = "'''verbo riflessivo pronominale di terza coniugazione'''"; conjcat = categorizza("Coniugazioni dei verbi di terza coniugazione in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali in spagnolo", titolo).." "..categorizza("Coniugazioni dei verbi riflessivi pronominali di terza coniugazione in spagnolo", titolo)
    end
    		
--stringa "descrizione", raggruppa tutte le stringhe definite prima per la descrizione e le categorie della coniugazione, regolari/irregolari e riflessivi
	descrizione = categorizza("Coniugazioni in spagnolo", titolo).. conjdescr.. conjcat.. irregolaredescr.. irregolarecat
	
--tempi composti
	if args["pp"] ~= nil then pplur = "[[".. args["pp"].. "s]]" end
	if pp2 >= "a" then pplur2 = "[[".. args["pp2"].. "s]]" else pplur2 = "0" end
    pplur = p.alts(pplur, pplur2)
   	ausiliare = "[[haber#Spagnolo|haber]]"
		if pp ~= "" then
	    --passato prossimo (pretérito perfecto)
	    	paspros1s = "[[he#Spagnolo|he]] ".. pp; paspros2s = "[[has#Spagnolo|has]] ".. pp; paspros3s = "[[ha#Spagnolo|ha]] ".. pp
	    	paspros1p = "[[hemos#Spagnolo|hemos]] ".. pp; paspros2p = "[[habéis#Spagnolo|habéis]] ".. pp; paspros3p = "[[han#Spagnolo|han]] ".. pp
	    --trapassato prossimo (pretérito pluscuamperfecto)
	    	trappros1s = "[[había#Spagnolo|había]] ".. pp; trappros2s = "[[habías#Spagnolo|habías]] ".. pp; trappros3s = "[[había#Spagnolo|había]] ".. pp
	    	trappros1p = "[[habíamos#Spagnolo|habíamos]] ".. pp; trappros2p = "[[habíais#Spagnolo|habíais]] ".. pp; trappros3p = "[[habían#Spagnolo|habían]] ".. pp
	    --trapassato remoto (pretérito anterior)
			traprem1s = "[[hube#Spagnolo|hube]] ".. pp; traprem2s = "[[hubiste#Spagnolo|hubiste]] ".. pp; traprem3s = "[[hubo#Spagnolo|hubo]] ".. pp
	    	traprem1p = "[[hubimos#Spagnolo|hubimos]] ".. pp; traprem2p = "[[hubisteis#Spagnolo|hubisteis]] ".. pp; traprem3p = "[[hubieron#Spagnolo|hubieron]] ".. pp
	   --futuro anteriore (futuro compuesto)
			futant1s = "[[habré#Spagnolo|habré]] ".. pp; futant2s = "[[habrás#Spagnolo|habrás]] ".. pp; futant3s = "[[habrá#Spagnolo|habrá]] ".. pp
	    	futant1p = "[[habremos#Spagnolo|habremos]] ".. pp; futant2p = "[[habréis#Spagnolo|habréis]] ".. pp; futant3p = "[[habrán#Spagnolo|habrán]] ".. pp    	
	    --condizionale passato (potencial compuesto)
			condpas1s = "[[habría#Spagnolo|habría]] ".. pp; condpas2s = "[[habrías#Spagnolo|habrías]] ".. pp; condpas3s = "[[habría#Spagnolo|habría]] ".. pp
	    	condpas1p = "[[habríamos#Spagnolo|habríamos]] ".. pp; condpas2p = "[[habríais#Spagnolo|habríais]] ".. pp; condpas3p = "[[habrían#Spagnolo|habrían]] ".. pp  
	--congiuntivo passato (subjunctivo pretérito perfecto)
			congpas1s = "[[haya#Spagnolo|haya]] ".. pp; congpas2s = "[[hayas#Spagnolo|hayas]] ".. pp; congpas2sform = "[[hayás#Spagnolo|hayas]]".. pp; congpas3s = "[[haya#Spagnolo|haya]] ".. pp
	    	congpas1p = "[[hayamos#Spagnolo|hayamos]] ".. pp; congpas2p = "[[hayáis#Spagnolo|hayáis]] ".. pp; congpas3p = "[[hayan#Spagnolo|hayan]] ".. pp     
	--congiuntivo trapassato (subjunctivo pretérito pluscuamperfecto)
			congtrap1s = "[[hubiera#Spagnolo|hubiera]]/[[hubiese#Spagnolo|hubiese]] ".. pp; congtrap2s = "[[hubieras#Spagnolo|hubieras]]/[[hubieses#Spagnolo|hubieses]] ".. pp; congtrap3s = "[[hubiera#Spagnolo|hubiera]]/[[hubiese#Spagnolo|hubiese]] ".. pp
	    	congtrap1p = "[[hubiéramos#Spagnolo|hubiéramos]]/[[hubiésemos#Spagnolo|hubiésemos]] ".. pp; congtrap2p = "[[hubierais#Spagnolo|hubierais]]/[[hubieseis#Spagnolo|hubieseis]] ".. pp; congtrap3p = "[[hubieran#Spagnolo|hubieran]]/[[hubiesen#Spagnolo|hubiesen]] ".. pp 
	--congiuntivo futuro anteriore (subjunctivo futuro compuesto)
			congfutant1s = "[[hubiere#Spagnolo|hubiere]] ".. pp; congfutant2s = "[[hubieres#Spagnolo|hubieres]] ".. pp; congfutant3s = "[[hubiere#Spagnolo|hubiere]] ".. pp
	    	congfutant1p = "[[hubiéremos#Spagnolo|hubiéremos]] ".. pp; congfutant2p = "[[hubiereis#Spagnolo|hubiereis]] ".. pp; congfutant3p = "[[hubieren#Spagnolo|hubieren]] ".. pp     
		end
		
-- Genera i titolo dei cassetti per i tempi composti
    if pp == "" then
    	paspros = "manca dei tempi composti"; trappros = "manca dei tempi composti"; traprem = "manca dei tempi composti"; futant = "manca dei tempi composti"; condpas = "manca dei tempi composti"; congpas = "manca dei tempi composti"; congtrap = "manca dei tempi composti"; congfutant = "manca dei tempi composti"
    else
    	paspros = "ausiliare ''" .. ausiliare .. "'' coniugato all'indicativo presente seguito dal participio passato"
    	trappros = "ausiliare ''" .. ausiliare .. "'' coniugato all'indicativo imperfetto seguito dal participio passato"
    	traprem = "ausiliare ''" .. ausiliare .. "'' coniugato all'indicativo passato remoto seguito dal participio passato"
    	futant = "ausiliare ''" .. ausiliare .. "'' coniugato all'indicativo futuro seguito dal participio passato"
    	condpas = "ausiliare ''" .. ausiliare .. "'' coniugato al condizionale presente seguito dal participio passato"
    	congpas = "ausiliare ''" .. ausiliare .. "'' coniugato al congiuntivo presente seguito dal participio passato"
    	congtrap = "ausiliare ''" .. ausiliare .. "'' coniugato al congiuntivo imperfetto seguito dal participio passato"
    	congfutant = "ausiliare ''" .. ausiliare .. "'' coniugato al congiuntivo futuro seguito dal participio passato"
    end
    
-- Costruisce la tabella di coniugazione
    conj = '{| style="background:#F0F0F0;border-collapse:separate;border-spacing:2px" class="inflection-table"\n'
    conj = conj .. '|-\n'
    conj = conj .. '| colspan="8" style="background:#ffe4c4; text-align:center" | ' .. descrizione .. '\n'
    conj = conj .. '|-\n'     
    if refl_exist == true then --se esiste il riflessivo pronominale del verbo, o se il verbo È riflessivo, fa spazio in tabella per aggiungere i relativi link generati precedentemente
    	conj = conj .. '! colspan="1" style="background:#e2e4c0" | infinito\n'
    	conj = conj .. '| colspan="2" | ' .. inf .. '\n'
    		if refl == true then --ulteriore variabile, se il verbo è riflessivo la dicitura della casella è "forma attiva", se no "riflessivo pronominale"
    			conj = conj .. '! colspan="2" style="background:#e2e4c0" | foma attiva\n' 
    		else
    			conj = conj .. '! colspan="2" style="background:#e2e4c0" | riflessivo pronominale\n'
    		end
    	conj = conj .. '| colspan="2" | ' .. refl_link .. refl_conjlink.. '\n'
    	conj = conj .. '|-\n'
    else --se non esiste il riflessivo, la relativa cella si toglie di torno
		conj = conj .. '! colspan="1" style="background:#e2e4c0" | infinito</br><small>infinitivo</small>\n'
    	conj = conj .. '| colspan="1" | ' .. inf .. '\n'
    	conj = conj .. '|-\n'
    end
    conj = conj .. '! colspan="1" style="background:#e2e4c0" | gerundio</br><small>gerundio</small>\n'
    conj = conj .. '| colspan="3" | ' .. ger .. '\n'
    conj = conj .. '|-\n' 
    conj = conj .. '! colspan="1" style="background:#e2e4c0" | participio passato</br><small>participio</small>\n'
    conj = conj .. '| colspan="3" | ' .. pp .. '\n'
    conj = conj .. '|-\n'
    conj = conj .. '|-\n! colspan="1" rowspan="2" style="background:#C0C0C0" | persona\n'
    conj = conj .. '! colspan="3" style="background:#C0C0C0" | singolare\n'
    conj = conj .. '! colspan="3" style="background:#C0C0C0" | plurale\n'
    conj = conj .. '|-\n! style="background:#C0C0C0;width:12.5%" | prima\n'
    conj = conj .. '! style="background:#C0C0C0;width:12.5%" | seconda\n'
    conj = conj .. '! style="background:#C0C0C0;width:12.5%" | terza\n'
    conj = conj .. '! style="background:#C0C0C0;width:12.5%" | prima\n'
    conj = conj .. '! style="background:#C0C0C0;width:12.5%" | seconda\n'
    conj = conj .. '! style="background:#C0C0C0;width:12.5%" | terza\n'
    conj = conj .. '|-\n! style="background:#c0cfe4" colspan="1" | indicativo</br><small>indicativo</small>\n'
    conj = conj .. '! style="background:#c0cfe4" | yo\n'
    conj = conj .. '! style="background:#c0cfe4" | tú</br>vos\n'
    conj = conj .. '! style="background:#c0cfe4" | él/ella</br>usted\n'
    conj = conj .. '! style="background:#c0cfe4" | nosotros</br>nosotras\n'
    conj = conj .. '! style="background:#c0cfe4" | vosotros</br>vosotras\n'
    conj = conj .. '! style="background:#c0cfe4" | ellos/ellas</br>ustedes\n|-\n'
    conj = conj .. '! style="height:3em;background:#c0cfe4" colspan="1" | presente</br><small>presente</small>\n'
    conj = conj .. '|' .. me .. pres1s .. '\n|' .. te .. pres2s .." <sup><small>tú</small></sup></br>".. te .. pres2sform .." <sup><small>vos</small></sup>".. '\n|' .. se .. pres3s .. '\n|' .. nos .. pres1p .. '\n|' .. os .. pres2p .. '\n|' .. se .. pres3p .. '\n'
    conj = conj .. '|-\n! style="height:3em;background:#c0cfe4" colspan="1" | imperfetto</br><small>pretérito imperfecto o copretérito</small>\n'
    conj = conj .. '|' .. me .. imperf1s .. '\n|' .. te .. imperf2s .. '\n|' .. se .. imperf3s .. '\n|' .. nos .. imperf1p .. '\n|' .. os .. imperf2p .. '\n|' .. se .. imperf3p .. '\n'
    conj = conj .. '|-\n! style="height:3em;background:#c0cfe4" colspan="1" | preterito</br><small>pretérito indefinito</small>\n'
    conj = conj .. '|' .. me .. prem1s .. '\n|' .. te .. prem2s .. '\n|' .. se .. prem3s .. '\n|' .. nos .. prem1p .. '\n|' .. os .. prem2p .. '\n|' .. se .. prem3p .. '\n'
    conj = conj .. '|-\n! style="height:3em;background:#c0cfe4" colspan="1" | futuro</br><small>futuro</small>\n'
    conj = conj .. '|' .. me .. fut1s .. '\n|' .. te .. fut2s .. '\n|' .. se .. fut3s .. '\n|' .. nos .. fut1p .. '\n|' .. os .. fut2p .. '\n|' .. se .. fut3p .. '\n'
    conj = conj .. '|-\n! style="height:3em;background:#c0cfe4" colspan="1" | condizionale</br><small>potencial o condicional</small>\n'
    conj = conj .. '|' .. me .. cond1s .. '\n|' .. te .. cond2s .. '\n|' .. se .. cond3s .. '\n|' .. nos .. cond1p .. '\n|' .. os .. cond2p .. '\n|' .. se .. cond3p .. '\n'
    conj = conj .. '|-\n! style="height:3em;background:#c0cfe4" colspan="1" | passato prossimo</br><small>pretérito perfecto o antepresente</small>\n'
    conj = conj .. '| style="background:#F0F0F0" colspan="6" | <div class="NavFrame" style="border:0"><div class="NavHead">'.. paspros.. '</div><div class="NavContent">\n {| style="background:#F0F0F0;border-collapse:separate;border-spacing:2px;width:100%" class="inflection-table" \n |- \n | ' .. me .. paspros1s .. '||' .. te .. paspros2s .. '||' .. se .. paspros3s .. '||' .. nos .. paspros1p .. '||' .. os .. paspros2p .. '\n|' .. se .. paspros3p .. '\n |- \n |}</div></div>\n'
    conj = conj .. '|-\n! style="height:3em;background:#c0cfe4" colspan="1" | trapassato prossimo</br><small>pretérito pluscuamperfecto o antecopretérito</small>\n'
    conj = conj .. '| style="background:#F0F0F0" colspan="6" | <div class="NavFrame" style="border:0"><div class="NavHead">'.. trappros.. '</div><div class="NavContent">\n {| style="background:#F0F0F0;border-collapse:separate;border-spacing:2px;width:100%" class="inflection-table" \n |- \n | ' .. me .. trappros1s .. '\n|' .. te .. trappros2s .. '\n|' .. se .. trappros3s .. '\n|' .. nos .. trappros1p .. '\n|' .. os .. trappros2p .. '\n|' .. se .. trappros3p .. '\n |- \n |}</div></div>\n'
    conj = conj .. '|-\n! style="height:3em;background:#c0cfe4" colspan="1" | trapassato remoto</br><small>pretérito anterior o antepréterito</small>\n'
    conj = conj .. '| style="background:#F0F0F0" colspan="6" | <div class="NavFrame" style="border:0"><div class="NavHead">'.. traprem.. '</div><div class="NavContent">\n {| style="background:#F0F0F0;border-collapse:separate;border-spacing:2px;width:100%" class="inflection-table" \n |- \n | ' .. me .. traprem1s .. '\n|' .. te .. traprem2s .. '\n|' .. se .. traprem3s .. '\n|' .. nos .. traprem1p .. '\n|' .. os .. traprem2p .. '\n|' .. se .. traprem3p .. '\n |- \n |}</div></div>\n'
    conj = conj .. '|-\n! style="height:3em;background:#c0cfe4" colspan="1" | futuro anteriore</br><small>futuro compuesto o perfecto</small>\n'
    conj = conj .. '| style="background:#F0F0F0" colspan="6" | <div class="NavFrame" style="border:0"><div class="NavHead">'.. futant.. '</div><div class="NavContent">\n {| style="background:#F0F0F0;border-collapse:separate;border-spacing:2px;width:100%" class="inflection-table" \n |- \n | ' .. me .. futant1s .. '\n|' .. te .. futant2s .. '\n|' .. se .. futant3s .. '\n|' .. nos .. futant1p .. '\n|' .. os .. futant2p .. '\n|' .. se .. futant3p .. '\n |- \n |}</div></div>\n'
    conj = conj .. '|-\n! style="height:3em;background:#c0cfe4" colspan="1" | condizionale passato</br><small>potencial o condicional compuesto</small>\n'
    conj = conj .. '| style="background:#F0F0F0" colspan="6" | <div class="NavFrame" style="border:0"><div class="NavHead">'.. condpas.. '</div><div class="NavContent">\n {| style="background:#F0F0F0;border-collapse:separate;border-spacing:2px;width:100%" class="inflection-table" \n |- \n | ' .. me .. condpas1s .. '\n|' .. te .. condpas2s .. '\n|' .. se .. condpas3s .. '\n|' .. nos .. condpas1p .. '\n|' .. os .. condpas2p .. '\n|' .. se .. condpas3p .. '\n |- \n |}</div></div>\n'
    conj = conj .. '|-\n! style="background:#c0e4c0" colspan="1" | congiuntivo</br><small>subjuntivo</small>\n'
    conj = conj .. '! style="background:#c0e4c0" | yo\n'
    conj = conj .. '! style="background:#c0e4c0" | tú</br>vos\n'
    conj = conj .. '! style="background:#c0e4c0" | él/ella</br>usted\n'
    conj = conj .. '! style="background:#c0e4c0" | nosotros</br>nosotras\n'
    conj = conj .. '! style="background:#c0e4c0" | vosotros</br>vosotras\n'
    conj = conj .. '! style="background:#c0e4c0" | ellos/ellas</br>ustedes\n|-\n'
    conj = conj .. '! style="height:3em;background:#c0e4c0" | presente</br><small>presente</small>\n'
    conj = conj .. '|' .. me .. cong1s .. '\n|' .. te .. cong2s .." <sup><small>tú</small></sup></br>".. te .. cong2sform .." <sup><small>vos</small></sup>".. '\n|' .. se .. cong3s .. '\n|' .. nos .. cong1p .. '\n|' .. os .. cong2p .. '\n|' .. se .. cong3p .. '\n'   
    conj = conj .. '|-\n! style="height:3em;background:#c0e4c0" rowspan="2" | imperfetto</br><small>imperfecto o copretérito</small>\n'
    conj = conj .. '|' .. me .. congimp1s_ra .. '\n|' .. te .. congimp2s_ra .. '\n|' .. se .. congimp3s_ra .. '\n|' .. nos .. congimp1p_ra .. '\n|' .. os .. congimp2p_ra .. '\n|' .. se .. congimp3p_ra .. '\n|-\n'
    conj = conj .. '|' .. me .. congimp1s_se .. '\n|' .. te .. congimp2s_se .. '\n|' .. se .. congimp3s_se .. '\n|' .. nos .. congimp1p_se .. '\n|' .. os .. congimp2p_se .. '\n|' .. se .. congimp3p_se .. '\n' 
    conj = conj .. '|-\n! style="height:3em;background:#c0e4c0" rowspan="1" | futuro</br><small>futuro</small>\n'
    conj = conj .. '|' .. me .. congfut1s .. '\n|' .. te .. congfut2s .. '\n|' .. se .. congfut3s .. '\n|' .. nos .. congfut1p .. '\n|' .. os .. congfut2p .. '\n|' .. se .. congfut3p .. '\n' 
    conj = conj .. '|-\n! style="height:3em;background:#c0e4c0" colspan="1" | passato</br><small>perfecto</small>\n'
    conj = conj .. '| style="background:#F0F0F0" colspan="6" | <div class="NavFrame" style="border:0"><div class="NavHead">'.. congpas.. '</div><div class="NavContent">\n {| style="background:#F0F0F0;border-collapse:separate;border-spacing:2px;width:100%" class="inflection-table" \n |- \n | ' .. me .. congpas1s .. '\n|' .. te .. congpas2s .. '\n|' .. se .. congpas3s .. '\n|' .. nos .. congpas1p .. '\n|' .. os .. congpas2p .. '\n|' .. se .. congpas3p .. '\n |- \n |}</div></div>\n'   
    conj = conj .. '|-\n! style="height:3em;background:#c0e4c0" colspan="1" | trapassato</br><small>pluscuamperfecto</small>\n'
    conj = conj .. '| style="background:#F0F0F0" colspan="6" | <div class="NavFrame" style="border:0"><div class="NavHead">'.. congtrap.. '</div><div class="NavContent">\n {| style="background:#F0F0F0;border-collapse:separate;border-spacing:2px;width:100%" class="inflection-table" \n |- \n | ' .. me .. congtrap1s .. '\n|' .. te .. congtrap2s .. '\n|' .. se .. congtrap3s .. '\n|' .. nos .. congtrap1p .. '\n|' .. os .. congtrap2p .. '\n|' .. se .. congtrap3p .. '\n |- \n |}</div></div>\n' 
    conj = conj .. '|-\n! style="height:3em;background:#c0e4c0" colspan="1" | futuro compuesto o perfecto</br><small>pluscuamperfecto</small>\n'
    conj = conj .. '| style="background:#F0F0F0" colspan="6" | <div class="NavFrame" style="border:0"><div class="NavHead">'.. congfutant.. '</div><div class="NavContent">\n {| style="background:#F0F0F0;border-collapse:separate;border-spacing:2px;width:100%" class="inflection-table" \n |- \n | ' .. me .. congfutant1s .. '\n|' .. te .. congfutant2s .. '\n|' .. se .. congfutant3s .. '\n|' .. nos .. congfutant1p .. '\n|' .. os .. congfutant2p .. '\n|' .. se .. congfutant3p .. '\n |- \n |}</div></div>\n'
    conj = conj .. '|-\n! colspan="1" rowspan="2" style="height:3em;background:#e4d4c0" | imperativo</br><small>imperativo</small>\n'
    conj = conj .. '! style="background:#e4d4c0" | yo\n'
    conj = conj .. '! style="background:#e4d4c0" | tú</br>vos\n'
    conj = conj .. '! style="background:#e4d4c0" | él/ella</br>usted\n'
    conj = conj .. '! style="background:#e4d4c0" | nosotros</br>nosotras\n'
    conj = conj .. '! style="background:#e4d4c0" | vosotros</br>vosotras\n'
    conj = conj .. '! style="background:#e4d4c0" | ellos/ellas</br>ustedes\n|-\n'
    conj = conj .. '|-\n|\n'
    conj = conj .. '|' .. imp2s.." <sup><small>tú</small></sup></br>".. imp2sform .." <sup><small>vos</small></sup>"..  '\n|' .. imp3s .. '\n|' .. imp1p .. '\n|' .. imp2p .. '\n|' .. imp3p .. '\n'
    conj = conj .. '|-\n'    
    conj = conj .. '|}'
    return conj 
end

function p.over(x,over,xtra)
-- Utilizzato all'interno della funzione esconj
-- Rimpiazza una voce verbale standard con quella eventualmente indicata nel template (se quest'ultimo è un link rosso, aggiunge anche la relativa categoria)
    if over == nil then return x end
    if over < "a" then return '' end
    if xtra == 0 then return over .. " " end -- for reflexive pronouns
	if over >= "a" and mw.title.new(over).exists == false then 
		RedCat = categorizza("Verbi spagnoli con forme da scrivere", titolo)
	else
		RedCat = ""
		end
	if RedCat > "0" then
		return RedCat.. " [[" .. over .. "#Spagnolo|" .. over .. "]]"
	else
		return "[[" .. over .. "#Spagnolo|" .. over .. "]]"
	end
end

function p.wiki(x)
-- Utilizzato all'interno della funzione esconj
    if x == nil then return " " end
    if x == "" then return " " end
    -- aggiunge la categoria link rossi
    if x == (radice.. "ar") or x == (radice.. "er") or x == (radice.. "ir") then --per la voce all'infinito
    	if x >= "a" and mw.title.new(x).exists == false then
    	RedCat = categorizza("Verbi spagnoli da scrivere", titolo)
        else
    	RedCat = ""
    	end
    else --per tutte le altre
    	if x >= "a" and mw.title.new(x).exists == false then
    	RedCat = categorizza("Verbi spagnoli con forme da scrivere", titolo)
        else
    	RedCat = ""
    	end
	end
-- Rende il suo argomento un wikilink, o lo rende nullo se non definito (per facilitare la concatenazione)
    if RedCat > "0" then
    	return RedCat.. " [[" .. x .. "#Spagnolo|" .. x .. "]]"
    else
    	return "[[" .. x .. "#Spagnolo|" .. x .. "]]"
    end
end

function p.alts(x,y)
-- Utilizzato all'interno della funzione esconj
-- Aggiunge le eventuali forme alternative, se specificate nel template, separandole da quelle base con una virgola
	if y == nil then return x end
	if y == '' then return x end
    if y > "0" then return x .. ", " .. y end
    return x
end

function p.plurale(pos, str, r)
-- Utilizzato all'interno della funzione esconj
--genera automaticamente il plurale del participio passato
    return str:sub(1, pos-1) .. r
end

return p