-- nowiki
local p = require('Dev:PortableNavbox')
-- Creates a horizontal list where two items are stacked on top of each other, typically an image and a caption
-- Odd arguments are the top item
-- Even arguments are the bottom item
function p.stackedList(frame)
local args = frame.args
local list = {
'<div style<nowiki>=</nowiki>"display: flex; flex-wrap: wrap; gap: 1em; text-align: center; align-items: center;">'
}
for key, value in ipairs(args) do
local i = tonumber(key)
if key and value then
i = i - 1
if i % 2 == 0 then
table.insert(list, '<span>')
table.insert(list, mw.text.trim(value))
table.insert(list, '<br />')
else
table.insert(list, mw.text.trim(value))
table.insert(list, '</span>')
end
end
end
table.insert(list, '</div>')
return table.concat(list)
end
return p
Advertisement
Module:PortableNavbox
Advertisement