Diferencia entre revisiones de «Módulo:Imagen múltiple»

De Hispanopedia
imported>Jarould
mSin resumen de edición
 
imported>Leoncastro
m Deshecha la edición 162205259 de Leoncastro (disc.) missclick
 
(No se muestran 4 ediciones intermedias de 3 usuarios)
Línea 1: Línea 1:
-- implements [[plantilla:imagen múltiple]]
-- implements [[template:multiple image]]
local p = {}
local p = {}
local autoscaledimages
local nonautoscaledimages


local function isnotempty(s)
local function isnotempty(s)
Línea 6: Línea 9:
end
end


local function renderImageCell(image, width, height, link, alt, caption, textalign, istyle)  
local function removepx(s)
return tostring(s or ''):match('^(.*)[Pp][Xx]%s*$') or s
end
 
local function getdimensions(s, w, h)
if tonumber(w) and tonumber(h) then
nonautoscaledimages = true
return tonumber(w), tonumber(h)
end
local file = s and mw.title.new('Archivo:' .. mw.uri.decode(mw.ustring.gsub(s,'%|.*$',''), 'WIKI'))
file = file and file.file or {width = 0, height = 0}
w = tonumber(file.width) or 0
h = tonumber(file.height) or 0
autoscaledimages = true
return w, h
end
 
local function renderImageCell(image, width, height, link, alt, thumbtime, caption, textalign, istyle)
local root = mw.html.create('')
local root = mw.html.create('')
 
local altstr = '|alt=' .. (alt or '')
local altstr = '|alt=' .. (alt or '')
local linkstr = link and ('|link=' .. link) or ''
local linkstr = link and ('|link=' .. link) or ''
local widthstr = '|' .. tostring(width) .. 'px'
local widthstr = '|' .. tostring(width) .. 'px'
local thumbtimestr = ''
 
if widthstr == '|-nanpx' then
widthstr = ''
end
if isnotempty( thumbtime ) then
thumbtimestr = '|thumbtime=' .. thumbtime
end
 
local imagediv = root:tag('div')
local imagediv = root:tag('div')
imagediv:addClass('thumbimage')
imagediv:addClass('thumbimage')
Línea 20: Línea 48:
imagediv:css('overflow', 'hidden')
imagediv:css('overflow', 'hidden')
end
end
imagediv:wikitext('[[Archivo:' .. image .. widthstr .. linkstr .. altstr .. ']]')
imagediv:wikitext('[[Archivo:' .. image .. widthstr .. linkstr .. altstr .. thumbtimestr .. ']]')
if isnotempty(caption) then
if isnotempty(caption) then
local captiondiv = root:tag('div')
local captiondiv = root:tag('div')
captiondiv:addClass('thumbcaption')
captiondiv:addClass('thumbcaption')
captiondiv:css('clear', 'left')
if isnotempty(textalign) then
if isnotempty(textalign) then
captiondiv:css('text-align', textalign)
captiondiv:addClass('text-align-' .. textalign)
end
end
captiondiv:wikitext(caption)
captiondiv:wikitext(caption)
Línea 42: Línea 69:
return w or 200
return w or 200
end
end
local function getPerRow(pstr, ic)
local function getPerRow(pstr, ic)
-- split string into array using any non-digit as a dilimiter
-- split string into array using any non-digit as a dilimiter
Línea 58: Línea 86:
ic = ic - thisrow
ic = ic - thisrow
r = r + 1
r = r + 1
-- use the previous if the next is missing and  
-- use the previous if the next is missing and
-- make sure we don't overstep the number of images
-- make sure we don't overstep the number of images
thisrow = math.min(tonumber(pr[r] or thisrow) or ic, ic)
thisrow = math.min(tonumber(pr[r] or thisrow) or ic, ic)
end
end
return prownum
return prownum
end
end


