No edit summary
No edit summary
Line 3: Line 3:
function p.render(frame)
function p.render(frame)
     local args = frame:getParent().args
     local args = frame:getParent().args
     local size = args["size"] -- optional size
     local size = args["size"] or "200px"
     local output = ""
     local output = ""
 
     local outer_div_style = string.format(' style="width:%s;"', size)
     -- Start the div with hardcoded class
     output = output .. '<div class="outer-container"' .. outer_div_style .. '>\n<div class="image-sequence">\n'
     output = output .. '<div class="image-sequence"><div class="image-sequence-row">'


     local index = 1
     local index = 1
Line 20: Line 19:
         local imageName = args[paramName]
         local imageName = args[paramName]
         if not imageName then
         if not imageName then
             break -- no more images
             break
         end
         end


         -- Add image with optional size
         output = output .. string.format('[[File:%s|thumb|%s]]\n', imageName, 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
         index = index + 1
     end
     end


    -- Close the div
     output = output .. '</div>\n</div>'
     output = output .. '</div></div>'


     return output
     return output

Revision as of 00:48, 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"] or "200px"
    local output = ""
    local outer_div_style = string.format(' style="width:%s;"', size)
    output = output .. '<div class="outer-container"' .. outer_div_style .. '>\n<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[paramName]
        if not imageName then
            break
        end

        output = output .. string.format('[[File:%s|thumb|%s]]\n', imageName, size)

        index = index + 1
    end

    output = output .. '</div>\n</div>'

    return output
end

return p