<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.tachyony.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ABiglist</id>
	<title>Module:Biglist - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tachyony.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ABiglist"/>
	<link rel="alternate" type="text/html" href="https://wiki.tachyony.co.uk/w/index.php?title=Module:Biglist&amp;action=history"/>
	<updated>2026-05-15T16:52:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.5</generator>
	<entry>
		<id>https://wiki.tachyony.co.uk/w/index.php?title=Module:Biglist&amp;diff=8940&amp;oldid=prev</id>
		<title>Tachyony: Created page with &quot;-- This module provides some functions to help avoid problems with templates -- that might exceed expand size or time and which might put the page in -- :Category:Pages where template include size is exceeded or -- :Category:Pages with script errors (time exceeding 10 seconds).  local function collection() 	-- Return a table to hold items. 	return { 		n = 0, 		add = function (self, item) 			self.n = self.n + 1 			self[self.n] = item 		end, 		join = function (self...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.tachyony.co.uk/w/index.php?title=Module:Biglist&amp;diff=8940&amp;oldid=prev"/>
		<updated>2022-01-20T02:01:12Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;-- This module provides some functions to help avoid problems with templates -- that might exceed expand size or time and which might put the page in -- &lt;a href=&quot;/wiki/Category:Pages_where_template_include_size_is_exceeded&quot; title=&quot;Category:Pages where template include size is exceeded&quot;&gt;Category:Pages where template include size is exceeded&lt;/a&gt; or -- &lt;a href=&quot;/wiki/Category:Pages_with_script_errors&quot; title=&quot;Category:Pages with script errors&quot;&gt;Category:Pages with script errors&lt;/a&gt; (time exceeding 10 seconds).  local function collection() 	-- Return a table to hold items. 	return { 		n = 0, 		add = function (self, item) 			self.n = self.n + 1 			self[self.n] = item 		end, 		join = function (self...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module provides some functions to help avoid problems with templates&lt;br /&gt;
-- that might exceed expand size or time and which might put the page in&lt;br /&gt;
-- [[:Category:Pages where template include size is exceeded]] or&lt;br /&gt;
-- [[:Category:Pages with script errors]] (time exceeding 10 seconds).&lt;br /&gt;
&lt;br /&gt;
local function collection()&lt;br /&gt;
	-- Return a table to hold items.&lt;br /&gt;
	return {&lt;br /&gt;
		n = 0,&lt;br /&gt;
		add = function (self, item)&lt;br /&gt;
			self.n = self.n + 1&lt;br /&gt;
			self[self.n] = item&lt;br /&gt;
		end,&lt;br /&gt;
		join = function (self, sep)&lt;br /&gt;
			return table.concat(self, sep)&lt;br /&gt;
		end,&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function strip_to_nil(text)&lt;br /&gt;
	-- If text is a non-empty string, return its trimmed content,&lt;br /&gt;
	-- otherwise return nothing (empty string or not a string).&lt;br /&gt;
	if type(text) == &amp;#039;string&amp;#039; then&lt;br /&gt;
		return text:match(&amp;#039;(%S.-)%s*$&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function message(msg, nocat)&lt;br /&gt;
	-- Return formatted message text for an error.&lt;br /&gt;
	-- Can append &amp;quot;#FormattingError&amp;quot; to URL of a page with a problem to find it.&lt;br /&gt;
	-- This should not be called because there is no validity checking.&lt;br /&gt;
	local anchor = &amp;#039;&amp;lt;span id=&amp;quot;FormattingError&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
	local category = nocat and &amp;#039;&amp;#039; or &amp;#039;[[Category:Biglist errors]]&amp;#039;&lt;br /&gt;
	return anchor ..&lt;br /&gt;
		&amp;#039;&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: &amp;#039; ..&lt;br /&gt;
		msg ..&lt;br /&gt;
		&amp;#039;&amp;lt;/strong&amp;gt;&amp;#039; ..&lt;br /&gt;
		category .. &amp;#039;\n&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function urlencode(text)&lt;br /&gt;
	-- Return equivalent of {{urlencode:text}}.&lt;br /&gt;
	local function byte(char)&lt;br /&gt;
		return string.format(&amp;#039;%%%02X&amp;#039;, string.byte(char))&lt;br /&gt;
	end&lt;br /&gt;
	return text:gsub(&amp;#039;[^ %w%-._]&amp;#039;, byte):gsub(&amp;#039; &amp;#039;, &amp;#039;+&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function replace2(text, template)&lt;br /&gt;
	-- Return template after substituting text and urlencoded text.&lt;br /&gt;
	local plain = text:gsub(&amp;#039;%%&amp;#039;, &amp;#039;%%%%&amp;#039;)  -- for gsub, &amp;#039;%&amp;#039; has a special meaning in replacement&lt;br /&gt;
	local plainp = plain:gsub(&amp;#039; &amp;#039;, &amp;#039;+&amp;#039;)    -- plain and space replaced with plus&lt;br /&gt;
	local encoded = urlencode(text):gsub(&amp;#039;%%&amp;#039;, &amp;#039;%%%%&amp;#039;)&lt;br /&gt;
	return template:gsub(&amp;#039;&amp;lt;TXT&amp;gt;&amp;#039;, plain):gsub(&amp;#039;&amp;lt;TXTP&amp;gt;&amp;#039;, plainp):gsub(&amp;#039;&amp;lt;UENC&amp;gt;&amp;#039;, encoded)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function clean(text, default)&lt;br /&gt;
	-- Return text, if not empty, after trimming leading/trailing whitespace.&lt;br /&gt;
	-- Otherwise return default which may be nil.&lt;br /&gt;
	if text then&lt;br /&gt;
		text = text:match(&amp;quot;^%s*(.-)%s*$&amp;quot;)&lt;br /&gt;
		if text ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			return text&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return default&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function make_list(args, formatter, template)&lt;br /&gt;
	-- Return a list of formatted items.&lt;br /&gt;
	-- Input is a string of multiple lines, one item per line.&lt;br /&gt;
	local text = args.list or args[1] or &amp;#039;&amp;#039;&lt;br /&gt;
	local prefix = clean(args.prefix) or &amp;#039;&amp;#039;&lt;br /&gt;
	local comment = clean(args.comment)&lt;br /&gt;
	local results = collection()&lt;br /&gt;
	for line in string.gmatch(text .. &amp;#039;\n&amp;#039;, &amp;#039;[\t ]*(.-)[\t\r ]*\n&amp;#039;) do&lt;br /&gt;
		-- Skip line if empty or a comment.&lt;br /&gt;
		if line ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			if not (comment and line:sub(1, #comment) == comment) then&lt;br /&gt;
				results:add(prefix .. formatter(line, template))&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return results:join(&amp;#039;\n&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local templates = {&lt;br /&gt;
	-- Equivalent of {{userlinks|text}}.&lt;br /&gt;
	userlinks = [=[&lt;br /&gt;
&amp;lt;span class=&amp;quot;plainlinks userlinks&amp;quot;&amp;gt;[[User:&amp;lt;TXT&amp;gt;|&amp;lt;TXT&amp;gt;]] &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;([[User talk:&amp;lt;TXT&amp;gt;|talk]] &amp;#039;&amp;#039;&amp;#039;·&amp;#039;&amp;#039;&amp;#039; [[Special:Contributions/&amp;lt;TXT&amp;gt;|contribs]]&amp;lt;span class=&amp;quot;sysop-show&amp;quot;&amp;gt; &amp;#039;&amp;#039;&amp;#039;·&amp;#039;&amp;#039;&amp;#039; [[Special:DeletedContributions/&amp;lt;TXT&amp;gt;|deleted contribs]]&amp;lt;/span&amp;gt; &amp;#039;&amp;#039;&amp;#039;·&amp;#039;&amp;#039;&amp;#039; [//en.wikipedia.org/w/index.php?title=Special:Log&amp;amp;user=&amp;lt;UENC&amp;gt; logs] &amp;#039;&amp;#039;&amp;#039;·&amp;#039;&amp;#039;&amp;#039; [//en.wikipedia.org/w/index.php?title=Special:AbuseLog&amp;amp;wpSearchUser=&amp;lt;UENC&amp;gt; edit filter log]&amp;lt;span class=&amp;quot;sysop-show&amp;quot;&amp;gt; &amp;#039;&amp;#039;&amp;#039;·&amp;#039;&amp;#039;&amp;#039; [[Special:Block/&amp;lt;TXT&amp;gt;|block user]]&amp;lt;/span&amp;gt; &amp;#039;&amp;#039;&amp;#039;·&amp;#039;&amp;#039;&amp;#039; [//en.wikipedia.org/w/index.php?title=Special:Log&amp;amp;type=block&amp;amp;page=User:&amp;lt;UENC&amp;gt; block log])&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;]=],&lt;br /&gt;
	-- Equivalent of how {{search|topic}} is used.&lt;br /&gt;
	topicsearch = [=[&lt;br /&gt;
[[&amp;lt;TXT&amp;gt;]] – &amp;lt;span class=&amp;quot;plainlinks&amp;quot;&amp;gt;([//en.wikipedia.org/w/index.php?title=Special:Search&amp;amp;search=&amp;lt;UENC&amp;gt; wp] [https://www.google.com/search?q=site%3Awikipedia.org+&amp;lt;TXTP&amp;gt; gwp] [https://www.google.com/search?q=&amp;lt;TXTP&amp;gt; g] [https://www.bing.com/search?q=site%3Awikipedia.org+&amp;lt;TXTP&amp;gt; bwp] [https://www.bing.com/search?q=&amp;lt;TXTP&amp;gt; b] | [https://www.britannica.com/search?nop&amp;amp;query=&amp;lt;TXTP&amp;gt; eb] [https://www.google.com/custom?sitesearch=1911encyclopedia.org&amp;amp;q=&amp;lt;TXTP&amp;gt; 1911] [http://www.bartleby.com/cgi-bin/texis/webinator/65search?query=&amp;lt;TXTP&amp;gt; co] [https://www.google.com/search?q=site%3Ahttp%3A%2F%2Fwww.pcmag.com%2Fencyclopedia_term%2F+&amp;lt;TXTP&amp;gt; gct] [http://scienceworld.wolfram.com/search/index.cgi?as_q=&amp;lt;TXTP&amp;gt; sw] [https://archive.org/search.php?query=&amp;lt;UENC&amp;gt; arc] [http://babel.hathitrust.org/cgi/ls?field1=ocr;q1=&amp;lt;UENC&amp;gt;;a=srchls;lmt=ft ht])&amp;lt;/span&amp;gt;]=],&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function main(formatter, tname)&lt;br /&gt;
	local template = templates[tname]&lt;br /&gt;
	if template then&lt;br /&gt;
		return function (frame)&lt;br /&gt;
			local args = frame.args&lt;br /&gt;
			local success, result = pcall(make_list, args, formatter, template)&lt;br /&gt;
			if success then&lt;br /&gt;
				return result&lt;br /&gt;
			end&lt;br /&gt;
			return message(result, clean(args.nocat))&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return function (frame)&lt;br /&gt;
			local args = frame.args&lt;br /&gt;
			return message(&amp;#039;Unknown template name &amp;quot;&amp;#039; .. tname .. &amp;#039;&amp;quot;&amp;#039;, clean(args.nocat))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function coltit(frame)&lt;br /&gt;
	-- [[List of RAL colors]] has &amp;quot;node-count limit exceeded&amp;quot; problem.&lt;br /&gt;
	-- Following are equivalent:&lt;br /&gt;
	--   {{coltit|xxx}}&lt;br /&gt;
	--   {{#invoke:biglist|coltit|xxx}}&lt;br /&gt;
	-- or&lt;br /&gt;
	--   {{coltit|rgb=xxx}}&lt;br /&gt;
	--   {{#invoke:biglist|coltit|rgb=xxx}}&lt;br /&gt;
	-- Output is an empty cell for a table; the cell has the given background color.&lt;br /&gt;
	-- This does not emulate other features of the template.&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	local hex = strip_to_nil(args[1])  -- should be hex color code such as &amp;#039;AABBCC&amp;#039;&lt;br /&gt;
	if hex then&lt;br /&gt;
		return string.format(&amp;#039;title=&amp;quot;color %s&amp;quot; style=&amp;quot;background:#%s;&amp;quot;| &amp;#039;, hex, hex)&lt;br /&gt;
	end&lt;br /&gt;
	local rgb = strip_to_nil(args.rgb)  -- should be decimal triple such as &amp;#039;123,123,123&amp;#039;&lt;br /&gt;
	if rgb then&lt;br /&gt;
		return string.format(&amp;#039;title=&amp;quot;color %s&amp;quot; style=&amp;quot;background:rgb(%s);&amp;quot;| &amp;#039;, rgb, rgb)&lt;br /&gt;
	end&lt;br /&gt;
	error(&amp;#039;biglist coltit: need parameter 1 or rgb&amp;#039;, 0)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function columnslist(frame)&lt;br /&gt;
	-- [[List of least concern fishes]] has problem exceeding template expansion size.&lt;br /&gt;
	-- Will possibly be other articles with similar problems.&lt;br /&gt;
	-- Following are equivalent:&lt;br /&gt;
	--   {{columns-list|colwidth=30em|xxx}}&lt;br /&gt;
	--   {{#invoke:biglist|columns-list|colwidth=30em|xxx}}&lt;br /&gt;
	-- Output is:&lt;br /&gt;
	--   &amp;lt;div ...&amp;gt;xxx&amp;lt;/div&amp;gt;&lt;br /&gt;
	-- This assumes colwidth is wanted and does not emulate other features of the template.&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	local content = strip_to_nil(args[1]) or &amp;#039;&amp;#039;&lt;br /&gt;
	local colwidth = strip_to_nil(args.colwidth) or &amp;#039;&amp;#039;&lt;br /&gt;
	if colwidth ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		colwidth = &amp;#039; style=&amp;quot;column-width: &amp;#039; .. colwidth .. &amp;#039;&amp;quot;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	return frame:extensionTag{&lt;br /&gt;
		name = &amp;#039;templatestyles&amp;#039;, args = { src = &amp;#039;Div col/styles.css&amp;#039; }&lt;br /&gt;
	} .. &amp;#039;&amp;lt;div class=&amp;quot;div-col&amp;quot;&amp;#039; .. colwidth .. &amp;#039;&amp;gt;\n&amp;#039; .. content .. &amp;#039;&amp;lt;/div&amp;gt;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function storm(frame)&lt;br /&gt;
	-- [[Wikipedia:What Wikipedia is not]] has an example at [[WP:CRYSTAL]]&lt;br /&gt;
	-- where the name of a &amp;quot;virtually certain&amp;quot; future storm is needed.&lt;br /&gt;
	-- This function returns the next such name (unlinked) depending on the current date.&lt;br /&gt;
	-- Names are from [[Tropical cyclone naming#North Atlantic Ocean]].&lt;br /&gt;
	-- Usage:&lt;br /&gt;
	--   {{#invoke:biglist|storm}}&lt;br /&gt;
	-- Output example:&lt;br /&gt;
	--   Tropical Storm Alex (2022)&lt;br /&gt;
	local storms = {&lt;br /&gt;
		[2017] = &amp;#039;Tropical Storm Alberto (2018)&amp;#039;,&lt;br /&gt;
		[2018] = &amp;#039;Tropical Storm Andrea (2019)&amp;#039;,&lt;br /&gt;
		[2019] = &amp;#039;Tropical Storm Arthur (2020)&amp;#039;,&lt;br /&gt;
		[2020] = &amp;#039;Tropical Storm Ana (2021)&amp;#039;,&lt;br /&gt;
		[2021] = &amp;#039;Tropical Storm Alex (2022)&amp;#039;,&lt;br /&gt;
		[2022] = &amp;#039;Tropical Storm Arlene (2023)&amp;#039;,&lt;br /&gt;
		[2023] = &amp;#039;Tropical Storm Alberto (2024)&amp;#039;,&lt;br /&gt;
		[2024] = &amp;#039;Tropical Storm Andrea (2025)&amp;#039;,&lt;br /&gt;
		[2025] = &amp;#039;Tropical Storm Arthur (2026)&amp;#039;,&lt;br /&gt;
		default = &amp;#039;Tropical Storm Alberto (2030)&amp;#039;,&lt;br /&gt;
	}&lt;br /&gt;
	local date = os.date(&amp;#039;!*t&amp;#039;)  -- today&amp;#039;s UTC date&lt;br /&gt;
	local y, m = date.year, date.month  -- full year, month (1-12)&lt;br /&gt;
	if m &amp;gt;= 11 then&lt;br /&gt;
		y = y + 1&lt;br /&gt;
	end&lt;br /&gt;
	return storms[y] or storms.default&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function weatherboxcols(frame)&lt;br /&gt;
	-- [[List of cities by sunshine duration]] has problem exceeding time available.&lt;br /&gt;
	-- Examples:&lt;br /&gt;
	--   {{#invoke:biglist|weatherboxcols|123.4}}         → style=&amp;quot;background:#B9B94C; font-size:85%;&amp;quot;|123.4&lt;br /&gt;
	--   {{#invoke:biglist|weatherboxcols|123.4|1,823.0}} → style=&amp;quot;background:#B9B94C; font-size:85%;&amp;quot;|1,823.0&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	local display = strip_to_nil(args[1]) or &amp;#039;&amp;#039;&lt;br /&gt;
	local value = tonumber((display:gsub(&amp;#039;,&amp;#039;, &amp;#039;&amp;#039;)))&lt;br /&gt;
	local function show(bg, fg)&lt;br /&gt;
		local text = strip_to_nil(args[2]) or display&lt;br /&gt;
		if not fg and (value and value &amp;lt; 62) then&lt;br /&gt;
			fg = &amp;#039;FFFFFF&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		if fg then&lt;br /&gt;
			fg = &amp;#039;color:#&amp;#039; .. fg .. &amp;#039;;&amp;#039;&lt;br /&gt;
		else&lt;br /&gt;
			fg = &amp;#039;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		return &amp;#039;style=&amp;quot;background:#&amp;#039; .. bg .. &amp;#039;;&amp;#039; .. fg .. &amp;#039; font-size:85%;&amp;quot;&amp;#039; .. &amp;#039;|&amp;#039; .. text&lt;br /&gt;
	end&lt;br /&gt;
	if not value then&lt;br /&gt;
		return show(&amp;#039;FFFFFF&amp;#039;, &amp;#039;000000&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	local redgreen, blue&lt;br /&gt;
	if value &amp;lt;= 0 then&lt;br /&gt;
		redgreen = 0&lt;br /&gt;
	elseif value &amp;lt;= 90 then&lt;br /&gt;
		redgreen = 1.889 * value&lt;br /&gt;
	elseif value &amp;lt;= 180 then&lt;br /&gt;
		redgreen = 0.472 * (270.169 + value)&lt;br /&gt;
	elseif value &amp;lt; 360 then&lt;br /&gt;
		redgreen = 0.236 * (720.424 + value)&lt;br /&gt;
	else&lt;br /&gt;
		redgreen = 255&lt;br /&gt;
	end&lt;br /&gt;
	if value &amp;lt;= 0 then&lt;br /&gt;
		blue = 0&lt;br /&gt;
	elseif value &amp;lt;= 90 then&lt;br /&gt;
		blue = 1.889 * value&lt;br /&gt;
	elseif value &amp;lt; 150 then&lt;br /&gt;
		blue = 2.883 * (150 - value)&lt;br /&gt;
	elseif value &amp;lt;= 270 then&lt;br /&gt;
		blue = 0&lt;br /&gt;
	elseif value &amp;lt; 719.735 then&lt;br /&gt;
		blue = 0.567 * (value - 270)&lt;br /&gt;
	else&lt;br /&gt;
		blue = 255&lt;br /&gt;
	end&lt;br /&gt;
	return show(string.format(&amp;#039;%02X%02X%02X&amp;#039;, redgreen, redgreen, blue))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	coltit = coltit,&lt;br /&gt;
	[&amp;#039;columns-list&amp;#039;] = columnslist,&lt;br /&gt;
	storm = storm,&lt;br /&gt;
	topicsearch = main(replace2, &amp;#039;topicsearch&amp;#039;),&lt;br /&gt;
	userlinks = main(replace2, &amp;#039;userlinks&amp;#039;),&lt;br /&gt;
	weatherboxcols = weatherboxcols,&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Tachyony</name></author>
	</entry>
</feed>