Module:BoardInfoBox: Difference between revisions

From EarthMC Wiki
Jump to navigation Jump to search
Created page with "local capiunto = require 'capiunto' local p = {} function p.main(frame) local args = frame:getParent().args local headerStyle if args.headerstyle and args.headerstyle ~= '' then headerStyle = string.format('background-color:%s;', args.headerstyle) else headerStyle = 'background-color:grey;' end local retval = capiunto.create( { title = args.title, headerStyle = headerStyle, } ) :addImage( args.image, args.caption ) :addRow( 'Foo', args.foo ) :addHead..."
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
local capiunto = require 'capiunto'
local capiunto = require 'capiunto'


Line 5: Line 6:
function p.main(frame)
function p.main(frame)
local args = frame:getParent().args
local args = frame:getParent().args
local headerStyle
local headerStyle
if args.headerstyle and args.headerstyle ~= '' then
if args.headerstyle and args.headerstyle ~= '' then
Line 11: Line 13:
headerStyle = 'background-color:grey;'
headerStyle = 'background-color:grey;'
end
end
local retval = capiunto.create( {
 
local retval = capiunto.create({
title = args.title,
title = args.title,
headerStyle = headerStyle,  
headerStyle = headerStyle,
} )
})
:addImage( args.image, args.caption )
 
:addRow( 'Foo', args.foo )
retval:addRow('Session', args.session)
:addHeader( 'A header between the data rows' )
 
:addRow( 'Bar', args.bar )
local members = {}
 
for i = 1, 100 do
local name = args['member' .. i]
 
if name and name ~= '' then
table.insert(members, '* ' .. name .. '')
end
end
 
if #members > 0 then
retval:addWikitext(
"'''Members'''\n" .. table.concat(members, '\n')
)
end
 
return retval
return retval
end
end


return p
return p

Latest revision as of 22:05, 13 October 2026

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


local capiunto = require 'capiunto'

local p = {}

function p.main(frame)
	local args = frame:getParent().args

	local headerStyle
	if args.headerstyle and args.headerstyle ~= '' then
		headerStyle = string.format('background-color:%s;', args.headerstyle)
	else
		headerStyle = 'background-color:grey;'
	end

	local retval = capiunto.create({
		title = args.title,
		headerStyle = headerStyle,
	})

	retval:addRow('Session', args.session)

	local members = {}

	for i = 1, 100 do
		local name = args['member' .. i]

		if name and name ~= '' then
			table.insert(members, '* ' .. name .. '')
		end
	end

	if #members > 0 then
		retval:addWikitext(
			"'''Members'''\n" .. table.concat(members, '\n')
		)
	end

	return retval
end

return p