Module:ImageSequence: Difference between revisions
(Created page with "local p = {} function p.render(frame) local args = frame:getParent().args local size = args["size"] -- optional size local output = "" -- Start the div with hardcoded class output = output .. '<div class="image-sequence">\n' local index = 1 while true do local paramName if index == 1 then paramName = "image" else paramName = "image" .. index end local imageName = args[paramNam...") |
No edit summary |
||
| Line 7: | Line 7: | ||
-- Start the div with hardcoded class | -- Start the div with hardcoded class | ||
output = output .. '<div class="image-sequence"> | output = output .. '<div class="image-sequence"><div class="image-sequence-row">' | ||
local index = 1 | local index = 1 | ||
| Line 34: | Line 34: | ||
-- Close the div | -- Close the div | ||
output = output .. '</div>' | output = output .. '</div></div>' | ||
return output | return output | ||
Revision as of 00:24, 23 November 2025
Documentation for this module may be created at Module:ImageSequence/doc
local p = {}
function p.render(frame)
local args = frame:getParent().args
local size = args["size"] -- optional size
local output = ""
-- Start the div with hardcoded class
output = output .. '<div class="image-sequence"><div class="image-sequence-row">'
local index = 1
while true do
local paramName
if index == 1 then
paramName = "image"
else
paramName = "image" .. index
end
local imageName = args[paramName]
if not imageName then
break -- no more images
end
-- Add image with optional size
if size then
output = output .. string.format('[[File:%s|thumb|%s]]\n', imageName, size)
else
output = output .. string.format('[[File:%s]]\n', imageName)
end
index = index + 1
end
-- Close the div
output = output .. '</div></div>'
return output
end
return p