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