Línea 69: Línea 96:
local pargs = frame:getParent().args
local pargs = frame:getParent().args
local args = frame.args
local args = frame.args
local width = pargs['ancho'] or pargs['width'] or ''
local width = removepx(pargs['ancho'] or pargs['width'] or '')
local dir = pargs['dirección'] or pargs['direction'] or ''
local dir = pargs['dirección'] or pargs['direction'] or ''
local border = pargs['border'] or pargs['borde'] or args['border'] or args['borde'] or ''
local align = pargs['posición_tabla'] or pargs['align'] or args['align'] or ''
local align = pargs['posición_tabla'] or pargs['align'] or args['align'] or ''
local captionalign = pargs['alineación_texto'] or pargs['caption_align'] or args['caption_align'] or ''
local capalign = pargs['alineación_texto'] or pargs['caption_align'] or args['caption_align'] or ''
local totalwidth = pargs['ancho_total'] or pargs['total_width'] or args['total_width'] or ''
local totalwidth = removepx(pargs['ancho_total'] or pargs['total_width'] or args['total_width'] or '')
local imgstyle = pargs['image_style'] or args['image_style']
local imgstyle = pargs['image_style'] or args['image_style']
local header = pargs['título'] or pargs['title'] or pargs['header'] or ''
local header = pargs['título'] or pargs['title'] or pargs['header'] or ''
local footer = pargs['pie_imagen'] or pargs['texto'] or pargs['footer'] or ''
local footer = pargs['footer'] or pargs['texto'] or pargs['pie_imagen'] or ''
local imagegap = tonumber(pargs['image_gap'] or pargs['foto_espaciada'] or '1') or 1
local perrow = nil
local perrow = nil
local thumbclass = {
local thumbclass = {
Línea 101: Línea 130:


-- create an array with the number of images per row
-- create an array with the number of images per row
perrow = getPerRow(dir == 'vertical' and '1' or pargs['perrow'], imagecount)
perrow = getPerRow(dir == 'vertical' and '1' or pargs['perrow'] or pargs['por fila'], imagecount)
 
-- compute the number of rows
-- compute the number of rows
local rowcount = #perrow
local rowcount = #perrow


-- store the image widths and compute row widths and maximum row width
-- store the image widths and compute row widths and maximum row width
local heights = {}
local widths = {}
local widths = {}
local widthmax = 0
local widthmax = 0
Línea 117: Línea 147:
if( k <= imagecount ) then
if( k <= imagecount ) then
local i = imagenumbers[k]
local i = imagenumbers[k]
widths[k] = getWidth(width, pargs['width' .. i] or pargs['ancho' .. i])
if( isnotempty(totalwidth) ) then
widths[k], heights[k] = getdimensions(pargs['image' .. i] or pargs['foto' .. i], pargs['width' .. i] or pargs['ancho' .. i], pargs['height' .. i] or pargs['alto' .. i])
else
widths[k] = getWidth(width, pargs['width' .. i] or pargs['ancho' .. i])
end
widthsum[r] = widthsum[r] + widths[k]
widthsum[r] = widthsum[r] + widths[k]
end
end
Línea 123: Línea 157:
widthmax = math.max(widthmax, widthsum[r])
widthmax = math.max(widthmax, widthsum[r])
end
end
 
-- make sure the gap is non-negative
if imagegap < 0 then imagegap = 0 end
 
-- if total_width has been specified, rescale the image widths
-- if total_width has been specified, rescale the image widths
local heights = {}
if( isnotempty(totalwidth) ) then
if( isnotempty(totalwidth) ) then
totalwidth = tonumber(totalwidth)
totalwidth = tonumber(totalwidth)
Línea 132: Línea 168:
for r=1,rowcount do
for r=1,rowcount do
local koffset = k
local koffset = k
local tw = totalwidth - 4 * (perrow[r] - 1) - 12
local tw = totalwidth - (3 + imagegap) * (perrow[r] - 1) - 12
local ar = {}
local ar = {}
local arsum = 0
local arsum = 0
Línea 139: Línea 175:
if( k<= imagecount ) then
if( k<= imagecount ) then
local i = imagenumbers[k]
local i = imagenumbers[k]
local h = tonumber( pargs['height' .. i] or pargs['alto' .. i] or '' ) or 0
local h = heights[k] or 0
if (h > 0) then
if (h > 0) then
ar[j] = widths[k]/h
ar[j] = widths[k]/h
Línea 166: Línea 202:
widthmax = math.max(widthmax, widthsum[r])
widthmax = math.max(widthmax, widthsum[r])
end
end
end
end


-- start building the array of images, if there are images
-- start building the array of images, if there are images
Línea 174: Línea 210:
for r=1,rowcount do
for r=1,rowcount do
if( widthmax == widthsum[r] ) then
if( widthmax == widthsum[r] ) then
bodywidth = widthmax + 4 * (perrow[r] - 1) + 12
bodywidth = widthmax + (3 + imagegap) * (perrow[r] - 1) + 12
end
end
end
end
Línea 180: Línea 216:
bodywidth = math.max( 100, bodywidth - 8);
bodywidth = math.max( 100, bodywidth - 8);


local bg = pargs['background color'] or pargs['color de fondo']or ''
local bg = pargs['background color'] or pargs['color de fondo'] or ''
-- create the array of images
-- create the array of images
local root = mw.html.create('div')
local root = mw.html.create('div')
root:addClass('thumb')
root:addClass('thumb')
root:addClass('tmulti')
root:addClass('tmulti')
-- root:addClass('tmulti-sandbox')
root:addClass(thumbclass[align] or 'tright')
root:addClass(thumbclass[align] or 'tright')


if( align == 'center' or align == 'centre' ) then
if( align == 'center' or align == 'centre' ) then
root:addClass('center')
root:addClass('center')
end
if( pargs['margin_top'] or args['margin_top']) then
root:css('margin-top', pargs['margin_top'] or args['margin_top'])
end
if( pargs['margin_bottom'] or args['margin_bottom']) then
root:css('margin-bottom', pargs['margin_bottom'] or args['margin_bottom'])
end
end
if( bg ~= '' ) then
if( bg ~= '' ) then
Línea 206: Línea 237:
if( bg ~= '' ) then
if( bg ~= '' ) then
div:css('background-color', bg)
div:css('background-color', bg)
end
if( border == 'infobox' or border == 'none') then
div:css('border', 'none')
end
end
-- add the header
-- add the header
if( isnotempty(header) ) then
if( isnotempty(header) ) then
div:tag('div')
div:tag('div')
:css('clear', 'both')
:addClass('trow')
:css('font-weight', 'bold')
local cap = div:tag('div')
:css('text-align', pargs['posición_título'] or pargs['header_align'] or 'center')
:addClass('theader')
:css('background-color', pargs['fondo_de_título'] or pargs['header_background'] or 'transparent')
:css('text-align', pargs['header_align'] or pargs['posición_título'] or 'center')
:wikitext(header)
:wikitext(header)
if pargs['fondo_de_título'] and pargs['fondo_de_título']~= '' then
cap:css('background-color', pargs['fondo_de_título'])
end
end
end
-- loop through the images
-- loop through the images
local k = 0
local k = 0
for r=1,rowcount do
for r=1,rowcount do
local rowdiv = div:tag('div'):addClass('trow');
for j=1,perrow[r] do
for j=1,perrow[r] do
k = k + 1
k = k + 1
if( k <= imagecount ) then
if( k <= imagecount ) then
local imagediv = div:tag('div')
local imagediv = rowdiv:tag('div')
imagediv:addClass('tsingle')
imagediv:addClass('tsingle')
if dir ~= 'vertical' then
imagediv:css('float', 'left')
end
if bg ~= '' then
if bg ~= '' then
imagediv:css('background-color', bg);
imagediv:css('background-color', bg);
end
end
imagediv:css('margin', '1px')
if ((imagegap > 1) and (j < perrow[r])) then
imagediv:css('margin-right', tostring(imagegap) .. 'px')
end
local i = imagenumbers[k]
local i = imagenumbers[k]
local img = pargs['image' .. i] or pargs['foto' .. i]
local img = pargs['image' .. i] or pargs['foto' .. i]
Línea 236: Línea 273:
imagediv:css('width', tostring(2 + w) .. 'px')
imagediv:css('width', tostring(2 + w) .. 'px')
:css('max-width', tostring(2 + w) .. 'px')
:css('max-width', tostring(2 + w) .. 'px')
imagediv:wikitext(renderImageCell(img, w, heights[k],  
imagediv:wikitext(renderImageCell(img, w, heights[k],
pargs['link' .. i], pargs['alt' .. i],
pargs['link' .. i], pargs['alt' .. i],
pargs['caption' .. i] or pargs['texto' .. i],  
pargs['thumbtime' .. i], pargs['caption' .. i] or pargs['texto' .. i],  
pargs['captionalign' .. i] or pargs['alineación_texto' .. i], imgstyle))
pargs['alineación_texto' .. i] or pargs['caption_align' .. i] or '',
imgstyle))
end
end
end
-- only float content gives a parent height:0, so add a clearing div
if dir ~= 'vertical' then
div:tag('div')
:css('clear', 'left')
end
end
end
end
Línea 251: Línea 284:
if( isnotempty(footer) ) then
if( isnotempty(footer) ) then
div:tag('div')
div:tag('div')
:addClass('trow')
:css('display', (falign ~= 'left') and 'flow-root' or 'flex')
local cap = div:tag('div')
:addClass('thumbcaption')
:addClass('thumbcaption')
:css('clear', 'left')
:css('text-align', pargs['posición'] ~= '' and pargs['posición']
:css('text-align', pargs['posición'] or pargs['footer_align'] or args['footer_align'] or 'left')
or pargs['footer_align'] ~= pargs['footer_align'] and pargs['footer_align']
:css('background-color', pargs['fondo_de_texto'] or pargs['footer_background'] or 'transparent')
or args['footer_align'] ~= args['footer_align'] and args['footer_align']
or 'left' )
:wikitext(footer)
:wikitext(footer)
if pargs['fondo_de_texto'] ~= '' and pargs['fondo_de_texto']
or pargs['footer_background'] ~= pargs['footer_background'] and pargs['footer_background'] then
cap:css( 'background-color', pargs['fondo_de_texto'] ~= '' and pargs['fondo_de_texto']
or pargs['footer_background'] ~= pargs['footer_background'] and pargs['footer_background'] )
end
end
end
return tostring(root)
return tostring(root)
Línea 263: Línea 305:


function p.render( frame )
function p.render( frame )
    return renderMultipleImages( frame )
autoscaledimages = false
nonautoscaledimages = false
 
return frame:extensionTag {name = 'templatestyles', args = {src = 'Imagen múltiple/styles.css', wrapper = ".tmulti"}}
.. renderMultipleImages( frame )
.. (autoscaledimages and '[[Categoría:Páginas que usan imágenes múltiples con imágenes escaladas automáticamente]]' or '')
.. (nonautoscaledimages and '[[Categoría:Páginas que usan imágenes múltiples con imágenes escaladas manualmente]]' or '')
end
end
 
return p
return p

Revisión actual - 18:03 1 sep 2024

Uso

Este módulo permite estructurar la plantilla de imagen múltiple.

Funciones

Para que no exista conflicto con los múltiples artículos que usan la plantilla, el módulo debe tener los mismos parámetros de la plantilla (ver la documentación) así como reconocer los que están en inglés.

Sí  foto(n)image(n).
Sí  texto(n)caption(n).
Sí  alineación_texto(n)caption_align(n).
Sí  ancho_totaltotal_width.
Sí  ancho(n)width(n).
Sí  alto(n)height(n).
Sí  posición_tablaalign.
Sí  direccióndirection.
Sí  color de fondobackground color.
Sí  títulotitleheader.
Sí  posición_títuloheader_align.
Sí  fondo_de_títuloheader_background.
Sí  textopie_imagenfooter.
Sí  posiciónfooter_align.
Sí  fondo_de_textofooter_background.


Sí  alt: Por default.
Sí  link: Analizar la posibilidad de cambiarlo a enlace (aunque las imágenes corrientes también usan |link=).

-- implements [[template:multiple image]]
local p = {}

local autoscaledimages
local nonautoscaledimages

local function isnotempty(s)
	return s and s:match( '^%s*(.-)%s*$' ) ~= ''
end

local function removepx(s)
	return tostring(s or ''):match('^(.*)[Pp][Xx]%s*$') or s
end

local function getdimensions(s, w, h)
	if tonumber(w) and tonumber(h) then
		nonautoscaledimages = true
		return tonumber(w), tonumber(h)
	end
	local file = s and mw.title.new('Archivo:' .. mw.uri.decode(mw.ustring.gsub(s,'%|.*$',''), 'WIKI'))
	file = file and file.file or {width = 0, height = 0}
	w = tonumber(file.width) or 0
	h = tonumber(file.height) or 0
	autoscaledimages = true
	return w, h
end

local function renderImageCell(image, width, height, link, alt, thumbtime, caption, textalign, istyle)
	local root = mw.html.create('')

	local altstr = '|alt=' .. (alt or '')
	local linkstr = link and ('|link=' .. link) or ''
	local widthstr = '|' .. tostring(width) .. 'px'
	local thumbtimestr = ''

	if widthstr == '|-nanpx' then
		widthstr = ''
	end
	if isnotempty( thumbtime ) then
		thumbtimestr = '|thumbtime=' .. thumbtime
	end

	local imagediv = root:tag('div')
	imagediv:addClass('thumbimage')
	imagediv:cssText(istyle)
	if( height ) then
		imagediv:css('height', tostring(height) .. 'px')
		imagediv:css('overflow', 'hidden')
	end
	imagediv:wikitext('[[Archivo:' .. image .. widthstr .. linkstr .. altstr .. thumbtimestr .. ']]')
	if isnotempty(caption) then
		local captiondiv = root:tag('div')
		captiondiv:addClass('thumbcaption')
		if isnotempty(textalign) then
			captiondiv:addClass('text-align-' .. textalign)
		end
		captiondiv:wikitext(caption)
	end
	return tostring(root)
end

local function getWidth(w1, w2)
	local w
	if isnotempty(w1) then
		w = tonumber(w1)
	elseif isnotempty(w2) then
		w = tonumber(w2)
	end
	return w or 200
end

local function getPerRow(pstr, ic)
	-- split string into array using any non-digit as a dilimiter
	local pr = mw.text.split(pstr or '', '[^%d][^%d]*')
	-- if split failed, assume a single row
	if (#pr < 1) then
		pr = {tostring(ic)}
	end
	-- convert the array of strings to an array of numbers,
	-- adding any implied/missing numbers at the end of the array
	local r = 1
	local thisrow = tonumber(pr[1] or ic) or ic
	local prownum = {}
	while( ic > 0 ) do
		prownum[r] = thisrow
		ic = ic - thisrow
		r = r + 1
		-- use the previous if the next is missing and
		-- make sure we don't overstep the number of images
		thisrow = math.min(tonumber(pr[r] or thisrow) or ic, ic)
	end
	return prownum
end

local function renderMultipleImages(frame)
	local pargs = frame:getParent().args
	local args = frame.args
	local width = removepx(pargs['ancho'] or pargs['width'] or '')
	local dir = pargs['dirección'] or pargs['direction'] or ''
	local border = pargs['border'] or pargs['borde'] or args['border'] or args['borde'] or ''
	local align = pargs['posición_tabla'] or pargs['align'] or args['align'] or ''
	local capalign = pargs['alineación_texto'] or pargs['caption_align'] or args['caption_align'] or ''
	local totalwidth = removepx(pargs['ancho_total'] or pargs['total_width'] or args['total_width'] or '')
	local imgstyle = pargs['image_style'] or args['image_style']
	local header = pargs['título'] or pargs['title'] or pargs['header'] or ''
	local footer = pargs['footer'] or pargs['texto'] or pargs['pie_imagen'] or ''
	local imagegap = tonumber(pargs['image_gap'] or pargs['foto_espaciada'] or '1') or 1
	local perrow = nil
	local thumbclass = {
		["left"] = 'tleft',
		["none"] = 'tnone',
		["center"] = 'tnone',
		["centre"] = 'tnone',
		["right"] = 'tright'
		}

	-- find all the nonempty images
	local imagenumbers = {}
	local imagecount = 0
	for k, v in pairs( pargs ) do
		local i = tonumber(tostring(k):match( '^%s*image([%d]+)%s*$' ) or tostring(k):match( '^%s*foto([%d]+)%s*$' ) or '0')
		if( i > 0 and isnotempty(v) ) then
			table.insert( imagenumbers, i)
			imagecount = imagecount + 1
		end
	end

	-- sort the imagenumbers
	table.sort(imagenumbers)

	-- create an array with the number of images per row
	perrow = getPerRow(dir == 'vertical' and '1' or pargs['perrow'] or pargs['por fila'], imagecount)

	-- compute the number of rows
	local rowcount = #perrow

	-- store the image widths and compute row widths and maximum row width
	local heights = {}
	local widths = {}
	local widthmax = 0
	local widthsum = {}
	local k = 0
	for r=1,rowcount do
		widthsum[r] = 0
		for c=1,perrow[r] do
			k = k + 1
			if( k <= imagecount ) then
				local i = imagenumbers[k]
				if( isnotempty(totalwidth) ) then
					widths[k], heights[k] = getdimensions(pargs['image' .. i] or pargs['foto' .. i], pargs['width' .. i] or pargs['ancho' .. i], pargs['height' .. i] or pargs['alto' .. i])
				else
					widths[k] = getWidth(width, pargs['width' .. i] or pargs['ancho' .. i])
				end
				widthsum[r] = widthsum[r] + widths[k]
			end
		end
		widthmax = math.max(widthmax, widthsum[r])
	end

	-- make sure the gap is non-negative
	if imagegap < 0 then imagegap = 0 end

	-- if total_width has been specified, rescale the image widths
	if( isnotempty(totalwidth) ) then
		totalwidth = tonumber(totalwidth)
		widthmax = 0
		local k = 0
		for r=1,rowcount do
			local koffset = k
			local tw = totalwidth - (3 + imagegap) * (perrow[r] - 1) - 12
			local ar = {}
			local arsum = 0
			for j=1,perrow[r] do
				k = k + 1
				if( k<= imagecount ) then
					local i = imagenumbers[k]
					local h = heights[k] or 0
					if (h > 0) then
						ar[j] = widths[k]/h
						heights[k] = h
					else
						ar[j] = widths[k]/100
					end
					arsum = arsum + ar[j]
				end
			end
			local ht = tw/arsum
			local ws = 0
			k = koffset
			for j=1,perrow[r] do
				k = k + 1
				if( k<= imagecount ) then
					local i = imagenumbers[k]
					widths[k] = math.floor(ar[j]*ht + 0.5)
					ws = ws + widths[k]
					if heights[k] then
						heights[k] = math.floor(ht)
					end
				end
			end
			widthsum[r] = ws
			widthmax = math.max(widthmax, widthsum[r])
		end
	end

	-- start building the array of images, if there are images
	if( imagecount > 0 ) then
		-- compute width of outer div
		local bodywidth = 0
		for r=1,rowcount do
			if( widthmax == widthsum[r] ) then
				bodywidth = widthmax + (3 + imagegap) * (perrow[r] - 1) + 12
			end
		end
		-- The body has a min-width of 100, which needs to be taken into account on specific widths
		bodywidth = math.max( 100, bodywidth - 8);

		local bg = pargs['background color'] or pargs['color de fondo'] or  ''
		-- create the array of images
		local root = mw.html.create('div')
		root:addClass('thumb')
		root:addClass('tmulti')
		-- root:addClass('tmulti-sandbox')
		root:addClass(thumbclass[align] or 'tright')

		if( align == 'center' or align == 'centre' ) then
			root:addClass('center')
		end
		if( bg ~= '' ) then
			root:css('background-color', bg)
		end

		local div = root:tag('div')
		div:addClass('thumbinner')
		div:css('width', tostring(bodywidth) .. 'px')
			:css('max-width', tostring(bodywidth) .. 'px')
		if( bg ~= '' ) then
			div:css('background-color', bg)
		end
		if( border == 'infobox' or border == 'none') then
			div:css('border', 'none')
		end
		-- add the header
		if( isnotempty(header) ) then
			div:tag('div')
				:addClass('trow')
			local cap = div:tag('div')
					:addClass('theader')
					:css('text-align', pargs['header_align'] or pargs['posición_título'] or 'center')
					:wikitext(header)
			if pargs['fondo_de_título'] and pargs['fondo_de_título']~= '' then
				cap:css('background-color', pargs['fondo_de_título'])
			end
		end
		-- loop through the images
		local k = 0
		for r=1,rowcount do
			local rowdiv = div:tag('div'):addClass('trow');
			for j=1,perrow[r] do
				k = k + 1
				if( k <= imagecount ) then
					local imagediv = rowdiv:tag('div')
					imagediv:addClass('tsingle')
					if bg ~= '' then
						imagediv:css('background-color', bg);
					end
					if ((imagegap > 1) and (j < perrow[r])) then
						imagediv:css('margin-right', tostring(imagegap) .. 'px')
					end
					local i = imagenumbers[k]
					local img = pargs['image' .. i] or pargs['foto' .. i]
					local w = widths[k]
					imagediv:css('width', tostring(2 + w) .. 'px')
						:css('max-width', tostring(2 + w) .. 'px')
					imagediv:wikitext(renderImageCell(img, w, heights[k],
						pargs['link' .. i], pargs['alt' .. i],
						pargs['thumbtime' .. i], pargs['caption' .. i] or pargs['texto' .. i], 
						pargs['alineación_texto' .. i] or pargs['caption_align' .. i] or '',
						imgstyle))
				end
			end
		end
		-- add the footer
		if( isnotempty(footer) ) then
			div:tag('div')
				:addClass('trow')
				:css('display', (falign ~= 'left') and 'flow-root' or 'flex')
			local cap = div:tag('div')
				:addClass('thumbcaption')
				:css('text-align', pargs['posición'] ~= '' and pargs['posición']
					or pargs['footer_align'] ~= pargs['footer_align'] and pargs['footer_align']
					or args['footer_align'] ~= args['footer_align'] and args['footer_align']
					or 'left' )
				:wikitext(footer)
			if pargs['fondo_de_texto'] ~= '' and pargs['fondo_de_texto']
				or pargs['footer_background'] ~= pargs['footer_background'] and pargs['footer_background'] then
					cap:css( 'background-color', pargs['fondo_de_texto'] ~= '' and pargs['fondo_de_texto']
						or pargs['footer_background'] ~= pargs['footer_background'] and pargs['footer_background'] )
			end
		end
		return tostring(root)
	end
	return ''
end

function p.render( frame )
	autoscaledimages = false
	nonautoscaledimages = false

	return frame:extensionTag {name = 'templatestyles', args = {src = 'Imagen múltiple/styles.css', wrapper = ".tmulti"}}
		.. renderMultipleImages( frame )
		.. (autoscaledimages and '[[Categoría:Páginas que usan imágenes múltiples con imágenes escaladas automáticamente]]' or '')
		.. (nonautoscaledimages and '[[Categoría:Páginas que usan imágenes múltiples con imágenes escaladas manualmente]]' or '')
end

return p