Jump to content

Module:Infobox

From The Petit Planet Wiki
Revision as of 23:51, 9 November 2025 by Cronos (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Module documentation

This module is used to create infoboxes with support for sections, fields, images, tabs, and collapsible sections.

Syntax

  • title — Infobox title.
  • subtitle — Optional subtitle displayed below the title.
  • image — Main infobox image.
  • images — Multiple images, separated by commas.
  • caption — Image caption.
  • sections — Comma-separated list of sections.
  • section — Comma-separated list of fields belonging to the section.
  • field — Value of a field.
  • field_label — Custom label for a field.
  • field_display — Alternative custom label for a field.
  • field_wide — Makes the field span the full width.
  • field_nolabel — Hides the field's label and makes it span the full width.
  • section_label — Custom section heading.
  • section_collapsible — Makes the section collapsible.
  • section_collapsed — Makes the section start collapsed.
  • section_nolabel — Hides the section heading.
  • section_columns — Displays the section as a multi-column grid.
  • tabs — Comma-separated list of tabs.
  • tab_field — Value of a field for a specific tab.
  • tab_label — Custom label for a tab.
  • tab_focused — Makes the tab selected by default.
  • tab_image — Image for a specific tab.
  • tab_caption — Caption for a specific tab.
  • section_tabs — Gives a section its own set of tabs.
  • sep — Changes the separator used for lists. Defaults to a comma.
  • useDivs — Changes the infobox between codediv/code and table markup.
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 )
	:addHeader( 'A header between the data rows' )
	:addRow( 'Bar', args.bar )
	return retval
end

return p