<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AFootball_manager_history</id>
	<title>Module:Football manager history - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AFootball_manager_history"/>
	<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Module:Football_manager_history&amp;action=history"/>
	<updated>2026-04-22T10:03:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://safernicotine.wiki/mediawiki/index.php?title=Module:Football_manager_history&amp;diff=39307&amp;oldid=prev</id>
		<title>imported&gt;Black Kite: per discussion at WT:FOOTY</title>
		<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Module:Football_manager_history&amp;diff=39307&amp;oldid=prev"/>
		<updated>2022-01-19T08:28:52Z</updated>

		<summary type="html">&lt;p&gt;per discussion at WT:FOOTY&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Implement [[Template:Football manager history]] to avoid articles being&lt;br /&gt;
-- added to [[:Category:Pages where template include size is exceeded]]&lt;br /&gt;
-- when the template is used many times.&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 is nil unless set by caller.&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 yes(parameter)&lt;br /&gt;
	-- Return true if parameter should be interpreted as &amp;quot;yes&amp;quot;.&lt;br /&gt;
	-- Do not want to accept mixed upper/lowercase.&lt;br /&gt;
	return ({ Y = true, y = true, yes = true, T = true, [&amp;#039;true&amp;#039;] = true })[parameter]&lt;br /&gt;
end&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;
		addif = function (self, item, fmt)&lt;br /&gt;
			if item then&lt;br /&gt;
				self.n = self.n + 1&lt;br /&gt;
				self[self.n] = fmt and string.gsub(fmt, &amp;#039;%%s&amp;#039;, item) or item&lt;br /&gt;
			end&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 message(msg, caller, 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;
	-- If given, caller is the title of the navbox which has the error.&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&lt;br /&gt;
	if not nocat and mw.title.getCurrentTitle():inNamespaces(0, 10) then&lt;br /&gt;
		-- Category only in namespaces: 0=article, 10=template.&lt;br /&gt;
		category = &amp;#039;[[Category:Football template errors]]&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		category = &amp;#039;&amp;#039;&lt;br /&gt;
	end&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;
		(caller and (&amp;#039; at [[Template:&amp;#039; .. caller .. &amp;#039;]]&amp;#039;) or &amp;#039;&amp;#039;) ..&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 make_entry(name, from, to, islast)&lt;br /&gt;
	local result =&lt;br /&gt;
		&amp;#039;*&amp;lt;span class=&amp;quot;vevent&amp;quot;&amp;gt;&amp;#039; ..&lt;br /&gt;
		&amp;#039;&amp;lt;span class=&amp;quot;agent attendee vcard&amp;quot;&amp;gt;&amp;#039; ..&lt;br /&gt;
		&amp;#039;&amp;lt;span class=&amp;quot;fn org summary&amp;quot;&amp;gt;&amp;#039; ..&lt;br /&gt;
		name ..&lt;br /&gt;
		&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;amp;nbsp;(&amp;lt;span class=&amp;quot;dtstart&amp;quot;&amp;gt;&amp;#039; ..&lt;br /&gt;
		from ..&lt;br /&gt;
		&amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
	if to then&lt;br /&gt;
		result = result .. &amp;#039;–&amp;#039; .. to&lt;br /&gt;
	elseif islast then&lt;br /&gt;
		result = result .. &amp;#039;–&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	result = result .. &amp;#039;)&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function make_list(text, note, dissolved)&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;
	-- Each item is &amp;#039;NAME FROM to TO&amp;#039; or &amp;#039;NAME FROM&amp;#039;, where&lt;br /&gt;
	--   NAME = manager name (any text)&lt;br /&gt;
	--   FROM = four digits (from year)&lt;br /&gt;
	--     TO = 1, 2, 3 or 4 digits (to year), or empty&lt;br /&gt;
	-- Alternatively, an item can use syntax (TEXT is any text, possibly empty):&lt;br /&gt;
	--   NAME from=TEXT&lt;br /&gt;
	--   NAME from=TEXT to=TEXT&lt;br /&gt;
	-- The code detects the end of NAME from the start of FROM.&lt;br /&gt;
	-- A dash is added to the last line (to show the manager is continuing) if&lt;br /&gt;
	-- no &amp;#039;to&amp;#039; year is given, but no dash is added if the club is dissolved.&lt;br /&gt;
	text = text or &amp;#039;&amp;#039;&lt;br /&gt;
	if text:find(&amp;#039;&amp;lt;span class=&amp;#039;, 1, true) then&lt;br /&gt;
		-- To allow a transition period where some navboxes use the old syntax, the&lt;br /&gt;
		-- given text is used if it appears to have come from the old subtemplates.&lt;br /&gt;
		return text&lt;br /&gt;
	end&lt;br /&gt;
	-- Get the non-blank lines first so can tell when am processing the last line.&lt;br /&gt;
	-- Each line is left- and right-trimmed.&lt;br /&gt;
	local lines = 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;
		if line ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			lines:add(line)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if lines.n &amp;lt;= 0 then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local ilast = dissolved and -1 or lines.n&lt;br /&gt;
	local entries = collection()&lt;br /&gt;
	entries:add(&amp;#039;&amp;lt;div&amp;gt;&amp;#039;)&lt;br /&gt;
	for i, line in ipairs(lines) do&lt;br /&gt;
		-- Need to detect lines like &amp;quot;Name from=1930 &amp;amp; 1935&amp;quot; (probably should&lt;br /&gt;
		-- not be like that, but that is not up to the template to enforce).&lt;br /&gt;
		local name, from, to = line:match(&amp;#039;^([^=]-)%s+(%d%d%d%d)%s+to%s+(%d%d?%d?%d?)$&amp;#039;)&lt;br /&gt;
		if not name then&lt;br /&gt;
			name, from = line:match(&amp;#039;^([^=]-)%s+(%d%d%d%d)$&amp;#039;)&lt;br /&gt;
			if not name then&lt;br /&gt;
				name, from, to = line:match(&amp;#039;^(.-) from=(.-) to=(.*)&amp;#039;)&lt;br /&gt;
				if not name then&lt;br /&gt;
					name, from = line:match(&amp;#039;^(.-) from=(.*)&amp;#039;)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		name = clean(name)&lt;br /&gt;
		from = clean(from, &amp;#039;&amp;#039;)&lt;br /&gt;
		to = clean(to)&lt;br /&gt;
		if ((name or &amp;#039;=&amp;#039;) .. (from or &amp;#039;=&amp;#039;) .. (to or &amp;#039;&amp;#039;)):find(&amp;#039;=&amp;#039;, 1, true) then&lt;br /&gt;
			-- name and from must be defined (from can be &amp;#039;&amp;#039;); to is optional.&lt;br /&gt;
			-- Reject &amp;#039;=&amp;#039; to avoid typos in items like &amp;#039;to=x&amp;#039; or &amp;#039;from=xto=y&amp;#039;&lt;br /&gt;
			-- from being displayed.&lt;br /&gt;
			error(&amp;#039;Invalid line &amp;quot;&amp;#039; .. mw.text.nowiki(line) .. &amp;#039;&amp;quot;&amp;#039;, 0)&lt;br /&gt;
		end&lt;br /&gt;
		entries:add(make_entry(name, from, to, i == ilast))&lt;br /&gt;
	end&lt;br /&gt;
	entries:add(&amp;#039;&amp;lt;/div&amp;gt;&amp;#039;)&lt;br /&gt;
	entries:addif(note)&lt;br /&gt;
	return entries:join(&amp;#039;\n&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function arg_style(bgcolor, textcolor, bordercolor)&lt;br /&gt;
	local result = collection()&lt;br /&gt;
	result:addif(clean(bgcolor), &amp;#039;background:%s;&amp;#039;)&lt;br /&gt;
	result:addif(clean(textcolor), &amp;#039;color:%s;&amp;#039;)&lt;br /&gt;
	result:addif(clean(bordercolor), &lt;br /&gt;
		&amp;#039;box-shadow: inset 1px 1px 0 %s,&amp;#039; ..&lt;br /&gt;
		&amp;#039;inset -1px -1px 0 %s;&amp;#039;)&lt;br /&gt;
	result:add(&amp;#039;width: 87%;&amp;#039;)&lt;br /&gt;
	return result:join(&amp;#039; &amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function arg_title(title, teamname, managerlist, textcolor, american_english)&lt;br /&gt;
	title = clean(title)&lt;br /&gt;
	teamname = clean(teamname, &amp;#039;MISSING &amp;quot;teamname&amp;quot;&amp;#039;)&lt;br /&gt;
	managerlist = clean(managerlist)&lt;br /&gt;
	textcolor = clean(textcolor)&lt;br /&gt;
	american_english = clean(american_english)&lt;br /&gt;
	local spancolor = textcolor and (&amp;#039;&amp;lt;span style=&amp;quot;color:&amp;#039; .. textcolor .. &amp;#039;;&amp;quot;&amp;gt;&amp;#039;) or &amp;#039;&amp;lt;span&amp;gt;&amp;#039;&lt;br /&gt;
	local mgr = spancolor .. (american_english and &amp;#039;Head coaches&amp;#039; or &amp;#039;managers&amp;#039;) .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
	return&lt;br /&gt;
		&amp;#039;&amp;lt;span class=&amp;quot;fn org&amp;quot;&amp;gt;[[&amp;#039; .. teamname .. &amp;#039;|&amp;#039; ..&lt;br /&gt;
		spancolor ..&lt;br /&gt;
		(title or teamname) .. &amp;#039;&amp;lt;/span&amp;gt;]]&amp;lt;/span&amp;gt; – &amp;#039; ..&lt;br /&gt;
		(managerlist and (&amp;#039;[[&amp;#039; .. managerlist .. &amp;#039;|&amp;#039; .. mgr .. &amp;#039;]]&amp;#039;) or mgr)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function _main(args)&lt;br /&gt;
	-- Return wikitext for a navbox.&lt;br /&gt;
	-- Code does not do much checking of inputs but will throw an error&lt;br /&gt;
	-- if input is found to be invalid.&lt;br /&gt;
	local style = arg_style(args.bgcolor, args.textcolor, args.bordercolor)&lt;br /&gt;
	local dissolved = args.dissolved&lt;br /&gt;
	if dissolved then&lt;br /&gt;
		-- May be a number of two or more digits (year club was dissolved; compatible&lt;br /&gt;
		-- with {{Infobox football club}}), or an alias for &amp;#039;yes&amp;#039;.&lt;br /&gt;
		dissolved = dissolved:match(&amp;#039;^%d%d+$&amp;#039;) and true or yes(args.dissolved)&lt;br /&gt;
	end&lt;br /&gt;
	local navargs = {&lt;br /&gt;
		bodyclass = &amp;#039;vcard&amp;#039;,&lt;br /&gt;
		name = clean(args.name),&lt;br /&gt;
		state = clean(args.state, &amp;#039;autocollapse&amp;#039;),&lt;br /&gt;
		titlestyle = style,&lt;br /&gt;
		title = arg_title(args.title, args.teamname, args.managerlist, args.textcolor, args.american_english),&lt;br /&gt;
		listclass = &amp;#039;hlist&amp;#039;,&lt;br /&gt;
		nowrapitems = &amp;#039;yes&amp;#039;,&lt;br /&gt;
		list1 = make_list(args.list, clean(args.note), dissolved),&lt;br /&gt;
		belowstyle = style,&lt;br /&gt;
		below = clean(args.below),&lt;br /&gt;
	}&lt;br /&gt;
	local navbox = require(&amp;#039;Module:Navbox&amp;#039;)._navbox&lt;br /&gt;
	return navbox(navargs)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function main(frame)&lt;br /&gt;
	-- Return wikitext for a navbox or an error message.&lt;br /&gt;
	local args = frame:getParent().args&lt;br /&gt;
	-- Read arguments in order of output (Module:Navbox says this puts&lt;br /&gt;
	-- reference numbers in the right order).&lt;br /&gt;
	local _&lt;br /&gt;
	_ = args.title&lt;br /&gt;
	_ = args.list&lt;br /&gt;
	_ = args.below&lt;br /&gt;
	local success, result = pcall(_main, args)&lt;br /&gt;
	if success then&lt;br /&gt;
		return result&lt;br /&gt;
	end&lt;br /&gt;
	return message(result, clean(args.name), clean(args.nocat))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return { main = main, _main = _main }&lt;/div&gt;</summary>
		<author><name>imported&gt;Black Kite</name></author>
	</entry>
</feed>