Modulo:Tabs
⧼vector-jumptonavigation⧽
⧼vector-jumptosearch⧽
La documentazione per questo modulo può essere creata in Modulo:Tabs/man
-- Moduli necessari local getArgs = require('Modulo:Arguments').getArgs -- carica i valori dei parametri local FFLink = require('Modulo:FormeFlesse') -- carica la funzione per le desinenze delle forme flesse -- Funzione della categorizzazione local function categorizza(cat) return string.format('[[%s:%s]]', mw.site.namespaces[14].name, cat) end -- funzione per rilevare se una determinata pagina esiste o no local function titleExists(pagina) local title = mw.title.new(pagina) return title and title.exists end local p = {} function p.Tabs(frame) local arg = getArgs(frame) -- variabile a me sconosciuta ma che comunque nel template c'è, io ce la metto -- credo sia un titolo, e io la chiamo titolo, poi vediamo... local titolo = arg[5] or ' ' --Forme base local masc = arg.m or arg[1] local mascPl = arg.mp or arg[2] local fem = arg.f or arg[3] local femPl = arg.fp or arg[4] -- Forme alternative local masc2 = arg.m2 or '' local mascPl2 = arg.mp2 or '' local fem2 = arg.f2 or '' local femPl2 = arg.fp2 or '' -- Gestione per mostrare o meno le forme alternative if masc2 ~= '' then masc2Insert = '/ [[' .. masc2 .. ']]' else masc2Insert = '' end if mascPl2 ~= '' then mascPl2Insert = '/ [[' .. mascPl2 .. ']]' else mascPl2Insert = '' end if fem2 ~= '' then fem2Insert = '/ [[' .. fem2 .. ']]' else fem2Insert = '' end if femPl2 ~= '' then femPl2Insert = '/ [[' .. femPl2 .. ']]' else femPl2Insert = '' end -- Funzione per separare le desinenze, fondamentale per l'autocompilazione della pagina [[Speciale:FormeFlesse]] -- Usa la funzione "differenze" del [[Modulo:FormeFlesse]] local differenze = FFLink.Differenze(arg) local function categorizzazione (frame) --[=[########################################################################### GESTIONE DELLA CATEGORIZZAZIONE #############################################################################]=] --Categorizzazione forme semplici if titleExists(masc) == false then categoriaMasc = ''..categorizza('Lemmi con forma maschile da scrivere') else categoriaMasc = '' end if titleExists(mascPl) == false then categoriaMascPl = ''..categorizza('Lemmi con forma maschile plurale da scrivere') else categoriaMascPl = '' end if titleExists(fem) == false then categoriaFem = ''..categorizza('Lemmi con forma femminile da scrivere') else categoriaFem = '' end if titleExists(femPl) == false then categoriaFemPl = ''..categorizza('Lemmi con forma femminile plurale da scrivere') else categoriaFemPl = '' end -- Categorizzazione forme alternative if titleExists(masc2) == false then categoriaMasc2 = ''..categorizza('Lemmi con forma maschile alternativa da scrivere') else categoriaMasc2 = '' end if titleExists(mascPl2) == false then categoriaMascPl2 = ''..categorizza('Lemmi con forma maschile plurale alternativa da scrivere') else categoriaMascPl2 = '' end if titleExists(fem2) == false then categoriaFem2 = ''..categorizza('Lemmi con forma femminile alternativa da scrivere') else categoriaFem2 = '' end if titleExists(femPl2) == false then categoriaFemPl2 = ''..categorizza('Lemmi con forma femminile plurale alternativa da scrivere') else categoriaFemPl2 = '' end return ''..categoriaMasc..''..categoriaMasc2..''..categoriaMascPl..''..categoriaMascPl2..''..categoriaFem..''..categoriaFem2..''..categoriaFemPl..''..categoriaFemPl2 end --[=[########################################################################### CREAZIONE DELLA TABELLA #############################################################################]=] tabs = '{| style="float:right; margin-left:0.5em; margin-bottom:0.5em;' tabs = tabs .. 'border: 1px solid #AAAAAA; border-collapse:collapse;" cellpadding="3" rules="all"\n' tabs = tabs .. '|- align="center"\n' tabs = tabs .. '!'..titolo..'<div class="sost" id="ButtonFormeFlesse2" >'.. differenze .. '</div>\n' tabs = tabs .. '! bgcolor="#FFFFE0" | \'\'[[singolare]]\'\' \n' tabs = tabs .. '! bgcolor="#FFFFE0" | \'\'[[plurale]]\'\' \n' tabs = tabs .. '|- align="center"\n' tabs = tabs .. '! bgcolor="#FFFFE0" | \'\'[[maschile]]\'\' \n' tabs = tabs .. '| [['..masc..']] '..masc2Insert..'\n' tabs = tabs .. '| [['..mascPl..']] '..mascPl2Insert..'\n' tabs = tabs .. '|- align="center"\n' tabs = tabs .. '! bgcolor="#FFFFE0" | \'\'[[femminile]]\'\' \n' tabs = tabs .. '| [['..fem..']] '..fem2Insert..'\n' tabs = tabs .. '| [['..femPl..']] '..femPl2Insert..'\n' tabs = tabs .. '|}\n' ..categorizzazione(frame) return tabs end return p