<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mywikibiz.com/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://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ABiglist"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Biglist&amp;action=history"/>
	<updated>2026-06-13T22:15:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.3</generator>
	<entry>
		<id>https://mywikibiz.com/index.php?title=Module:Biglist&amp;diff=471114&amp;oldid=prev</id>
		<title>Zoran: Pywikibot 6.4.0</title>
		<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Biglist&amp;diff=471114&amp;oldid=prev"/>
		<updated>2021-07-15T20:50:49Z</updated>

		<summary type="html">&lt;p&gt;Pywikibot 6.4.0&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) == 'string' then&lt;br /&gt;
		return text:match('(%S.-)%s*$')&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;lt;span id=&amp;quot;FormattingError&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;'&lt;br /&gt;
	local category = nocat and '' or '[[Category:Biglist errors]]'&lt;br /&gt;
	return anchor ..&lt;br /&gt;
		'&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Error: ' ..&lt;br /&gt;
		msg ..&lt;br /&gt;
		'&amp;lt;/strong&amp;gt;' ..&lt;br /&gt;
		category .. '\n'&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('%%%02X', string.byte(char))&lt;br /&gt;
	end&lt;br /&gt;
	return text:gsub('[^ %w%-._]', byte):gsub(' ', '+')&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('%%', '%%%%')  -- for gsub, '%' has a special meaning in replacement&lt;br /&gt;
	local plainp = plain:gsub(' ', '+')    -- plain and space replaced with plus&lt;br /&gt;
	local encoded = urlencode(text):gsub('%%', '%%%%')&lt;br /&gt;
	return template:gsub('&amp;lt;TXT&amp;gt;', plain):gsub('&amp;lt;TXTP&amp;gt;', plainp):gsub('&amp;lt;UENC&amp;gt;', 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 ~= '' 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 ''&lt;br /&gt;
	local prefix = clean(args.prefix) or ''&lt;br /&gt;
	local comment = clean(args.comment)&lt;br /&gt;
	local results = collection()&lt;br /&gt;
	for line in string.gmatch(text .. '\n', '[\t ]*(.-)[\t\r ]*\n') do&lt;br /&gt;
		-- Skip line if empty or a comment.&lt;br /&gt;
		if line ~= '' 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('\n')&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]] '''·''' [[Special:Contributions/&amp;lt;TXT&amp;gt;|contribs]]&amp;lt;span class=&amp;quot;sysop-show&amp;quot;&amp;gt; '''·''' [[Special:DeletedContributions/&amp;lt;TXT&amp;gt;|deleted contribs]]&amp;lt;/span&amp;gt; '''·''' [//en.wikipedia.org/w/index.php?title=Special:Log&amp;amp;user=&amp;lt;UENC&amp;gt; logs] '''·''' [//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; '''·''' [[Special:Block/&amp;lt;TXT&amp;gt;|block user]]&amp;lt;/span&amp;gt; '''·''' [//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('Unknown template name &amp;quot;' .. tname .. '&amp;quot;', 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 'AABBCC'&lt;br /&gt;
	if hex then&lt;br /&gt;
		return string.format('title=&amp;quot;color %s&amp;quot; style=&amp;quot;background:#%s;&amp;quot;| ', hex, hex)&lt;br /&gt;
	end&lt;br /&gt;
	local rgb = strip_to_nil(args.rgb)  -- should be decimal triple such as '123,123,123'&lt;br /&gt;
	if rgb then&lt;br /&gt;
		return string.format('title=&amp;quot;color %s&amp;quot; style=&amp;quot;background:rgb(%s);&amp;quot;| ', rgb, rgb)&lt;br /&gt;
	end&lt;br /&gt;
	error('biglist coltit: need parameter 1 or rgb', 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 ''&lt;br /&gt;
	local colwidth = strip_to_nil(args.colwidth) or ''&lt;br /&gt;
	if colwidth ~= '' then&lt;br /&gt;
		colwidth = ' style=&amp;quot;column-width: ' .. colwidth .. '&amp;quot;'&lt;br /&gt;
	end&lt;br /&gt;
	return frame:extensionTag{&lt;br /&gt;
		name = 'templatestyles', args = { src = 'Div col/styles.css' }&lt;br /&gt;
	} .. '&amp;lt;div class=&amp;quot;div-col&amp;quot;' .. colwidth .. '&amp;gt;\n' .. content .. '&amp;lt;/div&amp;gt;'&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;
	-- 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] = 'Tropical Storm Alberto (2018)',&lt;br /&gt;
		[2018] = 'Tropical Storm Andrea (2019)',&lt;br /&gt;
		[2019] = 'Tropical Storm Arthur (2020)',&lt;br /&gt;
		[2020] = 'Tropical Storm Ana (2021)',&lt;br /&gt;
		[2021] = 'Tropical Storm Alex (2022)',&lt;br /&gt;
		default = 'Tropical Storm Alberto (2030)',&lt;br /&gt;
	}&lt;br /&gt;
	local date = os.date('!*t')  -- today'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 ''&lt;br /&gt;
	local value = tonumber((display:gsub(',', '')))&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 = 'FFFFFF'&lt;br /&gt;
		end&lt;br /&gt;
		if fg then&lt;br /&gt;
			fg = 'color:#' .. fg .. ';'&lt;br /&gt;
		else&lt;br /&gt;
			fg = ''&lt;br /&gt;
		end&lt;br /&gt;
		return 'style=&amp;quot;background:#' .. bg .. ';' .. fg .. ' font-size:85%;&amp;quot;' .. '|' .. text&lt;br /&gt;
	end&lt;br /&gt;
	if not value then&lt;br /&gt;
		return show('FFFFFF', '000000')&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('%02X%02X%02X', redgreen, redgreen, blue))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	coltit = coltit,&lt;br /&gt;
	['columns-list'] = columnslist,&lt;br /&gt;
	storm = storm,&lt;br /&gt;
	topicsearch = main(replace2, 'topicsearch'),&lt;br /&gt;
	userlinks = main(replace2, 'userlinks'),&lt;br /&gt;
	weatherboxcols = weatherboxcols,&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>