<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://wiki.froce.fr//index.php?action=history&amp;feed=atom&amp;title=Module%3ATeamBracket-Tennis</id>
	<title>Module:TeamBracket-Tennis - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.froce.fr//index.php?action=history&amp;feed=atom&amp;title=Module%3ATeamBracket-Tennis"/>
	<link rel="alternate" type="text/html" href="https://wiki.froce.fr//index.php?title=Module:TeamBracket-Tennis&amp;action=history"/>
	<updated>2026-04-09T22:38:03Z</updated>
	<subtitle>Historique des révisions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.froce.fr//index.php?title=Module:TeamBracket-Tennis&amp;diff=653&amp;oldid=prev</id>
		<title>Maximilià Macià : 1 révision importée</title>
		<link rel="alternate" type="text/html" href="https://wiki.froce.fr//index.php?title=Module:TeamBracket-Tennis&amp;diff=653&amp;oldid=prev"/>
		<updated>2018-09-17T12:01:53Z</updated>

		<summary type="html">&lt;p&gt;1 révision importée&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 17 septembre 2018 à 14:01&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key t39a0_FRO_WIKI-blh_:diff::1.12:old-5:rev-653 --&gt;
&lt;/table&gt;</summary>
		<author><name>Maximilià Macià</name></author>
	</entry>
	<entry>
		<id>https://wiki.froce.fr//index.php?title=Module:TeamBracket-Tennis&amp;diff=5&amp;oldid=prev</id>
		<title>Alexandre Lacroix Le Menn : Page créée avec « -- -- This module implements many tennis bracket templates --  local p = {} local args = {} local rounds local sets = {} local compact local byes local hideSeeds local sho... »</title>
		<link rel="alternate" type="text/html" href="https://wiki.froce.fr//index.php?title=Module:TeamBracket-Tennis&amp;diff=5&amp;oldid=prev"/>
		<updated>2018-09-14T23:38:32Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « -- -- This module implements many tennis bracket templates --  local p = {} local args = {} local rounds local sets = {} local compact local byes local hideSeeds local sho... »&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 15 septembre 2018 à 01:38&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key t39a0_FRO_WIKI-blh_:diff::1.12:old-652:rev-5 --&gt;
&lt;/table&gt;</summary>
		<author><name>Alexandre Lacroix Le Menn</name></author>
	</entry>
	<entry>
		<id>https://wiki.froce.fr//index.php?title=Module:TeamBracket-Tennis&amp;diff=652&amp;oldid=prev</id>
		<title>Wikipedia&gt;Frietjes : fix</title>
		<link rel="alternate" type="text/html" href="https://wiki.froce.fr//index.php?title=Module:TeamBracket-Tennis&amp;diff=652&amp;oldid=prev"/>
		<updated>2017-05-04T18:29:44Z</updated>

		<summary type="html">&lt;p&gt;fix&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--&lt;br /&gt;
-- This module implements many tennis bracket templates&lt;br /&gt;
--&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
local args = {}&lt;br /&gt;
local rounds&lt;br /&gt;
local sets = {}&lt;br /&gt;
local compact&lt;br /&gt;
local byes&lt;br /&gt;
local hideSeeds&lt;br /&gt;
local showSeeds&lt;br /&gt;
local hideHeadings&lt;br /&gt;
local showThird&lt;br /&gt;
local offsetThird&lt;br /&gt;
local compactFinal&lt;br /&gt;
local RD1seedmap = {}&lt;br /&gt;
local tcats = ''&lt;br /&gt;
&lt;br /&gt;
local function isnotblank(s)&lt;br /&gt;
	return s and s ~= ''&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function isblank(s)&lt;br /&gt;
	return (not s) or (s == '')&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function parseArgs(frame)&lt;br /&gt;
	local fargs = frame.args&lt;br /&gt;
	local pargs = frame:getParent().args;&lt;br /&gt;
&lt;br /&gt;
	local r = tonumber(fargs.rounds or '') or tonumber(pargs.rounds or '') or 2&lt;br /&gt;
	local teams = math.pow(2, r)&lt;br /&gt;
	local rdstr = 'RD' .. tostring(r)&lt;br /&gt;
	local rdbstr = 'RD' .. tostring(r) .. 'b'&lt;br /&gt;
	local rdp1str = 'RD' .. tostring(r+1)&lt;br /&gt;
