Module:Image array: Difference between revisions

no edit summary
m (1 revision imported)
No edit summary
Tag: Reverted
Line 7: Line 7:
end
end


local function renderArrayCell( img, c, a, b, l, tc, t, w, h)
local function renderArrayCell(img, c, a, b, l, tc, t, width, height)
local alt = isnotempty(a) and ('|alt=' .. a) or ''
    local alt = isnotempty(a) and ('|alt=' .. a) or ''
local link = isnotempty(l) and ('|link=' .. l) or ''
    local link = isnotempty(l) and ('|link=' .. l) or ''
local text = (isnotempty(tc) and not isnotempty(t))  
    local text = (isnotempty(tc) and not isnotempty(t)) and mw.text.unstrip(c) or mw.text.unstrip(t or '')
and mw.text.unstrip(c) or mw.text.unstrip(t or '')
    local border = isnotempty(b) and '|border' or ''
local border = isnotempty(b) and '|border' or ''
       
    local cell = mw.html.create('')
local cell = mw.html.create('')
    if (img) then
if( img ) then
        cell:tag('div')
cell:tag('div')
            :css('display', 'table-cell')
:css('display', 'table-cell')
            :css('vertical-align', 'middle')
:css('vertical-align', 'middle')
            :css('width', width .. 'px')   -- Set the same width for all images
:css('width', w .. 'px')
            :css('height', height .. 'px') -- Set the same height for all images
:css('height', h .. 'px')
            :css('margin-left', 'auto')
:css('margin-left', 'auto')
            :css('margin-right', 'auto')
:css('margin-right', 'auto')
            :wikitext(mw.ustring.format('[[File:%s|%dx%dpx%s|%s]]', img, width, height, alt .. link .. border, text))
:wikitext(mw.ustring.format('[[File:%s|%dx%dpx%s|%s]]',  
        cell:tag('div')
img, w, h, alt .. link .. border, text))
            :css('padding', '1px')
cell:tag('div')
            :wikitext(c)
:css('padding', '1px')
    end
:wikitext(c)
   
end
    return tostring(cell)
return tostring(cell)
end
end


local function imagearray( frame )
local function imagearray( frame )