Module:Infobox Event

From Brighter Shores Wiki
Jump to navigation Jump to search
Module documentation
This documentation is transcluded from Module:Infobox Event/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Infobox Event/doc. [edit]
Module:Infobox Event requires Module:Infobox.
Module:Infobox Event requires Module:Param Parse.

local p = {}

local Infobox = require('Module:Infobox')
local parse = require('Module:Param Parse')

function p.main(frame)
	local args = frame:getParent().args
	
	local config = {
		infobox_name = 'Event'
	}
	
	local params = {
		parse.name,
		parse.image,
		parse.release,
		parse.removal,
		parse.predecessor,
		parse.successor
	}
	
	local infobox = Infobox.new(config, params, args)
	infobox
		:add_row{
			{tag='th', content=Infobox.param('name'), class='infobox-header', colspan='20'},
		}
		:add_row{
			{tag='td', content=Infobox.param('image'), class='infobox-image', colspan='20'},
		}
		:add_row{
			{tag='th', content='Release', colspan="6"},
			{tag='td', content=Infobox.param('release'), colspan="14"},
		}
		:add_row{
			{tag='th', content='Removal', colspan="6"},
			{tag='td', content=Infobox.param('removal'), colspan="14"},
		}
	local has_predecessor = infobox:is_param_defined(Infobox.param('predecessor')) > 0
	if has_predecessor then
		infobox:add_row{
			{tag='th', content='Predecessor', colspan="6", rowspan="2"},
			{tag='td', content=Infobox.param('predecessor'), colspan="14"},
		}
	end
	local has_successor = infobox:is_param_defined(Infobox.param('successor')) > 0
	if has_successor then
		infobox:add_row{
			{tag='th', content='Successor', colspan="6", rowspan="2"},
			{tag='td', content=Infobox.param('successor'), colspan="14"},
		}
	end
	infobox:pad('20')
	
	return infobox
end

return p