&lt;br /&gt;
	for i=1,2 do&lt;br /&gt;
		local targs = (i == 1) and pargs or fargs&lt;br /&gt;
		for k,v in pairs(targs) do&lt;br /&gt;
			if type(k) == 'string' then&lt;br /&gt;
				if k:find('^[R3][Dr][d1-9]b?%-[a-z][a-z]*00*') then&lt;br /&gt;
					k = mw.ustring.gsub(k, '^([R3][Dr][d1-9]b?%-[a-z][a-z]*)00*', '%1')&lt;br /&gt;
					if (teams &amp;lt; 10) then &lt;br /&gt;
						tcats = tcats .. '[[Category:Pages using a tennis bracket with deprecated syntax|P]]'&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				if k:find('^' .. rdp1str) then&lt;br /&gt;
					k = mw.ustring.gsub(k, '^' .. rdp1str, '3rd')&lt;br /&gt;
					tcats = tcats .. '[[Category:Pages using a tennis bracket with deprecated syntax|3]]'&lt;br /&gt;
				elseif k:find('^' .. rdbstr) then&lt;br /&gt;
					k = mw.ustring.gsub(k, '^' .. rdbstr, '3rd')&lt;br /&gt;
				elseif k:find('^' .. rdstr .. '%-[a-z][a-z]*3') then&lt;br /&gt;
					k = mw.ustring.gsub(k, '^' .. rdstr .. '(%-[a-z][a-z]*)3', '3rd%11')&lt;br /&gt;
				elseif k:find('^' .. rdstr .. '%-[a-z][a-z]*4') then&lt;br /&gt;
					k = mw.ustring.gsub(k, '^' .. rdstr .. '(%-[a-z][a-z]*)4', '3rd%12')&lt;br /&gt;
				elseif  k:find('^Consol') then&lt;br /&gt;
					k = mw.ustring.gsub(k, '^Consol', '3rd')&lt;br /&gt;
					tcats = tcats .. '[[Category:Pages using a tennis bracket with deprecated syntax|3]]'&lt;br /&gt;
				elseif k:find('^group[0-9]') then&lt;br /&gt;
					tcats = tcats .. '[[Category:Pages using a tennis bracket with deprecated syntax|G]]'&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			args[k] = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (args['byes'] and (args['byes'] == 'yes' or args['byes'] == 'y')) then&lt;br /&gt;
		tcats = tcats .. '[[Category:Pages using a tennis bracket with deprecated syntax|B]]'&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function parseSeedmap(s)&lt;br /&gt;
	s = mw.text.split((s or '0') .. '/', '[%s]*/[%s]*')&lt;br /&gt;
	local teams = math.pow(2, rounds)&lt;br /&gt;
	for r=1,teams do&lt;br /&gt;
		RD1seedmap[r] = 1&lt;br /&gt;
	end&lt;br /&gt;
	for r=1,#s do&lt;br /&gt;
		if tonumber(s[r] or 'x') then&lt;br /&gt;
			RD1seedmap[tonumber(s[r])] = 0&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local c = 1&lt;br /&gt;
	for r=1,teams do&lt;br /&gt;
		if RD1seedmap[r] &amp;gt; 0 then&lt;br /&gt;
			RD1seedmap[r] = c&lt;br /&gt;
			c = c + 1&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function parseSets(s)&lt;br /&gt;
	s = mw.text.split((s or '5') .. '/', '[%s]*/[%s]*')&lt;br /&gt;
	local n = showThird and (rounds + 1) or (rounds)&lt;br /&gt;
	for r=1,n do&lt;br /&gt;
		if s[r] ~= nil and s[r] ~= '' and tonumber(s[r]) then&lt;br /&gt;
			sets[r] = tonumber(s[r])&lt;br /&gt;
		elseif sets[r-1] then&lt;br /&gt;
			sets[r] = sets[r-1]&lt;br /&gt;
		else&lt;br /&gt;
			sets[r] = 5&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function addTableRow(tbl)&lt;br /&gt;
	return tbl:tag('tr')&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function addBlank(row, width)&lt;br /&gt;
	local cell = row:tag('td')&lt;br /&gt;
	if width then&lt;br /&gt;
		cell:css('width', width)&lt;br /&gt;
	end&lt;br /&gt;
	return cell&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function addHeading(row, r, text)&lt;br /&gt;
	row:tag('td')&lt;br /&gt;
		:attr('colspan', tonumber(hideSeeds and '1' or '2') + sets[r])&lt;br /&gt;
		:css('text-align', 'center')&lt;br /&gt;
		:css('border', '1px solid #aaa')&lt;br /&gt;
		:css('background-color', args['RD-shade'] or '#f2f2f2')&lt;br /&gt;
		:wikitext(text)&lt;br /&gt;
		:newline()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getWidth(param, default)&lt;br /&gt;
	local arg = args[param .. '-width']&lt;br /&gt;
	if isblank(arg) then&lt;br /&gt;
		arg = default&lt;br /&gt;
	end&lt;br /&gt;
	if tonumber(arg) ~= nil then&lt;br /&gt;
		arg = arg .. 'px'&lt;br /&gt;
	end&lt;br /&gt;
	return arg&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getTeamArgName(round, type, team)&lt;br /&gt;
	if round &amp;gt; rounds then&lt;br /&gt;
		return string.format('3rd-%s%d', type, team)&lt;br /&gt;
	else&lt;br /&gt;
		if (round == 1) then&lt;br /&gt;
			team = RD1seedmap[team]&lt;br /&gt;
			if team == 0 then&lt;br /&gt;
				return 'NIL'&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return string.format('RD%d-%s%d', round, type, team)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getShadeArg(round, team, s)&lt;br /&gt;
	local argname = getTeamArgName(round, 'shade', team) .. (s and ('-' .. s) or '')&lt;br /&gt;
	local value = args[argname]&lt;br /&gt;
	if isblank(value) then&lt;br /&gt;
		return '#f9f9f9'&lt;br /&gt;
	end&lt;br /&gt;
	return value&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getScoreArg(round, team, s)&lt;br /&gt;
	local argname = getTeamArgName(round, 'score', team) .. (s and ('-' .. s) or '')&lt;br /&gt;
	local value = args[argname]&lt;br /&gt;
	if isblank(value) then&lt;br /&gt;
		return ''&lt;br /&gt;
	end&lt;br /&gt;
	return value&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getTeamArg(round, type, team)&lt;br /&gt;
	local argname = getTeamArgName(round, type, team)&lt;br /&gt;
	local value = args[argname]&lt;br /&gt;
	if isblank(value) then&lt;br /&gt;
		return ''&lt;br /&gt;
	end&lt;br /&gt;
	if mw.ustring.find(value, '[%s]*&amp;lt;[%s/]*[Bb][Rr][%s/]*&amp;gt;[%s ]*&amp;amp;[Nn][Bb][Ss][Pp];[%s]*') then&lt;br /&gt;
		tcats = '[[Category:Pages using a tennis bracket with nbsp]]'&lt;br /&gt;
	end&lt;br /&gt;
	return mw.ustring.gsub(value, '[%s]*&amp;lt;[%s/]*[Bb][Rr][%s/]*&amp;gt;[%s ]*&amp;amp;[Nn][Bb][Ss][Pp];[%s]*', '&amp;lt;br/&amp;gt;')&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function isHidden(r, team)&lt;br /&gt;
	return isblank( getTeamArg(r, 'team', team) )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getRoundName(round)&lt;br /&gt;
	local name = args['RD' .. round]&lt;br /&gt;
	if isnotblank(name) then&lt;br /&gt;
		return name&lt;br /&gt;
	end&lt;br /&gt;
	local roundFromLast = rounds - round + 1&lt;br /&gt;
	if roundFromLast == 1 then&lt;br /&gt;
		return &amp;quot;Finals&amp;quot;&lt;br /&gt;
	elseif roundFromLast == 2 then&lt;br /&gt;
		return &amp;quot;Semifinals&amp;quot;&lt;br /&gt;
	elseif roundFromLast == 3 then&lt;br /&gt;
		return &amp;quot;Quarterfinals&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;Round of &amp;quot; .. math.pow(2, roundFromLast)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function addPath(rows, index, round, top, left, w)&lt;br /&gt;
	local prop = top and 'border-bottom-width' or 'border-top-width'&lt;br /&gt;
	if left and round == 1 then&lt;br /&gt;
		if compact then&lt;br /&gt;
			addBlank(rows[index])&lt;br /&gt;
		else&lt;br /&gt;
			addBlank(rows[index]):css('height', '7px')&lt;br /&gt;
			addBlank(rows[index + 1]):css('height', '7px')&lt;br /&gt;
		end&lt;br /&gt;
		return nil&lt;br /&gt;
	else&lt;br /&gt;
		local cell = addBlank(rows[index])&lt;br /&gt;
			:attr('rowspan', (not compact) and '2' or nil)&lt;br /&gt;
			:css('border-width', '0')&lt;br /&gt;
			:css('border-style', 'solid')&lt;br /&gt;
			:css('border-color', 'black')&lt;br /&gt;
		if left or round &amp;lt; rounds and not left then&lt;br /&gt;
			cell:css(prop, w or '2px')&lt;br /&gt;
		end&lt;br /&gt;
		return cell&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function renderTeam(row, round, team, top, otherbye)&lt;br /&gt;
	local seedCell&lt;br /&gt;
	local seedArg = getTeamArg(round, 'seed', team)&lt;br /&gt;
	-- seed value for the paired team&lt;br /&gt;
	local pairSeedArg = otherbye and '' &lt;br /&gt;
		or getTeamArg(round, 'seed', team % 2 == 0 and team-1 or team+1)&lt;br /&gt;
	-- show seed if seed is defined for either or both&lt;br /&gt;
	local showSeed = showSeeds&lt;br /&gt;
		or isnotblank(seedArg)&lt;br /&gt;
		or isnotblank(pairSeedArg)&lt;br /&gt;
	if showSeed and (not hideSeeds) then&lt;br /&gt;
		seedCell = row:tag('td')&lt;br /&gt;
			:css('text-align', 'center')&lt;br /&gt;
			:css('background-color', '#f2f2f2')&lt;br /&gt;
			:css('border-color', '#aaa')&lt;br /&gt;
			:css('border-style', 'solid')&lt;br /&gt;
			:css('border-top-width', (top or otherbye) and '1px' or '0')&lt;br /&gt;
			:css('border-left-width', '1px')&lt;br /&gt;
			:css('border-right-width', '1px')&lt;br /&gt;
			:css('border-bottom-width', '1px')&lt;br /&gt;
			:attr('rowspan', (not compact) and '2' or nil)&lt;br /&gt;
			:wikitext(seedArg)&lt;br /&gt;
			:newline()&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local teamArg = getTeamArg(round, 'team', team)&lt;br /&gt;
	if isblank(teamArg) then&lt;br /&gt;
		teamArg = '&amp;amp;nbsp;'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local teamCell = row:tag('td')&lt;br /&gt;
		:css('background-color', '#f9f9f9')&lt;br /&gt;
		:css('border-color', '#aaa')&lt;br /&gt;
		:css('border-style', 'solid')&lt;br /&gt;
		:css('border-top-width', (top or otherbye)and '1px' or '0')&lt;br /&gt;
		:css('border-left-width', '1px')&lt;br /&gt;
		:css('border-right-width', '1px')&lt;br /&gt;
		:css('border-bottom-width', '1px')	&lt;br /&gt;
		:css('padding', '0 2px')&lt;br /&gt;
		:attr('rowspan', (not compact) and '2' or nil)&lt;br /&gt;
		:wikitext(teamArg)&lt;br /&gt;
		:newline()&lt;br /&gt;
	if not showSeed and (not hideSeeds) then&lt;br /&gt;
		teamCell:attr('colspan', '2')&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local scoreCells = {}&lt;br /&gt;
	for s = 1, sets[round] do&lt;br /&gt;
		scoreCells[s] = row:tag('td')&lt;br /&gt;
			:css('text-align', 'center')&lt;br /&gt;
			:css('border-color', '#aaa')&lt;br /&gt;
			:css('border-style', 'solid')&lt;br /&gt;
			:css('border-top-width', (top or otherbye) and '1px' or '0')&lt;br /&gt;
			:css('border-left-width', '0')&lt;br /&gt;
			:css('border-right-width', '1px')&lt;br /&gt;
			:css('border-bottom-width', '1px')	&lt;br /&gt;
			:css('background-color', getShadeArg(round, team, s))&lt;br /&gt;
			:attr('rowspan', (not compact) and '2' or nil)&lt;br /&gt;
			:wikitext(getScoreArg(round, team, s))&lt;br /&gt;
			:newline()&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function renderRound(rows, count, r)&lt;br /&gt;
	local teams = math.pow(2, rounds - r + 1)&lt;br /&gt;
	local step = count / teams&lt;br /&gt;
	local topTeam = true -- is top row in match-up&lt;br /&gt;
	local topPair = true -- is top match-up in pair of match-ups&lt;br /&gt;
	local team = 1&lt;br /&gt;
