Modulo:Sandbox/Barbaking/La-decl

Hello, you have come here looking for the meaning of the word Modulo:Sandbox/Barbaking/La-decl. In DICTIOUS you will not only get to know all the dictionary meanings for the word Modulo:Sandbox/Barbaking/La-decl, but we will also tell you about its etymology, its characteristics and you will know how to say Modulo:Sandbox/Barbaking/La-decl in singular and plural. Everything you need to know about the word Modulo:Sandbox/Barbaking/La-decl you have here. The definition of the word Modulo:Sandbox/Barbaking/La-decl will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModulo:Sandbox/Barbaking/La-decl, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

La documentazione per questo modulo può essere creata in Modulo:Sandbox/Barbaking/La-decl/man

-- Questo modulo contiene il codice per il template:La-decl, che genera la tabella di declinazione dei sostantivi in latino
-- La funzione ladecl genera la tabella di coniugazione utilizzando i parametri passati dal template

p = {}

function p.ladecl(frame)
    pframe = frame:getParent()
    config = frame.args
    args = pframe.args
-- Argomenti passati dal template
    stem = args -- radice del nominativo, obbligatorio, va inserito con gli eventuali accenti di breve e di lunga (ă, ā...)
    stem2 = p.nodiacritic(stem) -- uguale alla precedente, ma automaticamente "pulita" degli accenti dalla funzione nodiacritic
    stem_gen = args -- radice del genitivo, obbligatorio, va inserito con gli eventuali accenti di breve e di lunga (ă, ā...)
    stem_gen2 = p.nodiacritic(stem_gen) -- uguale alla precedente, ma automaticamente "pulita" degli accenti dalla funzione nodiacritic
    decl = config -- specifica la declinazione (1, 2, 2-us eccetera), obbligatorio E deve essere uno di quelli specificati sotto
-- Inizializzazione di tutte le variabili interne, che potrebbero altrimenti risultare nulle
    nom1s = ""; nom1p = ""; 
    gen1s = ""; gen1p = "";
    dat1s = ""; dat1p = "";
    acc1s = ""; acc1p = "";
    voc1s = ""; voc1p = "";
    abl1s = ""; abl1p = "";
    titolo = ""
    nom2s = ""
-- per semplificare il template quando la radice del nominativo e del genitivo sono uguali (è possibile lasciare il secondo parametro vuoto):
	if args < "a" then stem_gen = stem; stem_gen2 = stem2 end
