<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://cherry-pi.tailb1a250.ts.net/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfoboxLua%2FComponents%2FHeader</id>
	<title>Module:InfoboxLua/Components/Header - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://cherry-pi.tailb1a250.ts.net/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfoboxLua%2FComponents%2FHeader"/>
	<link rel="alternate" type="text/html" href="https://cherry-pi.tailb1a250.ts.net/index.php?title=Module:InfoboxLua/Components/Header&amp;action=history"/>
	<updated>2026-11-11T01:08:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://cherry-pi.tailb1a250.ts.net/index.php?title=Module:InfoboxLua/Components/Header&amp;diff=364&amp;oldid=prev</id>
		<title>Gravy: Created page with &quot;require( &#039;strict&#039; )  local tabber = mw.ext.tabber local util = require( &#039;Module:InfoboxLua/Util&#039; ) local types = require( &#039;Module:InfoboxLua/Types&#039; )  local p = {}   --- @param image ImageComponentData|string --- @return mw.html local function getImageHtml( image ) 	if type( image ) == &#039;string&#039; then 		image = { src = image } 	end  	local imageData = util.validateAndConstruct( image, types.ImageComponentDataSchema )  	local root = mw.html.create( &#039;div&#039; ) 	root:addClass( &#039;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://cherry-pi.tailb1a250.ts.net/index.php?title=Module:InfoboxLua/Components/Header&amp;diff=364&amp;oldid=prev"/>
		<updated>2026-06-14T02:20:34Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;require( &amp;#039;strict&amp;#039; )  local tabber = mw.ext.tabber local util = require( &amp;#039;Module:InfoboxLua/Util&amp;#039; ) local types = require( &amp;#039;Module:InfoboxLua/Types&amp;#039; )  local p = {}   --- @param image ImageComponentData|string --- @return mw.html local function getImageHtml( image ) 	if type( image ) == &amp;#039;string&amp;#039; then 		image = { src = image } 	end  	local imageData = util.validateAndConstruct( image, types.ImageComponentDataSchema )  	local root = mw.html.create( &amp;#039;div&amp;#039; ) 	root:addClass( &amp;#039;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require( &amp;#039;strict&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
local tabber = mw.ext.tabber&lt;br /&gt;
local util = require( &amp;#039;Module:InfoboxLua/Util&amp;#039; )&lt;br /&gt;
local types = require( &amp;#039;Module:InfoboxLua/Types&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--- @param image ImageComponentData|string&lt;br /&gt;
--- @return mw.html&lt;br /&gt;
local function getImageHtml( image )&lt;br /&gt;
	if type( image ) == &amp;#039;string&amp;#039; then&lt;br /&gt;
		image = { src = image }&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local imageData = util.validateAndConstruct( image, types.ImageComponentDataSchema )&lt;br /&gt;
&lt;br /&gt;
	local root = mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
	root:addClass( &amp;#039;t-infobox-image-container&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
	root:tag( &amp;#039;div&amp;#039; )&lt;br /&gt;
		:addClass( &amp;#039;t-infobox-image&amp;#039; )&lt;br /&gt;
		:wikitext( string.format( &amp;#039;[[File:%s|%dpx|class=%s]]&amp;#039;, imageData.src, imageData.size, imageData.class or &amp;#039;&amp;#039; ) )&lt;br /&gt;
		:done()&lt;br /&gt;
&lt;br /&gt;
	if util.isNonEmptyString( imageData.overlay ) then&lt;br /&gt;
		root:tag( &amp;#039;div&amp;#039; )&lt;br /&gt;
			:addClass( &amp;#039;t-infobox-image-overlay&amp;#039; )&lt;br /&gt;
			:wikitext( imageData.overlay )&lt;br /&gt;
			:done()&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return root&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- @param images ImageComponentData[]&lt;br /&gt;
--- @return mw.html&lt;br /&gt;
local function getImagesHtml( images )&lt;br /&gt;
	local root = mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
	root:addClass( &amp;#039;t-infobox-images&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
	local tabberData = {}&lt;br /&gt;
&lt;br /&gt;
	for i, image in ipairs( images ) do&lt;br /&gt;
		if util.validateAndConstruct( image, types.ImageComponentDataSchema ) then&lt;br /&gt;
			table.insert( tabberData, {&lt;br /&gt;
				label = image.label or tostring( i ),&lt;br /&gt;
				content = tostring( getImageHtml( image ) )&lt;br /&gt;
			} )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if tabberData ~= {} then&lt;br /&gt;
		root:node( tabber.render( tabberData ) )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return root&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- @param title string&lt;br /&gt;
--- @return mw.html&lt;br /&gt;
local function getHeaderTitleHtml( title )&lt;br /&gt;
	local root = mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
	root:addClass( &amp;#039;t-infobox-title&amp;#039; )&lt;br /&gt;
	root:wikitext( title )&lt;br /&gt;
	return root&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- @param subtitle string&lt;br /&gt;
--- @return mw.html&lt;br /&gt;
local function getHeaderSubtitleHtml( subtitle )&lt;br /&gt;
	local root = mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
	root:addClass( &amp;#039;t-infobox-subtitle&amp;#039; )&lt;br /&gt;
	root:wikitext( subtitle )&lt;br /&gt;
	return root&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- @param title string&lt;br /&gt;
--- @param subtitle string&lt;br /&gt;
--- @return mw.html&lt;br /&gt;
local function getHeaderContentHtml( title, subtitle )&lt;br /&gt;
	local root = mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
	root:addClass( &amp;#039;t-infobox-header-content&amp;#039; )&lt;br /&gt;
	root:node( getHeaderTitleHtml( title ) )&lt;br /&gt;
&lt;br /&gt;
	if util.isNonEmptyString( subtitle ) then&lt;br /&gt;
		root:node( getHeaderSubtitleHtml( subtitle ) )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return root&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the mw.html object of the infobox header component.&lt;br /&gt;
---&lt;br /&gt;
--- @param data table&lt;br /&gt;
--- @return mw.html|nil&lt;br /&gt;
function p.getHtml( data )&lt;br /&gt;
	--- @type HeaderComponentData|nil&lt;br /&gt;
	local header = util.validateAndConstruct( data, types.HeaderComponentDataSchema )&lt;br /&gt;
&lt;br /&gt;
	if not header then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local root = mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
	root:addClass( &amp;#039;t-infobox-header&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
	if type( header.images ) == &amp;#039;table&amp;#039; then&lt;br /&gt;
		root:node( getImagesHtml( header.images ) )&lt;br /&gt;
	elseif type( header.image ) == &amp;#039;table&amp;#039; then&lt;br /&gt;
		root:node( getImageHtml( header.image ) )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	root:node( getHeaderContentHtml( header.title, header.subtitle ) )&lt;br /&gt;
&lt;br /&gt;
	return root&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Gravy</name></author>
	</entry>
</feed>