&lt;br /&gt;
	for i = 1, count, step do&lt;br /&gt;
		local offset, height, blank&lt;br /&gt;
&lt;br /&gt;
		local hideteam = false&lt;br /&gt;
		local otherhideteam = false&lt;br /&gt;
		local hideleftpath = false&lt;br /&gt;
		if r &amp;lt;= byes then&lt;br /&gt;
			hideteam = isHidden(r, team)&lt;br /&gt;
			otherhideteam = isHidden(r, team % 2 == 0 and team-1 or team+1)&lt;br /&gt;
		end&lt;br /&gt;
		if (r == 1) and (RD1seedmap[team] &amp;lt;= 0) then&lt;br /&gt;
				hideteam = true&lt;br /&gt;
		end&lt;br /&gt;
		if (r &amp;gt; 1) and (r &amp;lt;= (byes + 1)) then&lt;br /&gt;
			hideleftpath = isHidden(r-1, 2*team-1) and isHidden(r-1, 2*team)&lt;br /&gt;
		end&lt;br /&gt;
		if (r == 2) and (RD1seedmap[2*team-1] &amp;lt;= 0 and RD1seedmap[2*team] &amp;lt;= 0) then&lt;br /&gt;
			hideleftpath = true&lt;br /&gt;
		end&lt;br /&gt;
		if compactFinal and (r == rounds) then&lt;br /&gt;
			hideleftpath = true&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- empty space above or below&lt;br /&gt;
		if compact then&lt;br /&gt;
			offset = topTeam and i or i + 1&lt;br /&gt;
			height = step - 1&lt;br /&gt;
		-- leave room for groups for teams other than first and last&lt;br /&gt;
		elseif team == 1 or team == teams then&lt;br /&gt;
			offset = topTeam and i or i + 2&lt;br /&gt;
			height = step - 2&lt;br /&gt;
		else&lt;br /&gt;
			offset = topTeam and i + 1 or i + 2&lt;br /&gt;
			height = step - 3&lt;br /&gt;
		end&lt;br /&gt;
		if showThird and (r == rounds) and (not topTeam) then&lt;br /&gt;
			height = offset - offsetThird&lt;br /&gt;
		end&lt;br /&gt;
		if compactFinal and (r == (rounds - 1)) then&lt;br /&gt;
			if team == 2 then&lt;br /&gt;
				height = height - 3&lt;br /&gt;
			end&lt;br /&gt;
			if team == 3 then&lt;br /&gt;
				height = height - 1&lt;br /&gt;
				offset = offset + 1&lt;br /&gt;
				rows[offset-3]:tag('td')&lt;br /&gt;
					:attr('colspan', tonumber(hideSeeds and '2' or '3') + sets[r])&lt;br /&gt;
				rows[offset-4]:tag('td')&lt;br /&gt;
				addHeading(rows[offset-4], r + 1, getRoundName(r+1))&lt;br /&gt;
				rows[offset-4]:tag('td')&lt;br /&gt;
					:attr('rowspan', 2)&lt;br /&gt;
					:css('border-color', 'black')&lt;br /&gt;
					:css('border-style', 'solid')&lt;br /&gt;
					:css('border-width', '0')&lt;br /&gt;
					:css('border-right-width', '2px')&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if height &amp;gt; 0 then&lt;br /&gt;
			blank = addBlank(rows[offset])&lt;br /&gt;
				:attr('colspan', tonumber(hideSeeds and '3' or '4') + sets[r])&lt;br /&gt;
				:attr('rowspan', height)&lt;br /&gt;
				:css('border-color', 'black')&lt;br /&gt;
				:css('border-style', 'solid')&lt;br /&gt;
				:css('border-width', '0')&lt;br /&gt;
		end&lt;br /&gt;
		-- add bracket&lt;br /&gt;
		local j = topTeam and i + step - (compact and 1 or 2) or i&lt;br /&gt;
		-- add left path&lt;br /&gt;
		addPath(rows, j, r, topTeam, true, hideleftpath and '0' or '2px')&lt;br /&gt;
		if hideteam then&lt;br /&gt;
			rows[j]:tag('td')&lt;br /&gt;
				:attr('colspan', tonumber(hideSeeds and '1' or '2') + sets[r])&lt;br /&gt;
				:attr('rowspan', (not compact) and 2 or nil)&lt;br /&gt;
		else&lt;br /&gt;
			renderTeam(rows[j], r, team, topTeam, otherhideteam)&lt;br /&gt;
		end&lt;br /&gt;
		local rightPath = addPath(rows, j, r, topTeam, false, hideteam and '0' or '2px')&lt;br /&gt;
		if not topTeam then topPair = not topPair end&lt;br /&gt;
		if not topPair and r &amp;lt; rounds and (not hideteam) then&lt;br /&gt;
			if blank then blank:css('border-right-width', '2px') end&lt;br /&gt;
			rightPath:css('border-right-width', '2px')&lt;br /&gt;
		end&lt;br /&gt;
		if compactFinal and (r == rounds) then&lt;br /&gt;
			local prop = (team == 1) and 'border-bottom-width' or 'border-top-width'&lt;br /&gt;
			rightPath:css('border-right-width', '2px')&lt;br /&gt;
				:css(prop, '2px')&lt;br /&gt;
		end&lt;br /&gt;
		team = team + 1&lt;br /&gt;
		topTeam = not topTeam&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function renderGroups(rows, count, round)&lt;br /&gt;
	local roundFromLast = rounds - round + 1&lt;br /&gt;
	local groups = math.pow(2, roundFromLast - 2)&lt;br /&gt;
	local step = count / groups&lt;br /&gt;
	local group = 1&lt;br /&gt;
	local offset = 0&lt;br /&gt;
	local team = 0&lt;br /&gt;
	local w = '2px'&lt;br /&gt;
