Modulo:Immagine multipla/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
r |
+ |
||
(12 versioni intermedie di 3 utenti non mostrate) | |||
Riga 9:
--=====================================================
-- Generazione del codice una singola cella contenente
-- un
--=====================================================
local function renderImageCell(image, width, height, link, alt, caption, textalign, istyle)
Riga 67:
end
--=====================================================
local function get_aspectratio(w, h, name)▼
-- Ritorna le dimensioni dell'immagine (larghezza x altezza)
-- Se queste non sono passate dai parametri tenta di recuperarle
-- dalle informazioni del file immagine, altrimenti ricade su
-- una larghezza pari a 200 e un'altezza pari alla larghezza
--=====================================================
local wr = w and tonumber(w)
local hr = h and tonumber(h)
Line 73 ⟶ 80:
local page = mw.title.new(name, 'Media')
if not wr then
wr =
end
if not hr then
hr =
end
end
wr = wr or 200
hr = hr or wr
return wr, hr
end
-- Return a sorted array of the index of the parameter immagine1 .. immagine(n)
Line 101 ⟶ 108:
end
if found then
istart =
iend = iend + istep
else
Line 165 ⟶ 172:
local w = args['larghezza' .. imagenumbers[k]]
if totalwidth > 0 then
local
widths[k], heights[k] =
else
widths[k] = (w and tonumber(w)) or width
Line 177 ⟶ 184:
-- if total_width has been specified, rescale the image widths
if totalwidth > 0 then
widthmax = 0
Line 189 ⟶ 195:
k = k + 1
if k<= imagecount then
if (heights[k] > 0) then
ar[j] = widths[k]/heights[k]
else
ar[j] = widths[k]/100
Line 224 ⟶ 227:
local bodywidth = 0
for r=1,rowcount do
local bw = widthsum[r] + 4 * (perrow[r] - 1) +
bodywidth = math.max(bodywidth, bw)
end
Line 230 ⟶ 233:
bodywidth = math.max( 100, bodywidth);
-- crea il div esterno per la galleria di immagini
local root = mw.html.create('div')
root:addClass('thumb')
root:addClass(thumbclass[align] or 'tright')
if align == 'center' or align == 'centre' or align == 'centro' then▼
root:css('margin', '0 auto')▼
-- crea il div interno
local div = root:tag('div')
div:addClass('thumbinner')▼
▲ if align == 'center' or align == 'centre' or align == 'centro' then
end
▲ div:addClass('thumbinner')
-- aggiunge il titolo
if header then
Line 266 ⟶ 263:
if dir ~= 'vertical' then
imagediv:css('float', 'left')
end
imagediv:css('margin', '1px')
Line 283 ⟶ 277:
end
end
--
▲ div:tag('div')
▲ :css('clear', 'left')
end
-- add the footer
Line 296 ⟶ 287:
:css('text-align', args['allinea sotto'] or 'left')
:css('background-color', args['sfondo sotto'] or 'transparent')
end
return tostring(root)
|