Changes
fix
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
end
local function renderImageCell(image, width, height, link, alt, thumbtime, caption, textalign, istyle, border)
local root = mw.html.create('')
local thumbtimestr = ''
if widthstr == '|-nanpx' then
widthstr = ''
end
if isnotempty( thumbtime ) then
thumbtimestr = '|thumbtime=' .. thumbtime
local imagediv = root:tag('div')
imagediv:addClass((border ~= 'infobox') and 'thumbimage'or nil)
imagediv:cssText(istyle)
if( height ) then
if isnotempty(caption) then
local captiondiv = root:tag('div')
captiondiv:addClass((border ~= 'infobox') and 'thumbcaption'or nil)
if isnotempty(textalign) then
captiondiv:addClass('text-align-' .. textalign)
local pargs = frame:getParent().args
local args = frame.args
local width = removepx(pargs['width'] or '')
local dir = pargs['direction'] or ''
local border = pargs['border'] or args['border'] or ''
local align = pargs['align'] or args['align'] or (border == 'infobox' and 'center' or '')
local capalign = pargs['caption_align'] or args['caption_align'] or ''
local totalwidth = removepx(pargs['total_width'] or args['total_width'] or '')
local imgstyle = pargs['image_style'] or args['image_style']
local header = pargs['header'] or pargs['title'] or ''
local div = root:tag('div')
div:addClass((border ~= 'infobox') and 'thumbinnermultiimageinner' or 'multiimageinner')
div:css('width', tostring(bodywidth) .. 'px')
:css('max-width', tostring(bodywidth) .. 'px')
:tag('div')
:addClass('theader')
:css('text-align', pargs['header_align'] or 'center') :css('background-color', pargs['header_background'] or 'transparent')
:wikitext(header)
end
imagediv:wikitext(renderImageCell(img, w, heights[k],
pargs['link' .. i], pargs['alt' .. i],
pargs['thumbtime' .. i], pargs['caption' .. i], capalign, imgstyle, border))
end
end
-- add the footer
if( isnotempty(footer) ) then
local falign = string.lower(pargs['footer_align'] or args['footer_align'] or 'left')
falign = (falign == 'centre') and 'center' or falign
div:tag('div')
:addClass('trow')
:css('display', (falign ~= '') and 'flow-root' or 'flex')
:tag('div')
:addClass('thumbcaption' .. (falign =border ~= 'centerinfobox' ) and '-centerthumbcaption' or '')nil) :css('text-align', (falign ~= 'left') and falign or nil) :css('background-color', pargs['footer_background'] or 'transparent')
:wikitext(footer)
end