&lt;br /&gt;
	for r = 1,round do&lt;br /&gt;
		offset = offset + (hideSeeds and 3 or 4) + sets[r]&lt;br /&gt;
	end&lt;br /&gt;
	for i = step / 2, count, step do&lt;br /&gt;
		local name = 'RD' .. round .. '-group' .. group&lt;br /&gt;
		addBlank(rows[i]):css('height', '7px')&lt;br /&gt;
		addBlank(rows[i + 1]):css('height', '7px')&lt;br /&gt;
		addBlank(rows[i])&lt;br /&gt;
			:attr('rowspan', '2')&lt;br /&gt;
			:attr('colspan', offset - 2)&lt;br /&gt;
			:css('text-align', 'center')&lt;br /&gt;
			:wikitext(args[name])&lt;br /&gt;
			:newline()&lt;br /&gt;
		if (round &amp;lt;= byes) then&lt;br /&gt;
			team = i/(step/2)&lt;br /&gt;
			w = isHidden(round, 2*team-1) and isHidden(round, 2*team) and '0' or '2px'&lt;br /&gt;
		end&lt;br /&gt;
		addBlank(rows[i])&lt;br /&gt;
			:css('border-color', 'black')&lt;br /&gt;
			:css('border-style', 'solid')&lt;br /&gt;
			:css('border-width', '0 ' .. w .. ' 0 0')&lt;br /&gt;
		if (round &amp;lt;= byes) then&lt;br /&gt;
			team = team + 1&lt;br /&gt;
			w = isHidden(round, 2*team-1) and isHidden(round, 2*team) and '0' or '2px'&lt;br /&gt;
		end&lt;br /&gt;
		addBlank(rows[i+1])&lt;br /&gt;
			:css('border-color', 'black')&lt;br /&gt;
			:css('border-style', 'solid')&lt;br /&gt;
			:css('border-width', '0 ' .. w ..' 0 0')&lt;br /&gt;
		group = group + 1&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getThirdOffset()&lt;br /&gt;
	local offset = (compact and 1 or 3) * (math.pow(2, rounds) - math.pow(2, rounds-3)) - (compact and 2 or 4)&lt;br /&gt;
	if rounds &amp;lt; 4 then&lt;br /&gt;
		offset = compact and 8 or 17&lt;br /&gt;
		if rounds &amp;lt; 3 then&lt;br /&gt;
			offset = compact and 6 or 10&lt;br /&gt;
			if rounds &amp;lt; 2 then&lt;br /&gt;
				offset = compact and 4 or 6&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return offset&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function renderThird(rows, count)&lt;br /&gt;
	local k = offsetThird&lt;br /&gt;
	local row = rows[k]&lt;br /&gt;
	local blank&lt;br /&gt;
	--if (offsetThird &amp;lt; count) then&lt;br /&gt;
		--blank = addBlank(row)&lt;br /&gt;
		--blank:attr('colspan', tonumber(hideSeeds and '3' or '4') + sets[1])&lt;br /&gt;
	--end&lt;br /&gt;
	blank = addBlank(row)&lt;br /&gt;
	addHeading(row, rounds + 1, args['3rd'] or 'Third place')&lt;br /&gt;
	k = k + (compact and 2 or 3)&lt;br /&gt;
	for i = 1,2 do&lt;br /&gt;
		row = rows[k]&lt;br /&gt;
		blank = addBlank(row)&lt;br /&gt;
		renderTeam(row, rounds + 1, i, i == 1, false)&lt;br /&gt;
		k = k + (compact and 1 or 2)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function renderTree(tbl)&lt;br /&gt;
	-- create 3 or 1 rows for every team&lt;br /&gt;
	local count = math.pow(2, rounds) * (compact and 1 or 3)&lt;br /&gt;
	local offsetcount = 2 * (compact and 1 or 3) + (compact and 2 or 3)&lt;br /&gt;
	local rows = {}&lt;br /&gt;
	offsetThird = getThirdOffset()&lt;br /&gt;
	for i = 1, count do&lt;br /&gt;
		rows[i] = addTableRow(tbl)&lt;br /&gt;
	end&lt;br /&gt;
	if showThird then&lt;br /&gt;
		for i = (count+1), (offsetcount + offsetThird) do&lt;br /&gt;
			rows[i] = addTableRow(tbl)&lt;br /&gt;
			if (rounds &amp;gt; 1) then&lt;br /&gt;
				local blank = addBlank(rows[i])&lt;br /&gt;
				blank:attr('colspan', tonumber(hideSeeds and '3' or '4') + sets[1])&lt;br /&gt;
				if compact and (rounds &amp;gt; 2) then&lt;br /&gt;
					blank = addBlank(rows[i])&lt;br /&gt;
					blank:attr('colspan', tonumber(hideSeeds and '3' or '4') + sets[1])&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if not compact then&lt;br /&gt;
		-- fill rows with groups&lt;br /&gt;
		for r = 1, rounds - 1 do&lt;br /&gt;
			renderGroups(rows, count, r)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- fill rows with bracket&lt;br /&gt;
	for r = 1, rounds do&lt;br /&gt;
		renderRound(rows, count, r)&lt;br /&gt;
	end&lt;br /&gt;
	if showThird then&lt;br /&gt;
		renderThird(rows, count, compact)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function renderHeadings(tbl)&lt;br /&gt;
	local titleRow = addTableRow((not hideHeadings) and tbl or mw.html.create('table'))&lt;br /&gt;
	local widthRow = addTableRow(tbl)&lt;br /&gt;
	for r = 1, (compactFinal and (rounds-1) or rounds) do&lt;br /&gt;
		addBlank(titleRow)&lt;br /&gt;
		addBlank(widthRow, r &amp;gt; 1 and '5px' or '1px')&lt;br /&gt;
		addHeading(titleRow, r, getRoundName(r) )&lt;br /&gt;
		local seedCell&lt;br /&gt;
		if (not hideSeeds) then&lt;br /&gt;
			seedCell = addBlank(widthRow, getWidth('seed', '25px'))&lt;br /&gt;
		end&lt;br /&gt;
		local teamCell = addBlank(widthRow, getWidth('team', '150px'))&lt;br /&gt;
		local scoreCells = {}&lt;br /&gt;
		for s = 1, sets[r] do&lt;br /&gt;
			scoreCells[s] = addBlank(widthRow, getWidth('score', '12px'))&lt;br /&gt;
		end&lt;br /&gt;
		addBlank(titleRow)&lt;br /&gt;
		addBlank(widthRow, r &amp;lt; rounds and '5px' or '1px')&lt;br /&gt;