-- Costruzione delle forme flesse per ciascuna declinazione:
    if (decl == "1") or (decl == "1-a") then --PRIMA DECLINAZIONE
        nom1s = p.wiki(stem2 .. "a", stem.. "ă"); nom1p = p.wiki(stem2 .. "ae", stem.. "ae") -- nominativo
        gen1s = p.wiki(stem_gen2 .. "ae", stem_gen.. "ae"); gen1p = p.wiki(stem_gen2 .. "arum", stem_gen.. "ārum") -- genitivo
        dat1s = p.wiki(stem_gen2 .. "ae", stem_gen.. "ae"); dat1p = p.wiki(stem_gen2 .. "is", stem_gen.. "ĭs") -- dativo
        acc1s = p.wiki(stem_gen2 .. "am", stem_gen.. "ăm"); acc1p = p.wiki(stem_gen2 .. "as", stem_gen.. "ās") --accusativo
        voc1s = p.wiki(stem2 .. "a", stem.. "ă"); voc1p = p.wiki(stem_gen2 .. "ae", stem_gen.. "ae") -- vocativo
        abl1s = p.wiki(stem_gen2 .. "a", stem_gen.. "ā"); abl1p = p.wiki(stem_gen2 .. "is", stem_gen.. "ĭs") -- ablativo
        titolo = "''Prima declinazione''" -- titolo della tabella
    elseif (decl == "2") or (decl == "2-us") then --SECONDA DECLINAZIONE (-us)
        nom1s = p.wiki(stem2 .. "us", stem.. "ŭs"); nom1p = p.wiki(stem_gen2 .. "i", stem_gen.. "ī") -- nominativo
        gen1s = p.wiki(stem_gen2 .. "i", stem_gen.. "ī"); gen1p = p.wiki(stem_gen2 .. "orum", stem_gen.. "ōrŭm") -- genitivo
        dat1s = p.wiki(stem_gen2 .. "o", stem_gen.. "ō"); dat1p = p.wiki(stem_gen2 .. "is", stem_gen.. "īs") -- dativo
        acc1s = p.wiki(stem_gen2 .. "um", stem_gen.. "ŭm"); acc1p = p.wiki(stem_gen2 .. "os", stem_gen.. "ōs") --accusativo
        voc1s = p.wiki(stem2 .. "e", stem_gen.. "ē"); voc1p = p.wiki(stem_gen2 .. "i", stem_gen.. "ī") -- vocativo
        abl1s = p.wiki(stem_gen2 .. "o", stem_gen.. "ō"); abl1p = p.wiki(stem_gen2 .. "is", stem_gen.. "īs") -- ablativo
        titolo = "''Seconda declinazione''" -- titolo della tabella
	elseif (decl == "2-r") then --SECONDA DECLINAZIONE (-r)
        nom1s = p.wiki(stem2, stem); nom1p = p.wiki(stem_gen2 .. "i", stem_gen.. "ī") -- nominativo
        gen1s = p.wiki(stem_gen2 .. "i", stem_gen.. "ī"); gen1p = p.wiki(stem_gen2 .. "orum", stem_gen.. "ōrŭm") -- genitivo
        dat1s = p.wiki(stem_gen2 .. "o", stem_gen.. "ō"); dat1p = p.wiki(stem_gen2 .. "is", stem_gen.. "īs") -- dativo
        acc1s = p.wiki(stem_gen2 .. "um", stem_gen.. "ŭm"); acc1p = p.wiki(stem_gen2 .. "os", stem_gen.. "ōs") --accusativo
        voc1s = p.wiki(stem2, stem); voc1p = p.wiki(stem_gen2 .. "i", stem_gen.. "ī") -- vocativo
        abl1s = p.wiki(stem_gen2 .. "o", stem_gen.. "ō"); abl1p = p.wiki(stem_gen2 .. "is", stem_gen.. "īs") -- ablativo
        titolo = "''Seconda declinazione,</br>nominativo in -r''" -- titolo della tabella
        elseif (decl == "2-n") or (decl == "2-um") then --SECONDA DECLINAZIONE, NEUTRO
        nom1s = p.wiki(stem2 .. "um", stem .. "ŭm"); nom1p = p.wiki(stem_gen2 .. "a", stem_gen.. "ă") -- nominativo
        gen1s = p.wiki(stem_gen2 .. "i", stem_gen.. "ī"); gen1p = p.wiki(stem_gen2 .. "orum", stem_gen.. "ōrŭm") -- genitivo
        dat1s = p.wiki(stem_gen2 .. "o", stem_gen.. "ō"); dat1p = p.wiki(stem_gen2 .. "is", stem_gen.. "īs") -- dativo
        acc1s = p.wiki(stem2 .. "um", stem.. "ŭm"); acc1p = p.wiki(stem_gen2 .. "a", stem_gen.. "ă") --accusativo
        voc1s = p.wiki(stem2 .. "um", stem.. "ŭm"); voc1p = p.wiki(stem_gen2 .. "a", stem_gen.. "ă") -- vocativo
        abl1s = p.wiki(stem_gen2 .. "o", stem_gen.. "ō"); abl1p = p.wiki(stem_gen2 .. "is", stem_gen.. "īs") -- ablativo
        titolo = "''Seconda declinazione, neutro''" -- titolo della tabella
	elseif (decl == "3") then --TERZA DECLINAZIONE
        nom1s = p.wiki(stem2, stem); nom1p = p.wiki(stem_gen2 .. "es", stem_gen.. "ēs") -- nominativo
        gen1s = p.wiki(stem_gen2 .. "is", stem_gen.. "ĭs"); gen1p = p.wiki(stem_gen2 .. "um", stem_gen.. "ŭm") -- genitivo
        dat1s = p.wiki(stem_gen2 .. "i", stem_gen.. "ī"); dat1p = p.wiki(stem_gen2 .. "ibus", stem_gen.. "ībus") -- dativo
        acc1s = p.wiki(stem_gen2 .. "em", stem_gen.. "ĕm"); acc1p = p.wiki(stem_gen2 .. "es", stem_gen.. "ēs") --accusativo
        voc1s = p.wiki(stem2, stem); voc1p = p.wiki(stem_gen2 .. "es", stem_gen.. "ēs") -- vocativo
        abl1s = p.wiki(stem_gen2 .. "e", stem_gen.. "ĕ"); abl1p = p.wiki(stem_gen2 .. "ibus", stem_gen.. "ībus") -- ablativo
        titolo = "''Terza declinazione''" -- titolo della tabella
	else error("Coniugazione non riconosciuta!")
