« Module:Gallery » : différence entre les versions

Contenu supprimé Contenu ajouté
ManiacParisien (discuter | contributions)
ligne 87 : '7px 6px 1px 6px' en '9px 6px 1px 6px'
Ricordisamoa (discuter | contributions)
Ligne 2 :
 
local p = {}
 
local HtmlBuilder = require('Module:HtmlBuilder')
 
function trim(s)
Ligne 10 ⟶ 8 :
 
local function _gallery(args)
local tbl = HtmlBuildermw.html.create('table')
if args.style then
tbl.:cssText(args.style)
else
tbl
.:css('background', 'transparent')
.:css('border', '1px solid #f0f0f0')
.:css('margin-top', '0.5em')
end
if args.align then
tbl.:attr('align', args.align)
end
if args.title then
tbl
.:tag('tr')
.:tag('td')
.:attr('colspan', 10)
.:css('text-align', 'center')
.:css('font-weight', 'bold')
.:wikitext(args.title)
end
local mainCell = tbl.:tag('tr').:tag('td')
local imageCount = math.ceil(#args / 2)
Ligne 56 ⟶ 54 :
 
if img ~= '' then
local imgTbl = mainCell.:tag('table')
imgTbl
.:css('width', (cellWidth + 20) .. 'px')
.:css('float', 'left')
.:css('border-collapse', 'collapse')
.:css('margin', '3px')
.:tag('tr')
.:tag('td')
.:css('height', (imgHeight + 20) .. 'px')
.:css('border', '1px solid #CCCCCC')
.:css('background-color', '#F8F8F8')
.:css('padding', '0px')
.:css('text-align', 'center')
.:wikitext(mw.ustring.format('[[%s|center|%dx%dpx|alt=%s|%s]]', img, imgWidth, imgHeight, alt, caption))
.:done()
.:done()
.:tag('tr')
.:css('vertical-align', 'top')
.:tag('td')
.:css('display', 'block')
.:css('font-size', '1em')
.:css('height', (0.2 + 1.5*lines) .. 'em')
.:css('padding', '0px')
.:tag('div')
.:addClass('gallerytext')
.:css('height', (0.1 + 1.5*lines) .. 'em')
.:css('width', textWidth .. 'px')
.:css('line-height', '1.3em')
.:css('padding', '9px 6px 1px 6px')
.:css('overflow-y', 'auto')
.:css('margin', '0px')
.:css('border', 'none')
.:css('border-width', '0px')
.:wikitext(caption .. ' ')
end
end
Ligne 96 ⟶ 94 :
if args.footer then
tbl
.:tag('tr')
.:tag('td')
.:attr('colspan', 10)
.:css('text-align', 'right')
.:css('font-size', '80%')
.:css('line-height', '1em')
.:wikitext(args.footer)
end
Ce document provient de « https://fr.wikipedia.org/wiki/Module:Gallery ».