&lt;br /&gt;
		if compact then&lt;br /&gt;
			teamCell:css('height', '7px')&lt;br /&gt;
		else&lt;br /&gt;
			if seedCell then&lt;br /&gt;
				seedCell:wikitext('&amp;amp;nbsp;')&lt;br /&gt;
			end&lt;br /&gt;
			teamCell:wikitext('&amp;amp;nbsp;')&lt;br /&gt;
			for s = 1, sets[r] do&lt;br /&gt;
				scoreCells[s]:wikitext('&amp;amp;nbsp;')&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.teamBracket(frame)&lt;br /&gt;
	parseArgs(frame)&lt;br /&gt;
	rounds = tonumber(args.rounds) or 2&lt;br /&gt;
	local teams = math.pow(2, rounds)&lt;br /&gt;
	compact = (args['compact'] and (args['compact'] == 'yes' or args['compact'] == 'y'))&lt;br /&gt;
	compactFinal = ((rounds &amp;gt; 4) and compact and args['compact-final'] and (args['compact-final'] == 'yes' or args['compact-final'] == 'y'))&lt;br /&gt;
	hideSeeds = (args['seeds'] and (args['seeds'] == 'no' or args['seeds'] == 'n'))&lt;br /&gt;
	showSeeds = (args['seeds'] and (args['seeds'] == 'yes' or args['seeds'] == 'y'))&lt;br /&gt;
	byes = (args['byes'] and (args['byes'] == 'yes' or args['byes'] == 'y') and 1) or (tonumber(args['byes'] or '0') or 0)&lt;br /&gt;
	hideHeadings = (args['headings'] and (args['headings'] == 'no' or args['headings'] == 'n'))&lt;br /&gt;
	showThird = isnotblank(args['3rd']) or isnotblank(args['3rd-team1']) or isnotblank(args['3rd-team2'])&lt;br /&gt;
	parseSeedmap(args['RD1-omit'])&lt;br /&gt;
	parseSets(args.sets)&lt;br /&gt;
&lt;br /&gt;
	-- create the table&lt;br /&gt;
	local tbl = mw.html.create('table')&lt;br /&gt;
		:css('border-style', 'none')&lt;br /&gt;
		:css('font-size', '90%')&lt;br /&gt;
		:css('margin', '1em 2em 1em 1em')&lt;br /&gt;
		:css('border-collapse', 'separate')&lt;br /&gt;
		:css('border-spacing', '0')&lt;br /&gt;
		:attr('cellpadding', '0')&lt;br /&gt;
&lt;br /&gt;
	if (args['nowrap'] and (args['nowrap'] == 'yes' or args['nowrap'] == 'y')) then&lt;br /&gt;
		tbl:css('white-space', 'nowrap')&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	renderHeadings(tbl)&lt;br /&gt;
	renderTree(tbl)&lt;br /&gt;
	return tostring(tbl) .. tcats&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Frietjes</name></author>
	</entry>
</feed>