end
-- Recupera le eventuali forme irregolari, rimpiazziandole a quelle standard
    nom1s = p.over(nom1s,args); nom1p = p.over(nom1p,args)
    gen1s = p.over(gen1s,args); gen1p = p.over(gen1p,args)
    dat1s = p.over(dat1s,args); dat1p = p.over(dat1p,args)
    acc1s = p.over(acc1s,args); acc1p = p.over(acc1p,args)
    voc1s = p.over(voc1s,args); voc1p = p.over(voc1p,args)
    abl1s = p.over(abl1s,args); abl1p = p.over(abl1p,args)
-- Recupera le eventuali varianti e le aggiunge accanto a quelle standard
    if args == nil then nom2s = " " nom2s2 = " " else --verifica che esista il parametro per la variante (NOMINATIVO sing)
		nom2s = args nom2s2 = p.nodiacritic(nom2s) --genera le varianti con e senza diacritici
		nom2s = p.wiki(nom2s2, nom2s); nom1s = p.alts(nom1s, nom2s) end --recupera le varianti e le aggiunge accanto alla forma standard
	if args == nil then nom2p = " " nom2p2 = " " else --verifica che esista il parametro per la variante (NOMINATIVO plur)
		nom2p = args nom2p2 = p.nodiacritic(nom2p) --genera le varianti con e senza diacritici
		nom2p = p.wiki(nom2p2, nom2p); nom1s = p.alts(nom1p, nom2p) end --recupera le varianti e le aggiunge accanto alla forma standard
    if args == nil then gen2s = " " gen2s2 = " " else --verifica che esista il parametro per la variante (GENITIVO sing)
		gen2s = args gen2s2 = p.nodiacritic(gen2s) --genera le varianti con e senza diacritici
		gen2s = p.wiki(gen2s2, gen2s); gen1s = p.alts(gen1s, gen2s) end --recupera le varianti e le aggiunge accanto alla forma standard
	if args == nil then gen2p = " " gen2p2 = " " else --verifica che esista il parametro per la variante (GENITIVO plur)
		gen2p = args gen2p2 = p.nodiacritic(gen2p) --genera le varianti con e senza diacritici
		gen2p = p.wiki(gen2p2, gen2p); gen1s = p.alts(gen1p, gen2p) end --recupera le varianti e le aggiunge accanto alla forma standard
    if args == nil then dat2s = " " dat2s2 = " " else --verifica che esista il parametro per la variante (DATIVO sing)
		dat2s = args dat2s2 = p.nodiacritic(dat2s) --datera le varianti con e senza diacritici
		dat2s = p.wiki(dat2s2, dat2s); dat1s = p.alts(dat1s, dat2s) end --recupera le varianti e le aggiunge accanto alla forma standard
	if args == nil then dat2p = " " dat2p2 = " " else --verifica che esista il parametro per la variante (DATIVO plur)
		dat2p = args dat2p2 = p.nodiacritic(dat2p) --datera le varianti con e senza diacritici
		dat2p = p.wiki(dat2p2, dat2p); dat1s = p.alts(dat1p, dat2p) end --recupera le varianti e le aggiunge accanto alla forma standard
    if args == nil then acc2s = " " acc2s2 = " " else --verifica che esista il parametro per la variante (ACCUSATIVO sing)
		acc2s = args acc2s2 = p.nodiacritic(acc2s) --accera le varianti con e senza diacritici
		acc2s = p.wiki(acc2s2, acc2s); acc1s = p.alts(acc1s, acc2s) end --recupera le varianti e le aggiunge accanto alla forma standard
	if args == nil then acc2p = " " acc2p2 = " " else --verifica che esista il parametro per la variante (ACCUSATIVO plur)
		acc2p = args acc2p2 = p.nodiacritic(acc2p) --accera le varianti con e senza diacritici
		acc2p = p.wiki(acc2p2, acc2p); acc1s = p.alts(acc1p, acc2p) end --recupera le varianti e le aggiunge accanto alla forma standard
    if args == nil then voc2s = " " voc2s2 = " " else --verifica che esista il parametro per la variante (VOCATIVO sing)
		voc2s = args voc2s2 = p.nodiacritic(voc2s) --vocera le varianti con e senza diacritici
		voc2s = p.wiki(voc2s2, voc2s); voc1s = p.alts(voc1s, voc2s) end --recupera le varianti e le aggiunge accanto alla forma standard
	if args == nil then voc2p = " " voc2p2 = " " else --verifica che esista il parametro per la variante (VOCATIVO plur)
		voc2p = args voc2p2 = p.nodiacritic(voc2p) --vocera le varianti con e senza diacritici
		voc2p = p.wiki(voc2p2, voc2p); voc1s = p.alts(voc1p, voc2p) end --recupera le varianti e le aggiunge accanto alla forma standard
    if args == nil then abl2s = " " abl2s2 = " " else --verifica che esista il parametro per la variante (ABLATIVO sing)
		abl2s = args abl2s2 = p.nodiacritic(abl2s) --ablera le varianti con e senza diacritici
		abl2s = p.wiki(abl2s2, abl2s); abl1s = p.alts(abl1s, abl2s) end --recupera le varianti e le aggiunge accanto alla forma standard
	if args == nil then abl2p = " " abl2p2 = " " else --verifica che esista il parametro per la variante (ABLATIVO plur)
		abl2p = args abl2p2 = p.nodiacritic(abl2p) --ablera le varianti con e senza diacritici
		abl2p = p.wiki(abl2p2, abl2p); abl1s = p.alts(abl1p, abl2p) end --recupera le varianti e le aggiunge accanto alla forma standard
