Module:Infobox

From Guinea Isles Wiki
Revision as of 08:15, 19 September 2025 by Squeaky (talk | contribs)

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

--------------------------
-- Module for generic Infobox parent
------------------------
local capiunto = require 'capiunto'

local p = {}

-- Helper functions
function boolToYesNo(val)
	local accepted_yes = {1, "1", "True", "true", "yes", "Yes"}
	for _, v in pairs(accepted_yes) do
		if val == v then
			return "Yes"
		end
	end
	
	return "No"
end

-- Infobox class
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, 
	} )
	return retval
end

return p