<?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%3AUSN_fleet_totals%2Fdata</id>
	<title>Module:USN fleet totals/data - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3AUSN_fleet_totals%2Fdata"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:USN_fleet_totals/data&amp;action=history"/>
	<updated>2026-05-13T17:04:22Z</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:USN_fleet_totals/data&amp;diff=147407&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:USN_fleet_totals/data&amp;diff=147407&amp;oldid=prev"/>
		<updated>2022-10-22T09:15: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 patterns_tags = {&lt;br /&gt;
	&amp;#039;&amp;lt;nowiki&amp;gt;.-&amp;lt;/nowiki&amp;gt;&amp;#039;,&lt;br /&gt;
	&amp;#039;&amp;lt;!%-%-.-%-%-&amp;gt;&amp;#039;,&lt;br /&gt;
	&amp;#039;&amp;lt;pre&amp;gt;.-&amp;lt;/pre&amp;gt;&amp;#039;,&lt;br /&gt;
	&amp;#039;&amp;lt;syntaxhighlight.-&amp;gt;.-&amp;lt;/syntaxhighlight&amp;gt;&amp;#039;,&lt;br /&gt;
	&amp;#039;&amp;lt;source.-&amp;gt;.-&amp;lt;/source&amp;gt;&amp;#039;,													-- deprecated alias of syntaxhighlight tag&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local Article_content;&lt;br /&gt;
local grand_total = 0;&lt;br /&gt;
local planned_total = 0;&lt;br /&gt;
&lt;br /&gt;
local wikitables_t = {&lt;br /&gt;
	[&amp;#039;Commissioned_t&amp;#039;] = {},													-- k/v table where k is ship type and v is the number of that type&lt;br /&gt;
	[&amp;#039;Non-commissioned_t&amp;#039;] = {},&lt;br /&gt;
	[&amp;#039;Support_t&amp;#039;] = {},&lt;br /&gt;
	[&amp;#039;Ready Reserve Force ships_t&amp;#039;] = {},&lt;br /&gt;
	[&amp;#039;Reserve fleet_t&amp;#039;] = {},&lt;br /&gt;
	[&amp;#039;Under construction_t&amp;#039;] = {},&lt;br /&gt;
	[&amp;#039;On order_t&amp;#039;] = {},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local wikitable_names_t = {&amp;#039;Commissioned_t&amp;#039;, &amp;#039;Non-commissioned_t&amp;#039;, &amp;#039;Support_t&amp;#039;, &amp;#039;Ready Reserve Force ships_t&amp;#039;, &amp;#039;Reserve fleet_t&amp;#039;, &amp;#039;Under construction_t&amp;#039;, &amp;#039;On order_t&amp;#039;};&lt;br /&gt;
local fleet_wikitables_t = {&amp;#039;Commissioned_t&amp;#039;, &amp;#039;Non-commissioned_t&amp;#039;, &amp;#039;Support_t&amp;#039;, &amp;#039;Ready Reserve Force ships_t&amp;#039;, &amp;#039;Reserve fleet_t&amp;#039;};	-- only these for n_of_m&lt;br /&gt;
local headers_t = {&lt;br /&gt;
	&amp;#039;Commissioned (USS)&amp;#039;,&lt;br /&gt;
	&amp;#039;Non-commissioned (USNS)&amp;#039;,&lt;br /&gt;
	&amp;#039;Support (MV, RV – \&amp;#039;\&amp;#039;&amp;lt;small&amp;gt;or no prefix&amp;lt;/small&amp;gt;\&amp;#039;\&amp;#039;)&amp;#039;,&lt;br /&gt;
	&amp;#039;Ready Reserve Force ships (MV, SS, GTS)&amp;#039;,&lt;br /&gt;
	&amp;#039;Reserve Fleet ships (USS, USNS)&amp;#039;,&lt;br /&gt;
	&amp;#039;Under construction&amp;#039;,&lt;br /&gt;
	&amp;#039;On order&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local totals_t = {																-- table to hold total number of ships in these categories&lt;br /&gt;
	[&amp;#039;Commissioned_t&amp;#039;] = 0,&lt;br /&gt;
	[&amp;#039;Non-commissioned_t&amp;#039;] = 0,&lt;br /&gt;
	[&amp;#039;Support_t&amp;#039;] = 0,&lt;br /&gt;
	[&amp;#039;Ready Reserve Force ships_t&amp;#039;] = 0,&lt;br /&gt;
	[&amp;#039;Reserve fleet_t&amp;#039;] = 0,&lt;br /&gt;
	[&amp;#039;Under construction_t&amp;#039;] = 0,&lt;br /&gt;
	[&amp;#039;On order_t&amp;#039;] = 0,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local n_of_m_t = {}																-- table of total counts (m in &amp;#039;n of m&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A R T I C L E _ C O N T E N T _ G E T &amp;gt;----------------------------------------&lt;br /&gt;
&lt;br /&gt;
get article content, remove certain html-like tags and their content so that this code doesn&amp;#039;t include any citation&lt;br /&gt;
templates inside the tags as valid tagets; they are not.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function article_content_get ()&lt;br /&gt;
	if not Article_content then&lt;br /&gt;
		Article_content = mw.title.new (&amp;#039;List of current ships of the United States Navy&amp;#039;):getContent();&lt;br /&gt;
		for _, tag in ipairs (patterns_tags) do&lt;br /&gt;
			Article_content = Article_content:gsub (tag, &amp;#039;&amp;#039;);					-- remove certain html-like tags and their content&lt;br /&gt;
		end&lt;br /&gt;
		while Article_content:match (&amp;#039;([\r\n]+|%-) *[\r\n]+|%-&amp;#039;) do				-- are there multiple row markers without intervening column data?&lt;br /&gt;
			Article_content = Article_content:gsub (&amp;#039;([\r\n]+|%-) *[\r\n]+|%-&amp;#039;, &amp;#039;%1&amp;#039;);	-- remove duplicate row markers&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; T Y P E _ L A B E L _ I N D E X _ G E T &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
get the labels from the tops of the current wikitable; the one we need is &amp;#039;!Type&amp;#039;.  This function assumes that&lt;br /&gt;
label markup for each table is one-line-per-label; label markup all-on-one-line (! &amp;lt;label&amp;gt; !! &amp;lt;label&amp;gt; !! ...) is&lt;br /&gt;
not supported.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function type_label_index_get (wikitable)&lt;br /&gt;
	local i = 0;&lt;br /&gt;
	for label in wikitable:gmatch (&amp;#039;[\r\n](![^\r\n]+)&amp;#039;) do&lt;br /&gt;
		i = i + 1;&lt;br /&gt;
		if label:match (&amp;#039;! *Type&amp;#039;) then&lt;br /&gt;
			return i;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S H I P _ T Y P E _ C L E A N &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
remove templates from &amp;lt;ship_type&amp;gt;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function ship_type_clean (ship_type)&lt;br /&gt;
	while ship_type:match (&amp;#039;%b{}&amp;#039;) do											-- are there templates?&lt;br /&gt;
		ship_type = ship_type:gsub (&amp;#039;%b{}&amp;#039;, &amp;#039;&amp;#039;);								-- remove the template&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return ship_type;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S H I P _ T Y P E S _ G E T &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
find first row markup (|-) and fetch the column number that holds ship_types.  Then find each row markup, count&lt;br /&gt;
lines until ship_type line is located, extract the contents (ship type) and add entry to the appropriate wikitable&lt;br /&gt;
in wikitables_t; ship type already present, bump the count.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function ship_types_get (wikitable, wikitable_index)&lt;br /&gt;
	local find_pattern = &amp;#039;|%-&amp;#039;;&lt;br /&gt;
	local type_label_index;&lt;br /&gt;
	&lt;br /&gt;
	local tstart, tend = wikitable:find (find_pattern);							-- find the table row marker in &amp;lt;wikitable&amp;gt;; should be column headers&lt;br /&gt;
	local i=0;&lt;br /&gt;
&lt;br /&gt;
	if tstart then																-- if we found row marker (|-) for headers&lt;br /&gt;
		type_label_index = type_label_index_get (wikitable);					-- try to find index of type label (!Type)&lt;br /&gt;
		tstart, tend = wikitable:find (find_pattern, tend);						-- look for the next row&lt;br /&gt;
	else&lt;br /&gt;
		return nil;																-- TODO: error message?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	while tstart do&lt;br /&gt;
		local i = 0;&lt;br /&gt;
		local ship_type;&lt;br /&gt;
		local rstart = tend;													-- row start and end return values from string.find()&lt;br /&gt;
		local rend;&lt;br /&gt;
		local pattern = &amp;#039;[\r\n]+|([^\r\n]*)&amp;#039;;									-- newline, pipe, everything before the next newline&lt;br /&gt;
&lt;br /&gt;
		while rstart do															-- nil if not found&lt;br /&gt;
			rstart, rend, ship_type = wikitable:find (pattern, rstart);&lt;br /&gt;
&lt;br /&gt;
			if rstart then&lt;br /&gt;
				i = i + 1;&lt;br /&gt;
				ship_type = ship_type_clean (ship_type);&lt;br /&gt;
				&lt;br /&gt;
				if type_label_index == i then									-- is this the column that has the ship type entry?&lt;br /&gt;
					if wikitables_t[wikitable_names_t[wikitable_index]][ship_type] then		-- if we found a ship type that we already know about:&lt;br /&gt;
						wikitables_t[wikitable_names_t[wikitable_index]][ship_type] = wikitables_t[wikitable_names_t[wikitable_index]][ship_type] + 1;	-- bump the count&lt;br /&gt;
					else&lt;br /&gt;
						wikitables_t[wikitable_names_t[wikitable_index]][ship_type] = 1;	-- add ship type to the table with a count of 1&lt;br /&gt;
					end&lt;br /&gt;
					&lt;br /&gt;
					totals_t[wikitable_names_t[wikitable_index]] = totals_t[wikitable_names_t[wikitable_index]] + 1;	-- tally&lt;br /&gt;
					break;														-- and break out of the while&lt;br /&gt;
				end&lt;br /&gt;
			rstart = rend;														-- not yet on the correct column; reset the starting index to the end of the last find()&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	tstart, tend = wikitable:find (find_pattern, tend);							-- search for another row marker (|-) in &amp;lt;wikitable&amp;gt;; begin at end of last row marker search&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; R E N D E R _ O U T P U T &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
extract data from various tables and append to &amp;lt;output_string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function render_output (index, output_string)&lt;br /&gt;
	local out_t = {};															-- here we compose this section of &amp;lt;output_string&amp;gt;&lt;br /&gt;
	local temp_t = {};															-- a sequence of ship types and counts taken from wikitables_t; separate table for sorting&lt;br /&gt;
	&lt;br /&gt;
	local function sort (a, b)&lt;br /&gt;
		a = a:gsub (&amp;#039;%[%[(.+)%]%]&amp;#039;, &amp;#039;%1&amp;#039;);										-- remove outer wikilink markup&lt;br /&gt;
		b = b:gsub (&amp;#039;%[%[(.+)%]%]&amp;#039;, &amp;#039;%1&amp;#039;);&lt;br /&gt;
		a = a:gsub (&amp;#039;%* &amp;#039;, &amp;#039;&amp;#039;);													-- remove unordered list markup&lt;br /&gt;
		b = b:gsub (&amp;#039;%* &amp;#039;, &amp;#039;&amp;#039;);&lt;br /&gt;
		a = a:gsub (&amp;#039;^[^|]+|&amp;#039;, &amp;#039;&amp;#039;);												-- remove all but the display text from complex wikilinks&lt;br /&gt;
		b = b:gsub (&amp;#039;^[^|]+|&amp;#039;, &amp;#039;&amp;#039;);&lt;br /&gt;
		a = a:gsub (&amp;#039; *– *%d+&amp;#039;, &amp;#039;&amp;#039;);											-- remove the count&lt;br /&gt;
		b = b:gsub (&amp;#039; *– *%d+&amp;#039;, &amp;#039;&amp;#039;);&lt;br /&gt;
		return a &amp;lt; b;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	table.insert (out_t, table.concat ({&amp;#039;&amp;lt;b&amp;gt;&amp;#039;, headers_t[index], &amp;#039;&amp;lt;/b&amp;gt; – &amp;#039;, totals_t[wikitable_names_t[index]]}));		-- header&lt;br /&gt;
	table.insert (out_t, &amp;#039;{{Div col|colwidth=22em}}&amp;#039;);							-- start of columnar data&lt;br /&gt;
	for ship_type, count in pairs (wikitables_t[wikitable_names_t[index]]) do	-- make an unordered, unsorted, list&lt;br /&gt;
		local ship_type_total = n_of_m_t[ship_type] and table.concat ({&amp;#039; (&amp;lt;i&amp;gt;of &amp;#039;, n_of_m_t[ship_type], &amp;#039;&amp;lt;/i&amp;gt;)&amp;#039;}) or &amp;#039;&amp;#039;;&lt;br /&gt;
		if wikitable_names_t[index] == fleet_wikitables_t[index] then&lt;br /&gt;
			table.insert (temp_t, table.concat ({&amp;#039;* &amp;#039;, ship_type, &amp;#039; – &amp;#039;, count, ship_type_total}));	-- make and add an unordered list item&lt;br /&gt;
		else&lt;br /&gt;
			table.insert (temp_t, table.concat ({&amp;#039;* &amp;#039;, ship_type, &amp;#039; – &amp;#039;, count}));	-- make and add an unordered list item&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort (temp_t, sort);													-- ascending sort; TODO: is there a better way to get a sorted list of ship types?&lt;br /&gt;
	table.insert (out_t, table.concat (temp_t, &amp;#039;\n&amp;#039;));							-- make a big string and add it to out_t&lt;br /&gt;
	table.insert (out_t, &amp;#039;{{div col end}}&amp;#039;);									-- end of columnar data&lt;br /&gt;
	table.insert (out_t, &amp;#039;&amp;lt;hr /&amp;gt;\n&amp;#039;);											-- horizontal rule&lt;br /&gt;
	&lt;br /&gt;
	output_string = table.concat ({output_string, table.concat (out_t, &amp;#039;\n&amp;#039;)});	-- make a big string and add it to output_string&lt;br /&gt;
	return output_string;														-- and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; R E N D E R _ T O T A L S &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
render a wikitable list of totals; exclude Under construction and on-order ships&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function render_totals (output_string)&lt;br /&gt;
	local out_t = {&amp;#039;&amp;lt;b&amp;gt;Totals&amp;lt;/b&amp;gt;&amp;#039;};&lt;br /&gt;
	local tally = 0;&lt;br /&gt;
&lt;br /&gt;
	table.insert (out_t, &amp;#039;{| style=&amp;quot;margin-left:1.5em&amp;quot;&amp;#039;);						-- start a wikitable indented 1.5em&lt;br /&gt;
	for i, wikitable_name in ipairs (wikitable_names_t) do						-- spin through the list of table names&lt;br /&gt;
		if 6 &amp;gt; i then															-- not under construction of on order&lt;br /&gt;
			local wikitable = wikitable_name:gsub (&amp;#039;_t&amp;#039;, &amp;#039;&amp;#039;);					-- remove suffix&lt;br /&gt;
			table.insert (out_t, &amp;#039;|-&amp;#039;);											-- add row markup&lt;br /&gt;
			table.insert (out_t, table.concat ({&amp;#039;| &amp;#039;, wikitable, &amp;#039;: || style=&amp;quot;text-align:right&amp;quot; | &amp;#039;, totals_t[wikitable_names_t[i]]}));	-- make a row&lt;br /&gt;
			tally = tally + totals_t[wikitable_names_t[i]];						-- and bump the grand total&lt;br /&gt;
		else&lt;br /&gt;
			break;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	grand_total = tally;														-- this will be rounded to the nearest integer evenly divisible by 5&lt;br /&gt;
	table.insert (out_t, &amp;#039;|-&amp;#039;);														-- add row markup&lt;br /&gt;
	table.insert (out_t, table.concat ({&amp;#039;| &amp;lt;b&amp;gt;Grand total&amp;lt;/b&amp;gt;: || style=&amp;quot;text-align:right&amp;quot; | &amp;lt;b&amp;gt;&amp;#039;, tally, &amp;#039;&amp;lt;/b&amp;gt;&amp;#039;}));	-- add the grand total row&lt;br /&gt;
	table.insert (out_t, &amp;#039;|}&amp;#039;);													-- close the wikitable&lt;br /&gt;
&lt;br /&gt;
	output_string = table.concat ({output_string, table.concat (out_t, &amp;#039;\n&amp;#039;)});	-- make a big string and add it to output_string&lt;br /&gt;
	return output_string;														-- and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N _ O F _ M _ G E T &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
For ship types in commissioned, non-commissioned, support, ready researve, and reserve tables, count the number&lt;br /&gt;
of same-type ships so that we can render &amp;#039;(&amp;#039;&amp;#039;of M&amp;#039;&amp;#039;)&amp;#039; annotation for those ship types.&lt;br /&gt;
&lt;br /&gt;
First gather a list of ship types that are listed in more than one table.  Compare commissioned to non-commissioned;&lt;br /&gt;
commissioned to support; etc.  Then non-commissioned to support; non-commissioned to ready researve; etc.  Continue&lt;br /&gt;
until we compare ready researve to reserve.  Do not compare reserve to itself.&lt;br /&gt;
&lt;br /&gt;
Second, scroll through the list of duplicates and accumulate tallies of each ship type.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function n_of_m_get ()&lt;br /&gt;
	for i, wikitable_name in ipairs (fleet_wikitables_t) do						-- for each wikitable&lt;br /&gt;
		if #fleet_wikitables_t == i then										-- when we get to the last wikitable, don&amp;#039;t compare it to itself&lt;br /&gt;
			break;&lt;br /&gt;
		end&lt;br /&gt;
		for ship_type, _ in pairs (wikitables_t[wikitable_name]) do&lt;br /&gt;
			for j=i+1, #fleet_wikitables_t do									-- index 1 looks in indexes 2, 3, ...&lt;br /&gt;
				if wikitables_t[fleet_wikitables_t[j]][ship_type] then&lt;br /&gt;
					n_of_m_t[ship_type] = 0;									-- this ship type appears in more than one wikitable&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for ship_type, _ in pairs (n_of_m_t) do										-- for each ship type in n_of_m table&lt;br /&gt;
		for _, wikitable_name in ipairs (fleet_wikitables_t) do					-- for each wikitable&lt;br /&gt;
			if wikitables_t[wikitable_name][ship_type] then						-- if the ship type is found in this wikitable&lt;br /&gt;
				n_of_m_t[ship_type] = n_of_m_t[ship_type] + wikitables_t[wikitable_name][ship_type];	-- add to the tally&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; U S N _ S H I P _ C O U N T E R &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
tables in &amp;#039;List of current ships of the United States Navy&amp;#039; are (in this order):&lt;br /&gt;
	Commissioned&lt;br /&gt;
	Non-commissioned&lt;br /&gt;
	Support&lt;br /&gt;
	Ready Reserve Force ships&lt;br /&gt;
	Reserve fleet&lt;br /&gt;
	Under construction&lt;br /&gt;
	On order&lt;br /&gt;
&lt;br /&gt;
count the ship types in the Type columns of these tables, and then render pretty sorted lists of ship types with&lt;br /&gt;
their counts.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function fleet_totals ()&lt;br /&gt;
	article_content_get ();														-- attempt to get this article&amp;#039;s content&lt;br /&gt;
&lt;br /&gt;
	local wikitable_index = 0;&lt;br /&gt;
	local find_pattern = &amp;#039;{|&amp;#039;;&lt;br /&gt;
	local tstart, tend = Article_content:find (find_pattern);					-- find the first wikitable&lt;br /&gt;
&lt;br /&gt;
	while tstart do&lt;br /&gt;
		local wikitable = Article_content:match (&amp;#039;%b{}&amp;#039;, tstart);				-- get the whole wikitable&lt;br /&gt;
&lt;br /&gt;
		if not wikitable then&lt;br /&gt;
			break;																-- wikitable is nil for some reason (missing closing |} for example) so declare ourselves done&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		wikitable_index = wikitable_index + 1;&lt;br /&gt;
		ship_types_get (wikitable, wikitable_index);&lt;br /&gt;
&lt;br /&gt;
		tstart, tend = Article_content:find (find_pattern, tend);				-- search for another template; begin at end of last wikitable search&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	n_of_m_get ();&lt;br /&gt;
&lt;br /&gt;
	local output_string = &amp;#039;&amp;#039;;&lt;br /&gt;
	for i, _ in ipairs (wikitable_names_t) do&lt;br /&gt;
		output_string = render_output (i, output_string);						-- make a pretty unordered list of ship types and counts for each wikitable&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	output_string = render_totals (output_string);								-- make a prety unordered list of &amp;#039;classification&amp;#039; total numbers&lt;br /&gt;
&lt;br /&gt;
	local frame = mw.getCurrentFrame();											-- do this to get access to frame:preprocess()&lt;br /&gt;
	return frame:preprocess (output_string);&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;
	fleet_totals_str = fleet_totals(),&lt;br /&gt;
	grand_total = grand_total,&lt;br /&gt;
	planned_total = totals_t[&amp;#039;Under construction_t&amp;#039;] + totals_t[&amp;#039;On order_t&amp;#039;],&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>imported&gt;WOSlinker</name></author>
	</entry>
</feed>