Modulo:Infobox/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
test
Test parametro posizione
 
(6 versioni intermedie di un altro utente non mostrate)
Riga 42:
root
:tag('tr')
:addClass("sinottico_test_divisionesinottico_divisione")
:tag('th')
:attr('colspan', 2)
:cssText(rowArgs.stilestilegruppoN or args.StileGruppo or ''nil)
:wikitext(rowArgs.gruppo)
-- Altrimenti se rowArgs.valore non è nullo inserisce una riga dati, verificando
Riga 55:
row
:tag('th')
:cssText(rowArgs.stilenomeN or args.StileNome or ''nil)
:addClass('sinottico_test_etichetta')
:cssText(args.StileNome or '')
:wikitext(rowArgs.nome)
dataCell = row:tag('td')
else
dataCell = row:tag('td')
:addClass('sinottico_test_testo_centralesinottico_testo_centrale')
:attr('colspan', 2)
end
dataCell
:addClass(rowArgs.classe or ''nil)
:cssText(rowArgs.stilevaloreN or args.StileValore or ''nil)
:wikitext(checkList(rowArgs.valore))
end
Riga 76 ⟶ 75:
suptitle
:tag('span')
:addClass('sinottico_test_sottotitolosinottico_sottotitolo')
:cssText(args.StileSopraTitolo or ''nil)
:wikitext(args.SopraTitolo)
:done()
Riga 87 ⟶ 86:
:tag('br'):done()
:tag('span')
:addClass('sinottico_test_sottotitolosinottico_sottotitolo')
:cssText(args.StileSottoTitolo or ''nil)
:wikitext(args.SottoTitolo)
end
Riga 94 ⟶ 93:
root
:tag('caption')
:addClass('sinottico_test_testatasinottico_testata')
:cssText(args.StileTitoloEst or ''nil)
:node(suptitle)
:wikitext(args.TitoloEst)
Riga 102 ⟶ 101:
root
:tag('tr')
:addClass('sinottico_test_testatasinottico_testata')
:tag('th')
:attr('colspan', '2')
:node(suptitle)
:cssText(args.StileTitoloInt or ''nil)
:wikitext(args.TitoloInt)
:node(subtitle)
Riga 116 ⟶ 115:
local cell_immagine = mw.html.create('td')
cell_immagine
:addClass('sinottico_test_testo_centralesinottico_testo_centrale ' .. (args.ClasseImmagine or ''))
:attr('colspan', '2')
:cssText(args.StileImmagine or ''nil)
:wikitext(args.Immagine)
if args.Didascalia then
Riga 125 ⟶ 124:
:done()
:tag('span')
:cssText(args.StileDidascalia or ''nil)
:wikitext(args.Didascalia)
end
Riga 133 ⟶ 132:
 
local function renderRows()
local rownums = getArgNums('Valore', 'GruppoOpzionale', 'Gruppo', 'Nodo')
for k, num in ipairs(rownums) do
local skip = false
Riga 140 ⟶ 139:
for j = k+1, #rownums do
if args['Gruppo' .. rownums[j]] ~= nil or args['GruppoOpzionale' .. rownums[j]]~=nil then break end
if args['Valore' .. rownums[j]] ~= nil or args['Nodo' .. rownums[j]] ~= nil then
skip = false
break
end
end
end
if args['Nodo' .. num] ~= nil then
root:wikitext(args['Nodo' .. num])
skip = true
end
if not skip and args['GruppoOpzionale' .. num] ~= '$fine' then
Riga 152 ⟶ 155:
valore = args['Valore' .. num],
classe = args['Classe' .. num],
stilestilegruppoN = args['GruppoStile' .. num],
stilenomeN = args['NomeStile' .. num],
stilevaloreN = args['ValoreStile' .. num]
})
end
Riga 164 ⟶ 169:
:tag('td')
:attr('colspan', '2')
:addClass('sinottico_test_piedesinottico_piede')
:cssText(args.StileUltima or ''nil)
:wikitext(args.Ultima)
:newline()
Riga 175 ⟶ 180:
:tag('tr')
:tag('td')
:addClass('sinottico_test_piede2sinottico_piede2 noprint nomobile metadata')
:attr('colspan', '2')
:wikitext(mw.getCurrentFrame():expandTemplate({
Riga 187 ⟶ 192:
local function _infobox()
-- Crea l'albero html che rappresenta la tabella del sinottico e restituisce il markup
if args.CreaTable == 'no' or args.Posizione == 'corpo' or args.Posizione == 'coda' then
root = mw.html.create('')
else
root = mw.html.create('table')
root
:addClass('sinottico_testinfobox sinottico')
:cssText(args.StileTabella or ''nil)
:attr('summary', args.Summary or 'Tabella sinottica che riassume i principali dati del soggetto')
end
Riga 201 ⟶ 206:
renderLastRow()
renderNavBar()
returnlocal res = tostring(root)
if args.Posizione == 'coda' then
res = res .. '</table>';
elseif args.Posizione == 'testa' then
res = mw.ustring.gsub( res, '</table>$', '')
end
return res
end
 
Riga 306 ⟶ 318:
preprocessSingleArg('StileValore')
preprocessArgs({
{prefix = 'Nodo'},
{prefix = 'Gruppo', depend={'GruppoStile'}},
{prefix = 'GruppoOpzionale', depend={'GruppoStile'}},
{prefix = 'Valore', depend={'Nome', 'Classe', 'NomeStile', 'ValoreStile'}},
}, 50)
preprocessSingleArg('Ultima')
Riga 315 ⟶ 328:
preprocessSingleArg('LinkWikidata')
preprocessSingleArg('CreaTable')
preprocessSingleArg('Posizione')
preprocessSingleArg('Summary')
return _infobox()