<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfobox_ship</id>
	<title>Module:Infobox ship - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfobox_ship"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Infobox_ship&amp;action=history"/>
	<updated>2026-05-26T00:24:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Infobox_ship&amp;diff=136989&amp;oldid=prev</id>
		<title>imported&gt;WOSlinker: use require(&#039;strict&#039;) instead of require(&#039;Module:No globals&#039;)</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Infobox_ship&amp;diff=136989&amp;oldid=prev"/>
		<updated>2022-10-22T12:04:11Z</updated>

		<summary type="html">&lt;p&gt;use require(&amp;#039;strict&amp;#039;) instead of require(&amp;#039;Module:No globals&amp;#039;)&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 utilities = require (&amp;#039;Module:WPSHIPS_utilities&amp;#039;);&lt;br /&gt;
local infobox_ship_flag = utilities._infobox_ship_flag;&lt;br /&gt;
local ship_name_format = utilities._ship_name_format;&lt;br /&gt;
local synonym_check = utilities._synonym_check;&lt;br /&gt;
local unbulleted_list = utilities._unbulleted_list;&lt;br /&gt;
&lt;br /&gt;
local get_args = require (&amp;#039;Module:Arguments&amp;#039;).getArgs;&lt;br /&gt;
&lt;br /&gt;
local data = mw.loadData (&amp;#039;Module:Infobox_ship/data&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
local namespace = mw.title.getCurrentTitle().namespace;&lt;br /&gt;
local has_unknown_params = false;&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I N E _ I T E M S &amp;gt;-----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
spin through &amp;lt;params_t&amp;gt; sequence.  Get parameter name and matching infobox label.  Look in &amp;lt;args_t&amp;gt; for parameter name.  When parameter&lt;br /&gt;
name has a value, add infobox label and parameter value to the infobox table &amp;lt;infobox_ship_t&amp;gt;.  &amp;lt;i&amp;gt; identifies where label and data&lt;br /&gt;
enumerators begin.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function line_items (args_t, params_t, infobox_ship_t, i, frame)&lt;br /&gt;
	for _, v in ipairs (params_t) do											-- v is a sequence table with parameter name and associated infobox label&lt;br /&gt;
		if args_t[v[1]] then													-- if parameter has a value&lt;br /&gt;
			infobox_ship_t[&amp;#039;label&amp;#039; .. i] = v[2];								-- add the label&lt;br /&gt;
			infobox_ship_t[&amp;#039;data&amp;#039; .. i] = unbulleted_list (args_t[v[1]]);		-- and add the parameter value as data&lt;br /&gt;
			i = i + 1;															-- bump the enumerator&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; U N K N O W N _ P A R A M S _C H E C K &amp;gt;---------------------------------------&lt;br /&gt;
&lt;br /&gt;
check parameters supplyed in &amp;lt;template&amp;gt; against known parameters for that template.  Emit preview warning when&lt;br /&gt;
a parameter is unknown.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function unknown_params_check (args_t, known_params_t, template)&lt;br /&gt;
	for k, v in pairs (args_t) do&lt;br /&gt;
		local param = k:gsub (&amp;#039;%d+$&amp;#039;, &amp;#039;#&amp;#039;);										-- for enumerated parameters, replace enumerator with &amp;#039;#&amp;#039;&lt;br /&gt;
		if not known_params_t[param] then										-- add warning message when &amp;lt;param&amp;gt; is not known for &amp;lt;template&amp;gt;&lt;br /&gt;
			mw.addWarning (string.format (data.warning_fmt_str, data.warn_span_style, data.warn_code_style, template, template, data.warn_code_style, k, v));&lt;br /&gt;
			has_unknown_params = (0 == namespace);								-- add unknown params category when infobox is rendered; mainspace only&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N F O B O X _ S H I P _ B E G I N &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
fill infobox table parameters &amp;#039;bodystyle&amp;#039; and &amp;#039;title&amp;#039; (infobox caption); auto-article title formatting ({{DISPLAYTITLE}})&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function infobox_ship_begin (args_t, infobox_ship_t, frame)&lt;br /&gt;
	infobox_ship_t[&amp;#039;bodystyle&amp;#039;] = data.styles_t.mainbox;&lt;br /&gt;
	if args_t.infobox_caption then&lt;br /&gt;
		local name = mw.title.getCurrentTitle().text;&lt;br /&gt;
		if &amp;#039;yes&amp;#039; == args_t.infobox_caption then									-- format article title as infobox caption&lt;br /&gt;
			infobox_ship_t.title = ship_name_format ({name=name, adj=&amp;#039;off&amp;#039;, showerrs=args_t.showerrs, sclass=args_t.sclass});&lt;br /&gt;
		elseif &amp;#039;nodab&amp;#039; == args_t.infobox_caption then							-- format article title without disambiguation as infobox caption&lt;br /&gt;
			infobox_ship_t.title = ship_name_format ({name=name, dab=&amp;#039;none&amp;#039;, showerrs=args_t.showerrs});&lt;br /&gt;
		else																	-- use value supplied in |infobox_caption= as infobox caption&lt;br /&gt;
			infobox_ship_t.title = args_t.infobox_caption;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		infobox_ship_t.title = &amp;#039;&amp;#039;;												-- to allow for possible displaytitle concatenation&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args_t.display_title and (&amp;#039;none&amp;#039; ~= args_t.display_title) then			-- any value but &amp;#039;none&amp;#039;&lt;br /&gt;
		if &amp;#039;ital&amp;#039; == args_t.display_title then									-- use {{italic title}} template&lt;br /&gt;
			infobox_ship_t.title = infobox_ship_t.title .. frame:expandTemplate ({title=&amp;#039;italic title&amp;#039;});&lt;br /&gt;
		else																	-- use value in |display_title= for {{DISPLAYTITLE}} magic word&lt;br /&gt;
			infobox_ship_t.title = infobox_ship_t.title .. frame:preprocess (&amp;#039;{{DISPLAYTITLE:&amp;#039; .. args_t.display_title .. &amp;#039;}}&amp;#039;);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N F O B O X _ S H I P _ I M A G E &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Returns a child infobox for Infobox ship&lt;br /&gt;
&lt;br /&gt;
TODO: allow stand-alone when |child= set to anything but &amp;#039;yes&amp;#039;?  How do that?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function infobox_ship_image (frame)&lt;br /&gt;
	local args_t = get_args (frame);&lt;br /&gt;
	local infobox_ship_t = {&lt;br /&gt;
		child = args_t.child or &amp;#039;yes&amp;#039;;											-- default to child&lt;br /&gt;
		image1 = frame:callParserFunction ({name=&amp;#039;#invoke&amp;#039;, args = {&amp;#039;InfoboxImage&amp;#039;, &amp;#039;InfoboxImage&amp;#039;, image=args_t.image, size=args_t.image_size, alt=args_t.image_alt, sizedefault = &amp;#039;300px&amp;#039;, upright=&amp;#039;1&amp;#039;}});&lt;br /&gt;
		caption1 = args_t.image_caption;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	unknown_params_check (args_t, data.known_infobox_ship_image_params_t, &amp;#039;Infobox ship/image&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
	return frame:expandTemplate ({title=&amp;#039;Infobox&amp;#039;, args = infobox_ship_t});		-- return a rendering of this infobox&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N F O B O X _ S H I P _ C A R E E R &amp;gt;----------------------------------------&lt;br /&gt;
&lt;br /&gt;
Returns a child infobox&lt;br /&gt;
&lt;br /&gt;
TODO: allow stand-alone when |child= set to anything but &amp;#039;yes&amp;#039;?  How do that?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function infobox_ship_career (frame)&lt;br /&gt;
	local args_t = get_args (frame);&lt;br /&gt;
	args_t.hide_header= args_t.hide_header and args_t.hide_header:lower();		-- set to lowercase if set&lt;br /&gt;
&lt;br /&gt;
	local infobox_ship_t = {&lt;br /&gt;
		child = args_t.child or &amp;#039;yes&amp;#039;;											-- default to child&lt;br /&gt;
		headerstyle = data.styles_t.country;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	local i = 1;&lt;br /&gt;
&lt;br /&gt;
	if &amp;#039;yes&amp;#039; ~= args_t.hide_header then											-- |hide_header=yes then no header&lt;br /&gt;
		if not (&amp;#039;title&amp;#039; == args_t.hide_header) then								-- |hide_header=title then no title bar&lt;br /&gt;
			local spoof_t = {&lt;br /&gt;
				child = &amp;#039;yes&amp;#039;;													-- default to child&lt;br /&gt;
				decat = &amp;#039;yes&amp;#039;;													-- spoof infobox does not have data; don&amp;#039;t categorize in Category:Articles using infobox templates with no data rows&lt;br /&gt;
				headerstyle = data.styles_t.history;&lt;br /&gt;
				header1 = &amp;#039;History&amp;#039;;&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
			infobox_ship_t.data1 = frame:expandTemplate ({title=&amp;#039;Infobox&amp;#039;, args = spoof_t});	-- return a rendering of this spoof infobox&lt;br /&gt;
			i = i + 1;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if args_t.ship_country and args_t.ship_flag then&lt;br /&gt;
			infobox_ship_t[&amp;#039;header&amp;#039; .. i] = infobox_ship_flag (args_t.ship_flag) .. &amp;#039;&amp;lt;span style=&amp;quot;padding-left:1em&amp;quot;&amp;gt;&amp;#039; .. args_t.ship_country .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;;&lt;br /&gt;
		elseif args_t.ship_country then&lt;br /&gt;
			infobox_ship_t[&amp;#039;header&amp;#039; .. i] = args_t.ship_country;&lt;br /&gt;
		elseif args_t.ship_flag then&lt;br /&gt;
			infobox_ship_t[&amp;#039;header&amp;#039; .. i] = infobox_ship_flag (args_t.ship_flag);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if infobox_ship_t[&amp;#039;header&amp;#039; .. i] then&lt;br /&gt;
		i = i + 1;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local error_flag;&lt;br /&gt;
	error_flag = synonym_check (args_t, &amp;#039;ship_stricken&amp;#039;, &amp;#039;ship_struck&amp;#039;, error_flag);	-- error if both synonymous parameters set&lt;br /&gt;
	synonym_check (args_t, &amp;#039;ship_honours&amp;#039;, &amp;#039;ship_honors&amp;#039;, error_flag);&lt;br /&gt;
&lt;br /&gt;
	line_items (args_t, data.infobox_career_params_t, infobox_ship_t, i, frame);		-- go do all of the other infobox parameters&lt;br /&gt;
	unknown_params_check (args_t, data.known_infobox_ship_career_params_t, &amp;#039;Infobox ship/career&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
	return frame:expandTemplate ({title=&amp;#039;Infobox&amp;#039;, args = infobox_ship_t});		-- return a rendering of this infobox&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N F O B O X _ S H I P _ C H A R A C T E R I S T I C S &amp;gt;----------------------&lt;br /&gt;
&lt;br /&gt;
Returns a child infobox (default); may be called independently&lt;br /&gt;
&lt;br /&gt;
TODO: allow stand-alone when |child= set to anything but &amp;#039;yes&amp;#039;?  How do that?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function infobox_ship_characteristics (frame)&lt;br /&gt;
	local args_t = get_args (frame);&lt;br /&gt;
	args_t.hide_header= args_t.hide_header and args_t.hide_header:lower();		-- set to lowercase if set&lt;br /&gt;
&lt;br /&gt;
	local infobox_ship_t = {&lt;br /&gt;
		child = args_t.child or &amp;#039;yes&amp;#039;,											-- default to child&lt;br /&gt;
		headerstyle = data.styles_t.general,&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	local i = 1;&lt;br /&gt;
&lt;br /&gt;
	if &amp;#039;yes&amp;#039; ~= args_t.hide_header then											-- |hide_header=yes then no header&lt;br /&gt;
		local header = &amp;#039;General characteristics&amp;#039;;								-- the default header&lt;br /&gt;
		if args_t.header_caption then&lt;br /&gt;
			header = header .. &amp;#039; &amp;#039; .. args_t.header_caption;					-- concatenate |header_caption= onto default header&lt;br /&gt;
		end&lt;br /&gt;
		infobox_ship_t[&amp;#039;header&amp;#039; .. i] = header;									-- add the header&lt;br /&gt;
		i = i + 1;																-- bump the enumerator&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local error_flag;&lt;br /&gt;
	error_flag = synonym_check (args_t, &amp;#039;ship_armour&amp;#039;, &amp;#039;ship_armor&amp;#039;, error_flag);	-- error if both synonymous parameters set&lt;br /&gt;
	synonym_check (args_t, &amp;#039;ship_draught&amp;#039;, &amp;#039;ship_draft&amp;#039;, error_flag);				-- when both set modify with error message and category&lt;br /&gt;
&lt;br /&gt;
	line_items (args_t, data.infobox_characteristics_params_t, infobox_ship_t, i, frame);	-- go do all of the other infobox parameters&lt;br /&gt;
	unknown_params_check (args_t, data.known_infobox_ship_characteristics_params_t, &amp;#039;Infobox ship/characteristics&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
	return frame:expandTemplate ({title=&amp;#039;Infobox&amp;#039;, args = infobox_ship_t});		-- return a rendering of this infobox&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N F O B O X _ S H I P _ C L A S S _ O V E R V I E W &amp;gt;------------------------&lt;br /&gt;
&lt;br /&gt;
Returns a child infobox&lt;br /&gt;
&lt;br /&gt;
TODO: allow stand-alone when |child= set to anything but &amp;#039;yes&amp;#039;?  How do that?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function infobox_ship_class_overview (frame)&lt;br /&gt;
	local args_t = get_args (frame);&lt;br /&gt;
	args_t.hide_header= args_t.hide_header and args_t.hide_header:lower();		-- set to lowercase if set&lt;br /&gt;
&lt;br /&gt;
	local infobox_ship_t = {&lt;br /&gt;
		child = args_t.child or &amp;#039;yes&amp;#039;,											-- default to child&lt;br /&gt;
		headerstyle = data.styles_t.general&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	local i = 1;&lt;br /&gt;
&lt;br /&gt;
	if &amp;#039;yes&amp;#039; ~= args_t.hide_header then											-- |hide_header=yes then no header&lt;br /&gt;
		infobox_ship_t[&amp;#039;header&amp;#039; .. i] = &amp;#039;Class overview&amp;#039;;						-- add the header&lt;br /&gt;
		i = i + 1;																-- bump the enumerator&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	line_items (args_t, data.infobox_class_overview_params_t, infobox_ship_t, i, frame);	-- go do all of the other infobox parameters&lt;br /&gt;
	unknown_params_check (args_t, data.known_infobox_ship_class_overview_params_t, &amp;#039;Infobox ship/class&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
	return frame:expandTemplate ({title=&amp;#039;Infobox&amp;#039;, args = infobox_ship_t});		-- return a rendering of this infobox&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N F O B O X _ S H I P _ S E R V I C E _ R E C O R D &amp;gt;------------------------&lt;br /&gt;
&lt;br /&gt;
Returns a child infobox.  This function implements the ship-only portion of {{Infobox service record}}; does not&lt;br /&gt;
know about |is_ship= and |is_multi= parameters.  Adds support for |hide_header= parameter&lt;br /&gt;
&lt;br /&gt;
TODO: allow stand-alone when |child= set to anything but &amp;#039;yes&amp;#039;?  How do that?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function infobox_ship_service_record (frame)&lt;br /&gt;
	local args_t = get_args (frame);&lt;br /&gt;
	args_t.hide_header= args_t.hide_header and args_t.hide_header:lower();		-- set to lowercase if set&lt;br /&gt;
&lt;br /&gt;
	local infobox_ship_t = {&lt;br /&gt;
		child = args_t.child or &amp;#039;yes&amp;#039;,											-- default to child&lt;br /&gt;
		headerstyle = data.styles_t.general&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	local i = 1;&lt;br /&gt;
&lt;br /&gt;
	if &amp;#039;yes&amp;#039; ~= args_t.hide_header then											-- |hide_header=yes then no header&lt;br /&gt;
		infobox_ship_t[&amp;#039;header&amp;#039; .. i] = args_t.label or &amp;#039;Service record&amp;#039;;		-- add the header&lt;br /&gt;
		i = i + 1;																-- bump the enumerator&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	line_items (args_t, data.infobox_ship_service_record_params_t, infobox_ship_t, i, frame);	-- go do all of the other infobox parameters&lt;br /&gt;
	unknown_params_check (args_t, data.known_infobox_ship_service_record_params_t, &amp;#039;Infobox ship/service record&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
	return frame:expandTemplate ({title=&amp;#039;Infobox&amp;#039;, args = infobox_ship_t});		-- return a rendering of this infobox&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N F O B O X _ S H I P &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
{{#invoke:Infobox ship|infobox_ship}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function infobox_ship (frame)&lt;br /&gt;
	local args_t = get_args (frame);&lt;br /&gt;
&lt;br /&gt;
	local infobox_ship_t = {}													-- table that holds infobox parameters&lt;br /&gt;
&lt;br /&gt;
	infobox_ship_begin (args_t, infobox_ship_t, frame);&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (args_t) do												-- copy infobox parameters from the frame into our local table&lt;br /&gt;
		local enum = k:match (&amp;#039;section(%d+)&amp;#039;);									-- &amp;lt;enum&amp;gt; gets a value when this parameter is |section&amp;lt;n&amp;gt;= &lt;br /&gt;
		if enum then&lt;br /&gt;
			infobox_ship_t[&amp;#039;data&amp;#039;..enum] = v;									-- translate |section&amp;lt;n&amp;gt; = to |data&amp;lt;n&amp;gt;=&lt;br /&gt;
		else&lt;br /&gt;
			infobox_ship_t[k] = v;												-- assume that parameter name is one known to Module:Infobox&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
	unknown_params_check (args_t, data.known_infobox_ship_params_t, &amp;#039;Infobox ship&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
	return frame:expandTemplate ({title=&amp;#039;Infobox&amp;#039;, args = infobox_ship_t}) .. (has_unknown_params and &amp;#039;[[Category:Pages using infobox ship with unknown parameters]]&amp;#039; or &amp;#039;&amp;#039;);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T S &amp;gt;----------------------------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	infobox_ship = infobox_ship,&lt;br /&gt;
	infobox_ship_image = infobox_ship_image,&lt;br /&gt;
	infobox_ship_career = infobox_ship_career,&lt;br /&gt;
	infobox_ship_characteristics = infobox_ship_characteristics,&lt;br /&gt;
	infobox_ship_class_overview = infobox_ship_class_overview,&lt;br /&gt;
	infobox_ship_service_record = infobox_ship_service_record,&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>imported&gt;WOSlinker</name></author>
	</entry>
</feed>