Jump to content

Module:Flexbox

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SilverLocust (talk | contribs) at 22:38, 16 February 2025 (Convert Template:Flexbox to Lua). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.main(frame)
	local args = getArgs(frame)
	local style = args["style"] or ""
	local minwidth = args["min-width"] or ""
	local maxwidth = args["max-width"] or ""
	local padding = args["padding"] or ""
	local ret = '<div style="display:flex; flex-wrap:wrap; '..style..'">'
	local n = 1
	while args[n] do
		ret = ret .. '<div style="flex:1 1 0; min-width:'..minwidth..'; max-width:'..maxwidth..'; padding:'..padding..';">'..args[1]..'</div>'
		n = n + 1
	end
	ret = ret .. '</div>'
	return ret
end

return p