Module:ImageSequence

Revision as of 23:32, 22 November 2025 by Cobblemon (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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">\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 -- 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>'

    return output
end

return p