Module:ImageSequence: Difference between revisions
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 | 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 .. " center" | |||
end | |||
local outer_div_style = string.format(' style="width:%s;"', width) | |||
local output = "" | local output = "" | ||
output = output .. string.format('<div class="%s"%s>\n', classes, outer_div_style) | |||
local index = 1 | local index = 1 | ||
| Line 22: | Line 35: | ||
end | end | ||
output = output .. string.format('[[File:%s|%s]]\n', imageName, | output = output .. string.format('[[File:%s|%s]]\n', imageName, width) | ||
index = index + 1 | index = index + 1 | ||
end | end | ||
output = output .. ' | output = output .. '</div>' | ||
return output | return output | ||
Revision as of 02:55, 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 .. " center"
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