No edit summary
No edit summary
Line 13: Line 13:
     local classes = "image-sequence"
     local classes = "image-sequence"
     if center_class then
     if center_class then
         classes = classes .. " center"
         classes = classes .. " centered"
     end
     end



Revision as of 02:57, 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 width = args["width"] or "200px"

    local center_class = false
    if args["center"] then
        center_class = true
        args["center"] = nil
    end

    local classes = "image-sequence"
    if center_class then
        classes = classes .. " centered"
    end

    local outer_div_style = string.format(' style="width:%s;"', width)

    local output = ""
    output = output .. string.format('<div class="%s"%s>\n', classes, outer_div_style)

    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|%s]]\n', imageName, width)

        index = index + 1
    end

    output = output .. '</div>'

    return output
end

return p