Module: CardGrid

From Travel Strategies
Jump to: navigation, search

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

local p = {}

function p.output(frame)
	local text = "<div class =\"row\">\r"
	local i = 1
	while frame.args[i] ~= nil do
		cardtext = frame:expandTemplate{title = 'Card', args = {frame.args[i],'below'}}
		text = text .. "<div class = \"col-md-4 col-sm-4 col-xs-6\">"
		text = text .. cardtext .. "\r\r</div>\r"
		if math.fmod(i,3) == 0 then
			text = text .. "<div class = \"clearfix visible-md visible-lg\"></div>\r"
		end
		if math.fmod(i,3) == 0 then
			text = text .. "<div class = \"clearfix visible-sm\"></div>\r"
		end
		if math.fmod(i,2) == 0 then
			text = text .. "<div class = \"clearfix visible-xs\"></div>\r"
		end
		i = i + 1
	end
	text = text .. "</div>\r"
	return text
end

return p