-- Costruisce la tabella di declinazione
    conj = "{|border='1' cellpadding='2' style='float:right; margin:1em 1em 1em 0;background:#f0fff0;border:1px #aaaaaa solid;border-collapse:collapse'\n"
	conj = conj .. "|-\n"
	conj = conj .. "|+".. titolo.. "\n"
	conj = conj .. "|-\n"
	conj = conj .. "!bgcolor='#FFFFFF'|\n"
    conj = conj .. "!bgcolor='#87cefa'|''singolare''\n"
    conj = conj .. "!bgcolor='#87cefa'|''plurale''\n"
    conj = conj .. "|-\n"    
    conj = conj .. "!bgcolor='#87cefa'| ''nominativo''\n"    
    conj = conj .. "|" ..nom1s .. "\n"
    conj = conj .. "|" ..nom1p .. "\n"
    conj = conj .. "|-\n"    
    conj = conj .. "!bgcolor='#87cefa'| ''genitivo''\n"    
    conj = conj .. "|" ..gen1s .. "\n"
    conj = conj .. "|" ..gen1p .. "\n"
    conj = conj .. "|-\n"   
    conj = conj .. "!bgcolor='#87cefa'| ''dativo''\n"    
    conj = conj .. "|" ..dat1s .. "\n"
    conj = conj .. "|" ..dat1p .. "\n"
    conj = conj .. "|-\n"
    conj = conj .. "!bgcolor='#87cefa'| ''accusativo''\n"    
    conj = conj .. "|" ..acc1s .. "\n"
    conj = conj .. "|" ..acc1p .. "\n"
    conj = conj .. "|-\n"   
    conj = conj .. "!bgcolor='#87cefa'| ''vocativo''\n"    
    conj = conj .. "|" ..voc1s .. "\n"
    conj = conj .. "|" ..voc1p .. "\n"
    conj = conj .. "|-\n"   
    conj = conj .. "!bgcolor='#87cefa'| ''ablativo''\n"    
    conj = conj .. "|" ..abl1s .. "\n"
    conj = conj .. "|" ..abl1p .. "\n"
    conj = conj .. "|}"
    return conj 
end

function p.nodiacritic(x)
-- funzione che rimuove gli eventuali accenti lunghi e brevi dalla radice (stem); in pratica se si scrive 'puĕr' restituisce 'puer'
	local dp={
	='a',='a',
	='e',='e',
	='i',='i',
	='o',='o',
	='u',='u',
	};
	return (mw.ustring.gsub(x, '.', dp))
	end
function p.over(x,over)
-- Utilizzato all"interno della funzione itconj
-- 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 over >= "a" then over2 = p.nodiacritic(over)
		if mw.title.new(over).exists == false then 
			RedCat = "] "
		else
			over2 = p.nodiacritic(over) RedCat = ""
		end
	end
	return RedCat.. "]"
end

function p.wiki(x,y)
-- Utilizzato all"interno della funzione itconj
    if x == nil then return "n.e." end
    if x == "" then return "n.e" end
    -- aggiunge la categoria link rossi
    if x >= "a" and mw.title.new(x).exists == false then
    	RedCat = "] "
        else
    	RedCat = ""
	end
	if x >= "a" and x == mw.title.getCurrentTitle().text then anchor = "|" else anchor = "#Latino|" end --evita che restituisca un link blu anche quando il link punta alla pagina stessa (elimina il #Latino se il link è uguale al titolo della pagina)
-- Rende il suo argomento un wikilink, o lo rende nullo se non definito (per facilitare la concatenazione)
    return RedCat.. "]"
    end

function p.alts(x,y)
-- Utilizzato all"interno della funzione itconj
-- 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 >= "a" then return x .. ", " .. y end
    return x
end

return p