Module:Columns

MDFW - The Mystery Dungeon Tree of Information.
Jump to navigation Jump to search

Documentation for this module may be created at Module:Columns/doc

--------------------------------------------------------------------------------
--
--								Module:Columns
--
--------------------------------------------------------------------------------

local p = {}
local mw = require('mw')

function p.main(frame)
	local args = frame.args
	local output = mw.html.create()

	-- Cell rows
	local rows = mw.html.create()
	local i = 1
	
	while true do
		local cellArg = args["cell_" .. i]
		
		if not cellArg then
			break -- exit loop when no more rows are found
		end
		
		rows
			:node(cellArg)
			:allDone()
		i = i + 1
	end
	
	output
		:tag('div'):cssText("display: flex; flex-flow: row wrap; justify-content: space-evenly;")
		:node(rows)
	return tostring(output)
end

return p