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 = args['images'] or ''
local texts = args['texts'] or ''
local imageList = mw.text.split(images, ',')
local textList = mw.text.split(texts, ',')
local html = mw.html.create('div'):addClass('image-grid-container')
for i = 1, math.max(#imageList, #textList) do
local image = mw.text.trim(imageList[i] or 'Noimg.png')
local text = mw.text.trim(textList[i] or '')
local imageWrapper = html:tag('div'):addClass('image-wrapper')
imageWrapper:wikitext(string.format('[[File:%s|200px]]', image))
if text ~= '' then
imageWrapper:tag('div'):addClass('image-text'):wikitext(text)
end
end
return tostring(html)
end
return p