More actions
Documentation for this module may be created at Module:ImageGrid/doc
local p = {}
function p.renderImageGrid(frame)
local args = frame:getParent().args
local images = mw.text.split(args['images'], ',')
local texts = mw.text.split(args['texts'], ',')
local imageCount = #images
local html = mw.html.create('div'):addClass('image-grid-container')
for i = 1, imageCount do
local imageWrapper = html:tag('div'):addClass('image-wrapper')
local imageTag = imageWrapper:tag('img')
:attr('src', images[i])
:attr('alt', texts[i] or '')
local textTag = imageWrapper:tag('div'):addClass('image-text'):wikitext(texts[i] or '')
end
return tostring(html)
end
return p