<?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%3ASports_rivalry_series_table%2Fsandbox</id>
	<title>Module:Sports rivalry series table/sandbox - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASports_rivalry_series_table%2Fsandbox"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sports_rivalry_series_table/sandbox&amp;action=history"/>
	<updated>2026-05-26T04:31:51Z</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:Sports_rivalry_series_table/sandbox&amp;diff=146953&amp;oldid=prev</id>
		<title>imported&gt;Frietjes at 23:13, 30 October 2020</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sports_rivalry_series_table/sandbox&amp;diff=146953&amp;oldid=prev"/>
		<updated>2020-10-30T23:13:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{sports rivalry series table}}&lt;br /&gt;
local p = {}&lt;br /&gt;
local root = nil&lt;br /&gt;
local lang =mw.getContentLanguage()&lt;br /&gt;
&lt;br /&gt;
local function formatnumR(num)&lt;br /&gt;
	num = mw.ustring.gsub(num, &amp;#039;^[^%d]*([%d,%.]-)[^%d]*$&amp;#039;, &amp;#039;%1&amp;#039;)&lt;br /&gt;
	return lang:parseFormattedNumber(num)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function isnotempty(s)&lt;br /&gt;
	return s and s:match( &amp;#039;^%s*(.-)%s*$&amp;#039; ) ~= &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
local function addheader(header1, header2, series_summary, compact, winner_only, &lt;br /&gt;
	compact_score, nonumber, nolocation, trophy_series, notes, notes_label,&lt;br /&gt;
	date_width, location_width)&lt;br /&gt;
	-- create the header row&lt;br /&gt;
	local row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
	if(not nonumber) then&lt;br /&gt;
		row:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;No.&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	row:tag(&amp;#039;th&amp;#039;):css(&amp;#039;width&amp;#039;, date_width):wikitext(&amp;#039;Date&amp;#039;)&lt;br /&gt;
	if(not nolocation) then&lt;br /&gt;
		row:tag(&amp;#039;th&amp;#039;):css(&amp;#039;width&amp;#039;, location_width):wikitext(&amp;#039;Location&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	if((not compact) and (not winner_only) and (not compact_score)) then&lt;br /&gt;
		row:tag(&amp;#039;th&amp;#039;):attr(&amp;#039;colspan&amp;#039;, 2):wikitext(header1 or &amp;#039;Winning team&amp;#039;)&lt;br /&gt;
		row:tag(&amp;#039;th&amp;#039;):attr(&amp;#039;colspan&amp;#039;, 2):wikitext(header2 or &amp;#039;Losing team&amp;#039;)&lt;br /&gt;
		if(not series_summary) then&lt;br /&gt;
			row:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;Series&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		if compact_score then&lt;br /&gt;
			row:tag(&amp;#039;th&amp;#039;):wikitext(header1 or &amp;#039;Winning team&amp;#039;)&lt;br /&gt;
			row:tag(&amp;#039;th&amp;#039;):wikitext(header2 or &amp;#039;Losing team&amp;#039;)&lt;br /&gt;
		else	&lt;br /&gt;
			row:tag(&amp;#039;th&amp;#039;):wikitext(header1 or &amp;#039;Winner&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		row:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;Score&amp;#039;)&lt;br /&gt;
		if( (winner_only or compact_score) and (not series_summary)) then&lt;br /&gt;
			row:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;Series&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if(trophy_series) then&lt;br /&gt;
		row:tag(&amp;#039;th&amp;#039;):wikitext(&amp;#039;Trophy series&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	if(notes) then&lt;br /&gt;
		row:tag(&amp;#039;th&amp;#039;):wikitext(notes_label)&lt;br /&gt;
	end  &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function series_text(team1name, team1wins, team2name, team2wins, ties, leads)&lt;br /&gt;
	local res = &amp;#039;&amp;#039;&lt;br /&gt;
	local t1 = mw.ustring.gsub(team1name, &amp;#039;%s*/.*&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	local t2 = mw.ustring.gsub(team2name, &amp;#039;%s*/.*&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	if (team1wins &amp;gt; team2wins) then&lt;br /&gt;
		res = t1 .. &amp;#039; &amp;#039; .. (leads and &amp;#039;leads &amp;#039; or &amp;#039;&amp;#039;) .. team1wins .. &amp;#039;–&amp;#039; .. team2wins .. ( (ties &amp;gt; 0) and &amp;#039;–&amp;#039; .. ties or &amp;#039;&amp;#039;)&lt;br /&gt;
	elseif (team2wins &amp;gt; team1wins) then&lt;br /&gt;
		res = t2 .. &amp;#039; &amp;#039; .. (leads and &amp;#039;leads &amp;#039; or &amp;#039;&amp;#039;) .. team2wins .. &amp;#039;–&amp;#039; .. team1wins .. ( (ties &amp;gt; 0) and &amp;#039;–&amp;#039; .. ties or &amp;#039;&amp;#039;)&lt;br /&gt;
	else&lt;br /&gt;
		res = &amp;#039;Tied &amp;#039; .. team1wins .. &amp;#039;–&amp;#039; .. team2wins .. ( (ties &amp;gt; 0) and &amp;#039;–&amp;#039; .. ties or &amp;#039;&amp;#039;) &lt;br /&gt;
	end&lt;br /&gt;
	return res&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function small_rank(team)&lt;br /&gt;
	team = mw.ustring.gsub(team or &amp;#039;&amp;#039;, &amp;#039;(%(.-%))&amp;#039;, &amp;#039;&amp;lt;small style=&amp;quot;font-size:85%; font-weight:normal;&amp;quot;&amp;gt;%1&amp;lt;/small&amp;gt;&amp;#039;)&lt;br /&gt;
	team = mw.ustring.gsub(team or &amp;#039;&amp;#039;, &amp;#039;([Nn]o%.%s*[0-9][0-9]*)&amp;#039;, &amp;#039;&amp;lt;small style=&amp;quot;font-size:85%; font-weight:normal;&amp;quot;&amp;gt;%1&amp;lt;/small&amp;gt;&amp;#039;)&lt;br /&gt;
	team = mw.ustring.gsub(team or &amp;#039;&amp;#039;, &amp;#039;#([0-9][0-9]*%s*)([A-Z%)])&amp;#039;, &amp;#039;&amp;lt;abbr title=&amp;quot;Number&amp;quot;&amp;gt;&amp;amp;#x23;&amp;lt;/abbr&amp;gt;%1%2&amp;#039;)&lt;br /&gt;
	team = mw.ustring.gsub(team or &amp;#039;&amp;#039;, &amp;#039;(&amp;lt;abbr[^&amp;lt;&amp;gt;]*&amp;gt;[^&amp;lt;&amp;gt;]*&amp;lt;/abbr&amp;gt;%s*[0-9][0-9]*)&amp;#039;, &amp;#039;&amp;lt;small style=&amp;quot;font-size:85%; font-weight:normal;&amp;quot;&amp;gt;%1&amp;lt;/small&amp;gt;&amp;#039;)&lt;br /&gt;
	team = mw.ustring.gsub(team or &amp;#039;&amp;#039;, &amp;#039;(&amp;lt;small[^&amp;lt;&amp;gt;]*&amp;gt;%()&amp;lt;small[^&amp;lt;&amp;gt;]*&amp;gt;(.-)&amp;lt;/small&amp;gt;(%)&amp;lt;/small&amp;gt;)&amp;#039;, &amp;#039;%1%2%3&amp;#039;)&lt;br /&gt;
	return team&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function get_name(team)&lt;br /&gt;
	team = mw.text.trim(team or &amp;#039;&amp;#039;)&lt;br /&gt;
	team = mw.ustring.gsub(team, &amp;#039;%[%[[^%[%]|]*|(.-)%]%]&amp;#039;, &amp;#039;%1&amp;#039;)&lt;br /&gt;
	team = mw.ustring.gsub(team, &amp;#039;%([^%(%)]*%)&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	team = mw.ustring.gsub(team, &amp;#039;&amp;lt;abbr[^&amp;lt;&amp;gt;]*&amp;gt;[^&amp;lt;&amp;gt;]*&amp;lt;/abbr&amp;gt;&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	team = mw.ustring.gsub(team, &amp;#039;^[Nn]o%.%s*[0-9][0-9]*&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	team = mw.ustring.gsub(team, &amp;#039;^[^A-Za-z%.]*(.-)[^A-Za-z%.]*$&amp;#039;, &amp;#039;%1&amp;#039;)&lt;br /&gt;
	return team&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function ismultiequal(s1, s2)&lt;br /&gt;
	for k1, a1 in pairs( mw.text.split(s1, &amp;#039;[%s]/[%s]&amp;#039;) ) do&lt;br /&gt;
		for k2, a2 in pairs( mw.text.split(s2, &amp;#039;[%s]/[%s]&amp;#039;) ) do&lt;br /&gt;
			if a1 == a2 then&lt;br /&gt;
				return 1&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
	&lt;br /&gt;
function p.table(frame)&lt;br /&gt;
	local args = (frame.args[3] ~= nil) and frame.args or frame:getParent().args&lt;br /&gt;
	local compact = (args[&amp;#039;format&amp;#039;] or &amp;#039;&amp;#039;):lower() == &amp;#039;compact&amp;#039;&lt;br /&gt;
	local winner_only = (args[&amp;#039;format&amp;#039;] or &amp;#039;&amp;#039;):lower() == &amp;#039;winner only&amp;#039;&lt;br /&gt;
	local compact_score = (args[&amp;#039;format&amp;#039;] or &amp;#039;&amp;#039;):lower() == &amp;#039;compact score&amp;#039;&lt;br /&gt;
	local no_number = isnotempty(args[&amp;#039;no_number&amp;#039;])&lt;br /&gt;
	local no_location = isnotempty(args[&amp;#039;no_location&amp;#039;])&lt;br /&gt;
	local notes = isnotempty(args[&amp;#039;notes&amp;#039;]) or isnotempty(args[&amp;#039;notes_label&amp;#039;])&lt;br /&gt;
	local notes_label = isnotempty(args[&amp;#039;notes_label&amp;#039;]) and args[&amp;#039;notes_label&amp;#039;] or &amp;#039;Notes&amp;#039;&lt;br /&gt;
	local team1style = args[&amp;#039;team1style&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	local team1name = mw.text.trim(args[&amp;#039;team1&amp;#039;] or &amp;#039;&amp;#039;)&lt;br /&gt;
	local team1abbr = isnotempty(args[&amp;#039;team1abbr&amp;#039;]) and mw.text.trim(args[&amp;#039;team1abbr&amp;#039;] or &amp;#039;&amp;#039;) or team1name&lt;br /&gt;
	local team2style = args[&amp;#039;team2style&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	local team2name = mw.text.trim(args[&amp;#039;team2&amp;#039;] or &amp;#039;&amp;#039;)&lt;br /&gt;
	local team2abbr = isnotempty(args[&amp;#039;team2abbr&amp;#039;]) and mw.text.trim(args[&amp;#039;team2abbr&amp;#039;] or &amp;#039;&amp;#039;) or team2name&lt;br /&gt;
	local team1wins = tonumber(args[&amp;#039;team1win_start&amp;#039;]) or 0&lt;br /&gt;
	local team2wins = tonumber(args[&amp;#039;team2win_start&amp;#039;]) or 0&lt;br /&gt;
	local ties = tonumber(args[&amp;#039;tie_start&amp;#039;]) or 0&lt;br /&gt;
	local series_summary = isnotempty(args[&amp;#039;series_summary&amp;#039;])&lt;br /&gt;
	local legend = (args[&amp;#039;legend&amp;#039;] and args[&amp;#039;legend&amp;#039;] ~= &amp;#039;no&amp;#039;) or (args[&amp;#039;legend&amp;#039;] == nil)&lt;br /&gt;
	local cols = tonumber(args[&amp;#039;cols&amp;#039;] or &amp;#039;&amp;#039;) or 0&lt;br /&gt;
	local tiestyle = args[&amp;#039;tiestyle&amp;#039;] or &amp;#039;background-color:#DDD; color:#000;&amp;#039;&lt;br /&gt;
	local nowinstyle = args[&amp;#039;nowinstyle&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	local number_start = tonumber(args[&amp;#039;number_start&amp;#039;] or &amp;#039;1&amp;#039;) or 1&lt;br /&gt;
	local tseries_start = tonumber(args[&amp;#039;trophy_series_start&amp;#039;] or &amp;#039;0&amp;#039;) or 0&lt;br /&gt;
	local tseries_end = tonumber(args[&amp;#039;trophy_series_end&amp;#039;] or &amp;#039;0&amp;#039;) or 0&lt;br /&gt;
	local tsteam1wins = 0&lt;br /&gt;
	local tsteam2wins = 0&lt;br /&gt;
	local tsties = 0&lt;br /&gt;
	&lt;br /&gt;
	local res = &amp;#039;&amp;#039;&lt;br /&gt;
	local topres = &amp;#039;&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
	if (cols &amp;lt; 1 ) then cols = 1 end&lt;br /&gt;
&lt;br /&gt;
	-- compute the maximum cell index&lt;br /&gt;
	local cellcount = 0&lt;br /&gt;
	for k, v in pairs( args ) do&lt;br /&gt;
		if type( k ) == &amp;#039;number&amp;#039; then&lt;br /&gt;
			cellcount = math.max(cellcount, k)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- datacols&lt;br /&gt;
	local datacols = 6&lt;br /&gt;
	if notes then datacols = datacols + 1 end&lt;br /&gt;
	if no_location then datacols = datacols - 1 end&lt;br /&gt;
	&lt;br /&gt;
	-- dataoffsets&lt;br /&gt;
	local doffsets = no_location &lt;br /&gt;
		and { [&amp;#039;date&amp;#039;] = 1, [&amp;#039;t1&amp;#039;] = 2, [&amp;#039;s1&amp;#039;] = 3, [&amp;#039;t2&amp;#039;] = 4, [&amp;#039;s2&amp;#039;] = 5, [&amp;#039;note&amp;#039;] = 6}&lt;br /&gt;
		or { [&amp;#039;date&amp;#039;] = 1, [&amp;#039;loc&amp;#039;] = 2, [&amp;#039;t1&amp;#039;] = 3, [&amp;#039;s1&amp;#039;] = 4, [&amp;#039;t2&amp;#039;] = 5, [&amp;#039;s2&amp;#039;] = 6, [&amp;#039;note&amp;#039;] = 7}&lt;br /&gt;
	&lt;br /&gt;
	-- compute the number of rows&lt;br /&gt;
	local rows = math.ceil(cellcount / datacols)&lt;br /&gt;
	&lt;br /&gt;
	-- compute the number of rows per column&lt;br /&gt;
	local totalrows = rows&lt;br /&gt;
	if (series_summary ) then totalrows = totalrows + 1 end&lt;br /&gt;
	if (isnotempty(args[&amp;#039;note&amp;#039;])) then totalrows = totalrows + 1 end&lt;br /&gt;
	local percol = math.ceil( totalrows / cols )&lt;br /&gt;
&lt;br /&gt;
	if( (tseries_start &amp;gt; 0) or (tseries_end &amp;gt; 0) ) then&lt;br /&gt;
		if( tseries_start &amp;lt; 1 ) then&lt;br /&gt;
			tseries_start = 1&lt;br /&gt;
		end&lt;br /&gt;
		if( tseries_end &amp;lt; 1 ) then&lt;br /&gt;
			tseries_end = rows&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- generate the legend&lt;br /&gt;
	if( legend ) then&lt;br /&gt;
		local legendtable = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
		local col3 = args[&amp;#039;legend_tie_text&amp;#039;] or &amp;#039;Tie games&amp;#039;&lt;br /&gt;
		local col4 = args[&amp;#039;legend_forfeit_text&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
		local lcc = 2&lt;br /&gt;
		if isnotempty(col3) then lcc = lcc + 1 else col3 = nil end&lt;br /&gt;
		if isnotempty(col4) then lcc = lcc + 1 else col4 = nil end&lt;br /&gt;
		local w12 = math.floor(100/lcc + 0.5)&lt;br /&gt;
		local w34 = 0&lt;br /&gt;
		if lcc &amp;gt; 2 then w34 = (100 - 2*w12)/(lcc - 2) end&lt;br /&gt;
		legendtable&lt;br /&gt;
			:addClass(&amp;#039;wikitable&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;font-size&amp;#039;, &amp;#039;90%&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;white-space&amp;#039;, &amp;#039;nowrap&amp;#039;)&lt;br /&gt;
			:cssText(args[&amp;#039;style&amp;#039;])&lt;br /&gt;
		local lrow = legendtable:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		local t1 = mw.ustring.gsub(team1name, &amp;#039;%s*/.*&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
		local t2 = mw.ustring.gsub(team2name, &amp;#039;%s*/.*&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
		lrow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:cssText(team1style)&lt;br /&gt;
			:css(&amp;#039;font-weight&amp;#039;, &amp;#039;bold&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;width&amp;#039;, w12 .. &amp;#039;%&amp;#039;)&lt;br /&gt;
			:wikitext(t1 .. &amp;#039; victories&amp;#039;)&lt;br /&gt;
		lrow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:cssText(team2style)&lt;br /&gt;
			:css(&amp;#039;font-weight&amp;#039;, &amp;#039;bold&amp;#039;)&lt;br /&gt;
			:css(&amp;#039;width&amp;#039;, w12 .. &amp;#039;%&amp;#039;)&lt;br /&gt;
			:wikitext(t2 .. &amp;#039; victories&amp;#039;)&lt;br /&gt;
		if( col3 ) then&lt;br /&gt;
			lrow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:cssText(tiestyle)&lt;br /&gt;
				:css(&amp;#039;width&amp;#039;, w34 .. &amp;#039;%&amp;#039;)&lt;br /&gt;
				:wikitext(col3)&lt;br /&gt;
		end&lt;br /&gt;
		if( col4 ) then&lt;br /&gt;
			lrow:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;width&amp;#039;, w34 .. &amp;#039;%&amp;#039;)&lt;br /&gt;
				:wikitext(col4)&lt;br /&gt;
		end&lt;br /&gt;
		topres = topres .. tostring(legendtable)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- build the table content&lt;br /&gt;
	for j=1,rows do&lt;br /&gt;
		if(math.fmod(j - 1, percol) == 0 ) then&lt;br /&gt;
			-- create the root table&lt;br /&gt;
			res = res .. (root and tostring(root) or &amp;#039;&amp;#039;)&lt;br /&gt;
			root = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
			root:addClass(&amp;#039;wikitable&amp;#039;)&lt;br /&gt;
			root:css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;font-size&amp;#039;, &amp;#039;90%&amp;#039;)&lt;br /&gt;
			root:cssText(args[&amp;#039;style&amp;#039;])&lt;br /&gt;
			if(cols &amp;gt; 1) then&lt;br /&gt;
				root:css(&amp;#039;float&amp;#039;, &amp;#039;left&amp;#039;)&lt;br /&gt;
				root:css(&amp;#039;margin-right&amp;#039;, &amp;#039;1em&amp;#039;)&lt;br /&gt;
			end&lt;br /&gt;
			addheader(args[&amp;#039;header1&amp;#039;], args[&amp;#039;header2&amp;#039;], series_summary, &lt;br /&gt;
				compact, winner_only, compact_score, no_number, no_location, &lt;br /&gt;
				(tseries_start &amp;gt; 0), notes, notes_label,&lt;br /&gt;
				args[&amp;#039;date_width&amp;#039;], args[&amp;#039;location_width&amp;#039;])&lt;br /&gt;
		end&lt;br /&gt;
		-- start a new row&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		row:css(&amp;#039;vertical-align&amp;#039;, &amp;#039;top&amp;#039;)&lt;br /&gt;
		-- Number&lt;br /&gt;
		if (not no_number) then row:tag(&amp;#039;td&amp;#039;):wikitext(j - 1 + number_start) end&lt;br /&gt;
		-- Date&lt;br /&gt;
		row:tag(&amp;#039;td&amp;#039;):wikitext(args[datacols*(j-1)+doffsets[&amp;#039;date&amp;#039;]] or &amp;#039;&amp;#039;)&lt;br /&gt;
		-- Location&lt;br /&gt;
		if(not no_location) then&lt;br /&gt;
			row:tag(&amp;#039;td&amp;#039;):wikitext(args[datacols*(j-1)+doffsets[&amp;#039;loc&amp;#039;]] or &amp;#039;&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		-- Team1 / Team2 / Score1 / Score2&lt;br /&gt;
		local team1 = get_name(args[datacols*(j-1)+doffsets[&amp;#039;t1&amp;#039;]])&lt;br /&gt;
		local score1 = mw.ustring.gsub(args[datacols*(j-1)+doffsets[&amp;#039;s1&amp;#039;]] or &amp;#039;&amp;#039;, &amp;#039;^%s*(.-)%s*$&amp;#039;, &amp;#039;%1&amp;#039;)&lt;br /&gt;
		local team2 = get_name(args[datacols*(j-1)+doffsets[&amp;#039;t2&amp;#039;]])&lt;br /&gt;
		local score2 = mw.ustring.gsub(args[datacols*(j-1)+doffsets[&amp;#039;s2&amp;#039;]] or &amp;#039;&amp;#039;, &amp;#039;^%s*(.-)%s*$&amp;#039;, &amp;#039;%1&amp;#039;)&lt;br /&gt;
		local shade1 = nil&lt;br /&gt;
		local shade2 = nil&lt;br /&gt;
		local win = mw.ustring.gsub(args[&amp;#039;win&amp;#039; .. (j - 1 + number_start)] or &amp;#039;&amp;#039;, &amp;#039;^%s*(.-)%s*$&amp;#039;, &amp;#039;%1&amp;#039;) or &amp;#039;&amp;#039;&lt;br /&gt;
		if( isnotempty(win) ) then&lt;br /&gt;
			topres = topres .. &amp;#039;[[Category:Pages using sports rivalry series table with a win parameter]]&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		if( isnotempty(win) or (score1 ~= &amp;#039;&amp;#039; and score2 ~= &amp;#039;&amp;#039;) ) then&lt;br /&gt;
			local score1num = tonumber(formatnumR(score1)) or 0&lt;br /&gt;
			local score2num = tonumber(formatnumR(score2)) or 0&lt;br /&gt;
			if( isnotempty(win) ) then&lt;br /&gt;
				score1num = -1&lt;br /&gt;
				score2num = -1&lt;br /&gt;
			end&lt;br /&gt;
			if ( (win == team1) or (score1num &amp;gt; score2num) ) then&lt;br /&gt;
				if( ismultiequal(team1, team1name) ) then&lt;br /&gt;
					shade1 = &amp;#039;font-weight:bold;&amp;#039; .. team1style&lt;br /&gt;
					if isnotempty(win) then shade2 = nowinstyle end&lt;br /&gt;
					team1wins = team1wins + 1&lt;br /&gt;
					if (j &amp;gt;= tseries_start and j &amp;lt;= tseries_end) then tsteam1wins = tsteam1wins + 1 end&lt;br /&gt;
				elseif ( ismultiequal(team1, team2name) ) then&lt;br /&gt;
					shade1 = &amp;#039;font-weight:bold;&amp;#039; .. team2style&lt;br /&gt;
					if isnotempty(win) then shade2 = nowinstyle end&lt;br /&gt;
					team2wins = team2wins + 1&lt;br /&gt;
					if (j &amp;gt;= tseries_start and j &amp;lt;= tseries_end) then tsteam2wins = tsteam2wins + 1 end&lt;br /&gt;
				end&lt;br /&gt;
			elseif ( (win == team2) or (score2num &amp;gt; score1num) ) then&lt;br /&gt;
				if( ismultiequal(team2, team1name) ) then&lt;br /&gt;
					shade2 = &amp;#039;font-weight:bold;&amp;#039; .. team1style&lt;br /&gt;
					if isnotempty(win) then shade1 = nowinstyle end&lt;br /&gt;
					if (j &amp;gt;= tseries_start and j &amp;lt;= tseries_end) then tsteam1wins = tsteam1wins + 1 end&lt;br /&gt;
					team1wins = team1wins + 1&lt;br /&gt;
				elseif ( ismultiequal(team2, team2name) ) then&lt;br /&gt;
					shade2 = &amp;#039;font-weight:bold;&amp;#039; .. team2style&lt;br /&gt;
					if isnotempty(win) then shade1 = nowinstyle end&lt;br /&gt;
					team2wins = team2wins + 1&lt;br /&gt;
					if (j &amp;gt;= tseries_start and j &amp;lt;= tseries_end) then tsteam2wins = tsteam2wins + 1 end&lt;br /&gt;
				end&lt;br /&gt;
			elseif ( (win == &amp;#039;tie&amp;#039;) or (not isnotempty(win) ) ) then&lt;br /&gt;
				shade1 = tiestyle&lt;br /&gt;
				shade2 = tiestyle&lt;br /&gt;
				if not args[&amp;#039;header1&amp;#039;] then &lt;br /&gt;
					args[datacols*(j-1)+doffsets[&amp;#039;t1&amp;#039;]] = &amp;#039;Tie&amp;#039;&lt;br /&gt;
					args[datacols*(j-1)+doffsets[&amp;#039;t2&amp;#039;]] = &amp;#039;Tie&amp;#039;&lt;br /&gt;
				end&lt;br /&gt;
				ties = ties + 1&lt;br /&gt;
				if (j &amp;gt;= tseries_start and j &amp;lt;= tseries_end) then tsties = tsties + 1 end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		shaderow = args[&amp;#039;style&amp;#039; .. (j - 1 + number_start)]&lt;br /&gt;
		if( (not compact) and (not winner_only) and (not compact_score)) then&lt;br /&gt;
			-- Team 1&lt;br /&gt;
			row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:cssText(shaderow or shade1)&lt;br /&gt;
				:wikitext(small_rank(args[datacols*(j-1)+doffsets[&amp;#039;t1&amp;#039;]]))&lt;br /&gt;
			-- Team 1 score&lt;br /&gt;
			row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:cssText(shaderow or shade1)&lt;br /&gt;
				:wikitext(score1)&lt;br /&gt;
			-- Team 2&lt;br /&gt;
			row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:cssText(shaderow or shade2)&lt;br /&gt;
				:wikitext(small_rank(args[datacols*(j-1)+doffsets[&amp;#039;t2&amp;#039;]]))&lt;br /&gt;
			-- Team 2 score&lt;br /&gt;
			row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				:cssText(shaderow or shade2)&lt;br /&gt;
				:wikitext(score2)&lt;br /&gt;
			-- Series&lt;br /&gt;
			if(not series_summary) then&lt;br /&gt;
				local seriescell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				if( score1 ~= &amp;#039;&amp;#039; and score2 ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
					seriescell:wikitext(series_text(team1abbr, team1wins, team2abbr, team2wins, ties, nil))&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if(tseries_start &amp;gt; 0) then&lt;br /&gt;
				local seriescell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				if( score1 ~= &amp;#039;&amp;#039; and score2 ~= &amp;#039;&amp;#039; and j &amp;gt;= tseries_start and j &amp;lt;= tseries_end) then&lt;br /&gt;
					seriescell:wikitext(series_text(team1abbr, tsteam1wins, team2abbr, tsteam2wins, tsties, nil))&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			if( isnotempty(win) or (score1 ~= &amp;#039;&amp;#039; and score2 ~= &amp;#039;&amp;#039;) ) then&lt;br /&gt;
				local score1num = tonumber(formatnumR(score1)) or 0&lt;br /&gt;
				local score2num = tonumber(formatnumR(score2)) or 0&lt;br /&gt;
				if(score1num &amp;gt; score2num) then&lt;br /&gt;
					-- Winner&lt;br /&gt;
					row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
						:cssText(shaderow or shade1)&lt;br /&gt;
						:wikitext(small_rank(args[datacols*(j-1)+doffsets[&amp;#039;t1&amp;#039;]]))&lt;br /&gt;
					if compact_score then&lt;br /&gt;
						-- Loser&lt;br /&gt;
						row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
							:wikitext(small_rank(args[datacols*(j-1)+doffsets[&amp;#039;t2&amp;#039;]]))&lt;br /&gt;
					end&lt;br /&gt;
					-- Score&lt;br /&gt;
					row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
						:wikitext(score1 .. &amp;#039;–&amp;#039; .. score2)&lt;br /&gt;
				elseif(score2num &amp;gt; score1num) then&lt;br /&gt;
					if compact_score then&lt;br /&gt;
						-- Loser&lt;br /&gt;
						row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
							:wikitext(small_rank(args[datacols*(j-1)+doffsets[&amp;#039;t1&amp;#039;]]))&lt;br /&gt;
					end&lt;br /&gt;
					-- Winner&lt;br /&gt;
					row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
						:cssText(shaderow or shade2)&lt;br /&gt;
						:wikitext(small_rank(args[datacols*(j-1)+doffsets[&amp;#039;t2&amp;#039;]]))&lt;br /&gt;
					-- Score&lt;br /&gt;
					row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
						:wikitext(score2 .. &amp;#039;–&amp;#039; .. score1)&lt;br /&gt;
				else&lt;br /&gt;
					if compact_score then&lt;br /&gt;
						row:tag(&amp;#039;td&amp;#039;):cssText(shaderow or tiestyle):attr(&amp;#039;colspan&amp;#039;,2):wikitext(&amp;#039;Tie&amp;#039;)&lt;br /&gt;
					else&lt;br /&gt;
						-- Winner&lt;br /&gt;
						row:tag(&amp;#039;td&amp;#039;):cssText(shaderow or tiestyle):wikitext(&amp;#039;Tie&amp;#039;)&lt;br /&gt;
					end&lt;br /&gt;
					-- Score&lt;br /&gt;
					row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
						:wikitext(score1 .. &amp;#039;–&amp;#039; .. score2)&lt;br /&gt;
				end&lt;br /&gt;
				if( (winner_only or compact_score) and (not series_summary)) then&lt;br /&gt;
					local seriescell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
					if( score1 ~= &amp;#039;&amp;#039; and score2 ~= &amp;#039;&amp;#039;) then&lt;br /&gt;
						seriescell:wikitext(series_text(team1abbr, team1wins, team2abbr, team2wins, ties, nil))&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				if(tseries_start &amp;gt; 0) then&lt;br /&gt;
					local seriescell = row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
					if( score1 ~= &amp;#039;&amp;#039; and score2 ~= &amp;#039;&amp;#039; and j &amp;gt;= tseries_start and j &amp;lt;= tseries_end) then&lt;br /&gt;
						seriescell:wikitext(series_text(team1abbr, tsteam1wins, team2abbr, tsteam2wins, tsties, nil))&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if(notes) then row:tag(&amp;#039;td&amp;#039;):wikitext(args[datacols*(j-1)+doffsets[&amp;#039;note&amp;#039;]] or &amp;#039;&amp;#039;) end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if( series_summary and root) then&lt;br /&gt;
		local ftext = &amp;#039;\&amp;#039;\&amp;#039;\&amp;#039;Series:\&amp;#039;\&amp;#039;\&amp;#039; &amp;#039;&lt;br /&gt;
		local ftext = ftext .. series_text(team1name, team1wins, team2name, team2wins, ties, 1)&lt;br /&gt;
		if(args[&amp;#039;footnote&amp;#039;]) then&lt;br /&gt;
			ftext = ftext .. args[&amp;#039;footnote&amp;#039;]&lt;br /&gt;
		end&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, 9)&lt;br /&gt;
			:css(&amp;#039;background-color&amp;#039;, &amp;#039;#f0f0f0&amp;#039;)&lt;br /&gt;
			:wikitext(ftext)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if(isnotempty(args[&amp;#039;note&amp;#039;]) and root) then&lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		row:tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			:attr(&amp;#039;colspan&amp;#039;, 9)&lt;br /&gt;
			:wikitext(args[&amp;#039;note&amp;#039;])&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	res = res .. (root and tostring(root) or &amp;#039;&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	if (cols &amp;gt; 1 ) then&lt;br /&gt;
		root = mw.html.create(&amp;#039;table&amp;#039;)&lt;br /&gt;
		root:attr(&amp;#039;role&amp;#039;, &amp;#039;presentation&amp;#039;) &lt;br /&gt;
		row = root:tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		row:tag(&amp;#039;td&amp;#039;):wikitext(res)&lt;br /&gt;
		res = tostring(root)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- return the root table&lt;br /&gt;
	return topres .. res&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Frietjes</name></author>
	</entry>
</feed>