模块:PackedGallery
来自生物多样性知识平台
可在模块:PackedGallery/doc创建此模块的帮助文档
local p = {}
local html = require('mw.html')
function p.renderGallery(frame)
local images = frame.args.images or ""
local imageList = mw.text.split(images, ",")
local gallery = html.create('gallery')
gallery
:attr('mode', 'packed')
:attr('widths', '120px')
for i, image in ipairs(imageList) do
local parts = mw.text.split(image, ";")
local fileName = parts[1] or ""
local fileDesc = parts[2] or ""
gallery:wikitext(string.format('File:%s|%s', mw.text.trim(fileName), mw.text.trim(fileDesc)))
end
return tostring(gallery)
end
return p