<?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%3ASports_table</id>
	<title>Module:Sports table - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ASports_table"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Sports_table&amp;action=history"/>
	<updated>2026-06-13T17:54:00Z</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:Sports_table&amp;diff=479574&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:Sports_table&amp;diff=479574&amp;oldid=prev"/>
		<updated>2021-07-16T07:19:54Z</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;-- Module to build tables for standings in Sports&lt;br /&gt;
-- See documentation for details&lt;br /&gt;
&lt;br /&gt;
require('Module:No globals')&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Main function&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
	-- Declare locals&lt;br /&gt;
	local getArgs = require('Module:Arguments').getArgs&lt;br /&gt;
	local Args = getArgs(frame, {parentFirst = true})&lt;br /&gt;
	local ii_start, ii_end, N_rows_res = 0&lt;br /&gt;
	local text_field_result&lt;br /&gt;
	local notes_exist = false&lt;br /&gt;
	local t = {}&lt;br /&gt;
	local t_footer = {}&lt;br /&gt;
	local t_return = {}&lt;br /&gt;
	local team_list = {}&lt;br /&gt;
	local jj, jjj&lt;br /&gt;
	&lt;br /&gt;
	-- Exit early if we are using section transclusion for a different section&lt;br /&gt;
	if (Args['transcludesection'] and Args['section'])&lt;br /&gt;
		and Args['transcludesection'] ~= Args['section'] then&lt;br /&gt;
		return ''&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local templatestyles = frame:extensionTag{&lt;br /&gt;
		name = 'templatestyles', args = { src = 'Module:Sports table/styles.css' }&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	-- Edit links if requested&lt;br /&gt;
	local baselink = frame:getParent():getTitle()&lt;br /&gt;
	if mw.title.getCurrentTitle().text == baselink then	baselink = '' end&lt;br /&gt;
	local template_name = Args['template_name']&lt;br /&gt;
		or (baselink ~= '' and (':' .. baselink))&lt;br /&gt;
		or ''&lt;br /&gt;
&lt;br /&gt;
	-- Get the custom start point for the table (most will start by default at 1)&lt;br /&gt;
	local top_pos = tonumber(Args['highest_pos']) or 1&lt;br /&gt;
	-- Get the custom end point for the table (unrestricted if bottom_pos is &amp;lt; top_pos)&lt;br /&gt;
	local bottom_pos = tonumber(Args['lowest_pos']) or 0&lt;br /&gt;
	local N_teams = top_pos - 1 -- Default to 0 at start, but higher number needed to skip certain entries&lt;br /&gt;
	&lt;br /&gt;
	-- Load modules&lt;br /&gt;
	local yesno = require('Module:Yesno')&lt;br /&gt;
	-- Load style and (sub) modules&lt;br /&gt;
	local style_def = Args['style'] or 'WDL'&lt;br /&gt;
	-- Historically 'football' exists as style, this is now forwarded to WDL&lt;br /&gt;
	if style_def == 'football' then style_def = 'WDL' end&lt;br /&gt;
	local p_style = require('Module:Sports table/'..style_def)&lt;br /&gt;
	local p_sub = require('Module:Sports table/sub')&lt;br /&gt;
	&lt;br /&gt;
	-- Random value used for uniqueness&lt;br /&gt;
	math.randomseed( os.clock() * 10^8 )&lt;br /&gt;
	local rand_val = math.random()&lt;br /&gt;
	&lt;br /&gt;
	-- Declare colour scheme&lt;br /&gt;
	local result_col = {}&lt;br /&gt;
	result_col = {green1='#BBF3BB', green2='#CCF9CC', green3='#DDFCDD', green4='#EEFFEE',&lt;br /&gt;
		blue1='#BBF3FF', blue2='#CCF9FF', blue3='#DDFCFF', blue4='#EEFFFF',&lt;br /&gt;
		yellow1='#FFFFBB', yellow2='#FFFFCC', yellow3='#FFFFDD', yellow4='#FFFFEE',&lt;br /&gt;
		red1='#FFBBBB', red2='#FFCCCC', red3='#FFDDDD', red4='#FFEEEE',&lt;br /&gt;
		black1='#BBBBBB', black2='#CCCCCC', black3='#DDDDDD', black4='#EEEEEE',&lt;br /&gt;
		orange1='#FEDCBA', orange2='#FEEAD5',&lt;br /&gt;
		white1='inherit',['']='inherit'&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	-- Show all stats in table or just matches played and points&lt;br /&gt;
	local full_table = true&lt;br /&gt;
	local hide_results = yesno(Args['hide_results'] or 'no')&lt;br /&gt;
	local pld_pts_val = string.lower(Args['only_pld_pts'] or 'no')&lt;br /&gt;
	local show_class_rules = yesno(Args['show_class_rules'] or 'yes') and true or false&lt;br /&gt;
	-- True if par doesn't exist, false otherwise&lt;br /&gt;
	if yesno(pld_pts_val) then&lt;br /&gt;
		full_table = false&lt;br /&gt;
	elseif pld_pts_val=='no_hide_class_rules' then&lt;br /&gt;
		full_table = true&lt;br /&gt;
		show_class_rules = false&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Declare results column header&lt;br /&gt;
	local results_header = {}&lt;br /&gt;
	results_header = {Q='Qualification', QR='Qualification or relegation',&lt;br /&gt;
		P='Promotion', PQR='Promotion, qualification or relegation',&lt;br /&gt;
		PR='Promotion or relegation', PQ='Promotion or qualification', &lt;br /&gt;
		R='Relegation'}&lt;br /&gt;
	local results_defined = false -- Check whether this would be needed&lt;br /&gt;
	-- Possible prefix for result fields&lt;br /&gt;
	local respre = (Args['result_prefix'] or '') .. '_'&lt;br /&gt;
	respre = (respre == '_') and '' or respre&lt;br /&gt;
	-- Now define line for column header (either option or custom)&lt;br /&gt;
	local local_res_header = results_header[Args[respre..'res_col_header']] or Args[respre..'res_col_header']  or ''&lt;br /&gt;
	-- Check whether it includes a note&lt;br /&gt;
	local res_head_note = Args['note_header_res']&lt;br /&gt;
	local res_head_note_text = ''&lt;br /&gt;
	if full_table and res_head_note then&lt;br /&gt;
		notes_exist = true&lt;br /&gt;
		res_head_note_text = frame:expandTemplate{ title = 'efn', args = { group='lower-alpha',  res_head_note} }&lt;br /&gt;
	end&lt;br /&gt;
	local results_header_txt = '! scope=&amp;quot;col&amp;quot; |'..local_res_header..res_head_note_text..'\n'&lt;br /&gt;
	&lt;br /&gt;
	-- Get status option&lt;br /&gt;
	local t_status = p_style.status(Args)&lt;br /&gt;
	&lt;br /&gt;
	-- Alternative syntax for team list&lt;br /&gt;
	if Args['team_order'] and Args['team_order'] ~= '' then&lt;br /&gt;
		local team_order_offset = (tonumber(Args['team_order_start']) or 1) - 1&lt;br /&gt;
		local tlist = mw.text.split(Args['team_order'], '%s*[;,]%s*')&lt;br /&gt;
		for k, tname in ipairs(tlist) do&lt;br /&gt;
			if tname ~= '' then&lt;br /&gt;
				Args['team' .. (k + team_order_offset)] = tname&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Read in number of consecutive teams (ignore entries after skipping a spot)&lt;br /&gt;
	while Args['team'..N_teams+1] ~= nil and (bottom_pos &amp;lt; top_pos or N_teams &amp;lt; bottom_pos) do&lt;br /&gt;
		N_teams = N_teams+1&lt;br /&gt;
		-- Sneakily add it twice to the team_list parameter, once for the actual&lt;br /&gt;
		-- ranking, the second for position lookup in sub-tables&lt;br /&gt;
		-- This is possible because Lua allows both numbers and strings as indices.&lt;br /&gt;
		team_list[N_teams] = Args['team'..N_teams] -- i^th entry is team X&lt;br /&gt;
		team_list[Args['team'..N_teams]] = N_teams -- team X entry is position i&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Optional totals&lt;br /&gt;
	local total_row_name = 'SPORTS_TABLE_TOTAL'&lt;br /&gt;
	if yesno(Args['show_totals'] or 'no') then&lt;br /&gt;
		N_teams = N_teams+1&lt;br /&gt;
		Args['team' .. N_teams] = total_row_name&lt;br /&gt;
		Args['name_' .. total_row_name] = 'Total'&lt;br /&gt;
		Args['result' .. N_teams] = total_row_name&lt;br /&gt;
		Args['col_' .. total_row_name] = '#eee'&lt;br /&gt;
		team_list[N_teams] = Args['team' .. N_teams]&lt;br /&gt;
		team_list[Args['team'..N_teams]] = N_teams&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Show position&lt;br /&gt;
	local position_col = yesno(Args['show_positions'] or 'yes') and true or false&lt;br /&gt;
	&lt;br /&gt;
	-- Show groups or note&lt;br /&gt;
	local group_col = yesno(Args['show_groups'] or 'no') and true or false&lt;br /&gt;
&lt;br /&gt;
	-- Show match_table or not&lt;br /&gt;
	local match_table = yesno(Args['show_matches'] or 'no') and true or false&lt;br /&gt;
	local p_matches = match_table and &lt;br /&gt;
		(style_def == 'Chess' and require('Module:Sports results/'..style_def) or require('Module:Sports results'))&lt;br /&gt;
	&lt;br /&gt;
	-- Custom position column label or note&lt;br /&gt;
	local pos_label = Args['postitle'] or '&amp;lt;abbr title=&amp;quot;Position&amp;quot;&amp;gt;Pos&amp;lt;/abbr&amp;gt;'&lt;br /&gt;
	if position_col == false then pos_label = nil end&lt;br /&gt;
	&lt;br /&gt;
	-- Show status or not&lt;br /&gt;
	local show_status = yesno(Args['show_status'] or 'yes') and true or false&lt;br /&gt;
&lt;br /&gt;
	-- Get VTE button text (but only for non-empty text)&lt;br /&gt;
	local VTE_text = ''&lt;br /&gt;
	if (template_name ~= '') then&lt;br /&gt;
		VTE_text = require('Module:Navbar')._navbar({&lt;br /&gt;
			template_name,&lt;br /&gt;
			mini=1,&lt;br /&gt;
			style='float:right',&lt;br /&gt;
			brackets=1&lt;br /&gt;
		})&lt;br /&gt;
		&lt;br /&gt;
		-- remove the next part if https://en.wikipedia.org/w/index.php?oldid=832717047#Sortable_link_disables_navbar_links?&lt;br /&gt;
		-- is ever fixed&lt;br /&gt;
		if yesno(Args['sortable_table'] or 'no') then&lt;br /&gt;
			VTE_text = mw.ustring.gsub(VTE_text, '&amp;lt;%/?abbr[^&amp;lt;&amp;gt;]*&amp;gt;', ' ')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Add source to title if specified and possible&lt;br /&gt;
	local title_source = false&lt;br /&gt;
	if Args['title'] and Args['title_source'] then&lt;br /&gt;
		Args['title'] = Args['title'] .. Args['title_source']&lt;br /&gt;
		title_source = true&lt;br /&gt;
	elseif Args['table_header'] and Args['table_header_source'] then&lt;br /&gt;
		Args['table_header'] = Args['table_header'] .. Args['table_header_source']&lt;br /&gt;
		title_source = true&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Write column headers&lt;br /&gt;
	t_return = p_style.header(t,Args,p_sub,pos_label,group_col,VTE_text,full_table,results_header_txt)&lt;br /&gt;
	if match_table then&lt;br /&gt;
		-- Add empty column header&lt;br /&gt;
		t_return.count = t_return.count+1&lt;br /&gt;
		table.insert(t_return.tab_text,'! scope=&amp;quot;row&amp;quot; class=&amp;quot;unsortable&amp;quot; style=&amp;quot;background-color:white;border-top:white;border-bottom:white;line-width:3pt;&amp;quot;| \n')&lt;br /&gt;
		&lt;br /&gt;
		-- Add rest of header&lt;br /&gt;
		t_return = p_matches.header(t_return,Args,p_sub,N_teams,team_list,tonumber(Args['legs']) or 1)&lt;br /&gt;
	end&lt;br /&gt;
	t = t_return.tab_text&lt;br /&gt;
	local N_cols = t_return.count&lt;br /&gt;
	&lt;br /&gt;
	-- Determine what entries go into table&lt;br /&gt;
	-- Find out which team to show (if any)&lt;br /&gt;
	local ii_show = team_list[Args['showteam'] or nil] -- nil if non-existant&lt;br /&gt;
	-- Start and end positions to show&lt;br /&gt;
	local n_to_show = tonumber(Args['show_limit']) or N_teams&lt;br /&gt;
	-- Check for &amp;quot;legal value&amp;quot;, if not legal (or non declared), then show all&lt;br /&gt;
	local check_n = ((n_to_show&amp;gt;=(N_teams-top_pos+1)) or (n_to_show&amp;lt;=1) or (n_to_show~=math.floor(n_to_show)))&lt;br /&gt;
	-- Also check whether there is a valid ii_show&lt;br /&gt;
	if check_n or (not ii_show) then&lt;br /&gt;
		ii_start = top_pos&lt;br /&gt;
		ii_end = N_teams&lt;br /&gt;
	else&lt;br /&gt;
		-- It's a proper integer between top_pos+1 and N_teams-1&lt;br /&gt;
		-- If it is in the middle show the same number above and below&lt;br /&gt;
		-- If it is in the top or bottom, show the exact number&lt;br /&gt;
		-- How many to show on the side&lt;br /&gt;
		local n_show_side = math.floor(n_to_show/2)&lt;br /&gt;
		if (ii_show-top_pos+1)&amp;lt;=n_show_side then&lt;br /&gt;
			-- Top team&lt;br /&gt;
			ii_start = top_pos&lt;br /&gt;
			ii_end = top_pos+n_to_show-1&lt;br /&gt;
		elseif ii_show&amp;gt;=(N_teams+1-n_show_side) then&lt;br /&gt;
			-- Bottom team&lt;br /&gt;
			ii_start = N_teams+1-n_to_show&lt;br /&gt;
			ii_end = N_teams&lt;br /&gt;
		else&lt;br /&gt;
			-- Normal case&lt;br /&gt;
			ii_start = ii_show-n_show_side&lt;br /&gt;
			ii_end = ii_show+n_show_side&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- For results column&lt;br /&gt;
	local new_res_ii = ii_start&lt;br /&gt;
	-- Pre-check for existence of column&lt;br /&gt;
	if not hide_results then&lt;br /&gt;
		for ii = ii_start, ii_end do&lt;br /&gt;
			if Args[respre..'result'..ii] and Args[respre..'text_' .. Args[respre..'result'..ii]] then results_defined = true end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- Remove results header if it is unused&lt;br /&gt;
	if full_table and not results_defined then&lt;br /&gt;
		-- First get it as one string, then use string replace to replace that header by empty string&lt;br /&gt;
		local t_str = tostring(table.concat(t))&lt;br /&gt;
		t_str = mw.ustring.gsub( t_str, results_header_txt, '' )&lt;br /&gt;
		N_cols = N_cols-1 -- There is actually one column less&lt;br /&gt;
		t = {}&lt;br /&gt;
		table.insert(t, t_str)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Write rows&lt;br /&gt;
	local team_name, team_code_ii, team_code_jj, pos_num, group_txt, note_local&lt;br /&gt;
	local note_string, note_local, note_local_num, note_id&lt;br /&gt;
	local note_id_list = {}&lt;br /&gt;
	local hth_id_list = {}&lt;br /&gt;
	for ii = ii_start, ii_end do&lt;br /&gt;
		-- First get code&lt;br /&gt;
		team_code_ii = team_list[ii]&lt;br /&gt;
		-- Now read values&lt;br /&gt;
		pos_num = Args['pos_'..team_code_ii]			or ii&lt;br /&gt;
		group_txt = Args['group_'..team_code_ii]		or ' '&lt;br /&gt;
		team_name = Args['name_'..team_code_ii]		 	or team_code_ii&lt;br /&gt;
		note_local = Args['note_'..team_code_ii] 		or nil&lt;br /&gt;
		&lt;br /&gt;
		-- Does it need a promotion/qualification/relegation tag&lt;br /&gt;
		local result_local = Args[respre..'result'..ii] or nil&lt;br /&gt;
		local bg_col = nil&lt;br /&gt;
		-- Get local background colour&lt;br /&gt;
		if result_local then&lt;br /&gt;
			bg_col = result_col[Args[respre..'col_'..result_local]] or Args[respre..'col_'..result_local] or 'inherit'&lt;br /&gt;
			bg_col = 'background-color:'..bg_col..';' 	-- Full style tag&lt;br /&gt;
		end&lt;br /&gt;
		if not bg_col then bg_col = 'background-color:transparent;' end -- Becomes default if undefined&lt;br /&gt;
		&lt;br /&gt;
		-- Bold this line or not&lt;br /&gt;
		local ii_fw = ii == ii_show and 'font-weight: bold;' or 'font-weight: normal;'&lt;br /&gt;
		if yesno(Args['show_totals'] or 'no') and team_code_ii == total_row_name then&lt;br /&gt;
			ii_fw = 'font-weight: bold;'&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- Check whether there is a note or not, if so get text ready for it&lt;br /&gt;
		if note_local and full_table then&lt;br /&gt;
			-- Set global check for notes to true&lt;br /&gt;
			notes_exist = true&lt;br /&gt;
			-- There are now 3 options for notes&lt;br /&gt;
			-- 1) It is a full note&lt;br /&gt;
			-- 2) It is a referal to another note (i.e. it's just a team code; e.g. note_AAA=Text, note_BBB=AAA) in which the note for BBB should link to the same footnote as AAA, with&lt;br /&gt;
			-- 2a) The other linked note exist in the part of the table shown&lt;br /&gt;
			-- 2b) The part of the note does not exist in the part of the table shown&lt;br /&gt;
			if not Args['note_'..note_local] then&lt;br /&gt;
				-- Option 1&lt;br /&gt;
				-- Now define the identifier for this&lt;br /&gt;
				note_id = '&amp;quot;table_note_'..team_code_ii..rand_val..'&amp;quot;' -- Add random end for unique ID if more tables are present on article (which might otherwise share an ID)&lt;br /&gt;
				note_id_list[team_code_ii] = note_id&lt;br /&gt;
				&lt;br /&gt;
				-- Call refn template&lt;br /&gt;
				note_string = frame:expandTemplate{ title = 'efn', args = { group='lower-alpha',  name=note_id, note_local} }&lt;br /&gt;
			else &lt;br /&gt;
				-- Option 2&lt;br /&gt;
				-- It is option 2a in either one if either the main note is inside the sub-table&lt;br /&gt;
				--                                  or another ref to that note is inside the sub-table&lt;br /&gt;
				-- Basically when it either has been defined, or the main link will be in the table&lt;br /&gt;
				note_local_num = team_list[note_local]&lt;br /&gt;
				if note_id_list[note_local] or ((note_local_num &amp;gt;= ii_start) and (note_local_num &amp;lt;= ii_end)) then&lt;br /&gt;
					-- Option 2a&lt;br /&gt;
					note_id = '&amp;quot;table_note_'..note_local..rand_val..'&amp;quot;'&lt;br /&gt;
					note_string = frame:extensionTag{ name = 'ref', args = { group = 'lower-alpha', name = note_id} }&lt;br /&gt;
				else&lt;br /&gt;
					-- Option 2b&lt;br /&gt;
					-- Now define the identifier for this&lt;br /&gt;
					note_id = '&amp;quot;table_note_'..note_local..rand_val..'&amp;quot;' -- Add random end for unique ID&lt;br /&gt;
					note_id_list[note_local] = note_id&lt;br /&gt;
					&lt;br /&gt;
					-- Call refn template&lt;br /&gt;
					note_string = frame:expandTemplate{ title = 'efn', args = { group='lower-alpha',  name=note_id, Args['note_'..note_local]} }&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			note_string = '';&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- Insert status when needed&lt;br /&gt;
		local status_string = ''&lt;br /&gt;
		local status_local = show_status and Args[respre .. 'status_'..team_code_ii] or nil&lt;br /&gt;
		local status_let_first = true&lt;br /&gt;
		local curr_letter&lt;br /&gt;
		-- Only if it is defined&lt;br /&gt;
		if status_local then&lt;br /&gt;
			-- Take it letter by letter&lt;br /&gt;
			for jjj = 1,mw.ustring.len(status_local) do&lt;br /&gt;
				curr_letter = mw.ustring.upper(mw.ustring.sub(status_local,jjj,jjj))&lt;br /&gt;
				-- See whether it exist&lt;br /&gt;
				if t_status.code[curr_letter] then&lt;br /&gt;
					-- Depending on whether it is the first letter of not&lt;br /&gt;
					if status_let_first then&lt;br /&gt;
						status_string = curr_letter&lt;br /&gt;
						t_status.called[curr_letter] = true&lt;br /&gt;
						status_let_first = false&lt;br /&gt;
					else&lt;br /&gt;
						status_string = status_string..', '..curr_letter&lt;br /&gt;
						t_status.called[curr_letter] = true&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			-- Only add brackets/dash and bolding if it exist&lt;br /&gt;
			if not status_let_first then &lt;br /&gt;
				if t_status.position == 'before' then&lt;br /&gt;
					status_string = '&amp;lt;span style=&amp;quot;font-weight:bold&amp;quot;&amp;gt;'..string.lower(status_string)..' &amp;amp;ndash;&amp;lt;/span&amp;gt; ' &lt;br /&gt;
				else&lt;br /&gt;
					status_string = ' &amp;lt;span style=&amp;quot;font-weight:bold&amp;quot;&amp;gt;('..status_string..')&amp;lt;/span&amp;gt;' &lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- Now build the rows&lt;br /&gt;
		if yesno(Args['show_totals'] or 'no') and team_code_ii == total_row_name then&lt;br /&gt;
			table.insert(t,'|- class=&amp;quot;sortbottom&amp;quot;\n')											-- New row&lt;br /&gt;
		else&lt;br /&gt;
			table.insert(t,'|- \n')																-- New row&lt;br /&gt;
		end&lt;br /&gt;
		if position_col then&lt;br /&gt;
			table.insert(t,'| style=&amp;quot;text-align: center;'..ii_fw..bg_col..'&amp;quot;| '..pos_num..'\n')	-- Position number&lt;br /&gt;
		end&lt;br /&gt;
		if full_table and group_col then&lt;br /&gt;
			table.insert(t,'| style=&amp;quot;'..ii_fw..bg_col..'&amp;quot; |'..group_txt..'\n') 							-- Group number/name&lt;br /&gt;
		end&lt;br /&gt;
		-- Build the team string order based on status position&lt;br /&gt;
		local team_string&lt;br /&gt;
		if t_status.position == 'before' then&lt;br /&gt;
			team_string = status_string..team_name..note_string&lt;br /&gt;
		else&lt;br /&gt;
			team_string = team_name..note_string..status_string&lt;br /&gt;
		end&lt;br /&gt;
		table.insert(t,'! scope=&amp;quot;row&amp;quot; style=&amp;quot;text-align: left; white-space:nowrap;'..ii_fw..bg_col..'&amp;quot;| '..team_string..'\n')-- Team (with possible note)&lt;br /&gt;
		-- Call to subfunction&lt;br /&gt;
		t_return = p_style.row(frame,t,Args,p_sub,notes_exist,hth_id_list,full_table,rand_val,team_list,team_code_ii,ii_start,ii_end,ii_fw,bg_col,N_teams,ii,ii_show)&lt;br /&gt;
		t = t_return.t&lt;br /&gt;
		notes_exist = t_return.notes_exist&lt;br /&gt;
		hth_id_list = t_return.hth_id_list&lt;br /&gt;
		&lt;br /&gt;
		-- Now check what needs to be added inside the results column&lt;br /&gt;
		if full_table then&lt;br /&gt;
			local res_jjj&lt;br /&gt;
			if ii == new_res_ii then&lt;br /&gt;
				-- First check how many rows you need for this&lt;br /&gt;
				N_rows_res = 1&lt;br /&gt;
				jjj = ii+1&lt;br /&gt;
				result_local = Args[respre..'result'..ii] or ''&lt;br /&gt;
				local cont_loop = true&lt;br /&gt;
				while (jjj&amp;lt;=ii_end) and cont_loop do&lt;br /&gt;
					if Args['split'..tostring(jjj-1)] then&lt;br /&gt;
						cont_loop = false&lt;br /&gt;
						new_res_ii = jjj&lt;br /&gt;
					else&lt;br /&gt;
						res_jjj = Args[respre..'result'..jjj] or ''&lt;br /&gt;
						if result_local == res_jjj then &lt;br /&gt;
							N_rows_res = N_rows_res+1 &lt;br /&gt;
						else&lt;br /&gt;
							cont_loop = false&lt;br /&gt;
							new_res_ii = jjj&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
					jjj = jjj+1&lt;br /&gt;
				end&lt;br /&gt;
				-- Now create this field (reuse ii_fw and bg_col)&lt;br /&gt;
				-- Bold (if in range) or not&lt;br /&gt;
				if ii_show and (ii_show&amp;gt;=ii) and (ii_show&amp;lt;=(ii+N_rows_res-1)) then&lt;br /&gt;
					ii_fw = 'font-weight: bold;'&lt;br /&gt;
				else&lt;br /&gt;
					ii_fw = 'font-weight: normal;'&lt;br /&gt;
				end&lt;br /&gt;
				-- Get background colour&lt;br /&gt;
				bg_col = nil&lt;br /&gt;
				if Args[respre..'result'..ii] then&lt;br /&gt;
					bg_col = result_col[Args[respre..'col_'..result_local]] or Args[respre..'col_'..result_local] or 'inherit'&lt;br /&gt;
					bg_col = 'background-color:'..bg_col..';' 	-- Full style tag&lt;br /&gt;
				end&lt;br /&gt;
				if not bg_col then bg_col = 'background-color:transparent;' end -- Becomes default if undefined&lt;br /&gt;
				-- Check for notes&lt;br /&gt;
				local note_res_string, note_ref, note_text = '', '', ''&lt;br /&gt;
				if Args['note_res_'..result_local] then&lt;br /&gt;
					notes_exist = true&lt;br /&gt;
					local note_res_local = Args['note_res_'..result_local]&lt;br /&gt;
					&lt;br /&gt;
					-- Split the note_res_local into a table if all the entries are valid&lt;br /&gt;
					local multiref = 1&lt;br /&gt;
					local note_res_local_table = mw.text.split(note_res_local, '%s*,%s*')&lt;br /&gt;
					if (#note_res_local_table &amp;gt; 1) then&lt;br /&gt;
						for k, note_res_loc in ipairs(note_res_local_table) do&lt;br /&gt;
							multiref = multiref * (Args['note_res_' .. note_res_loc] and 1 or 0)&lt;br /&gt;
						end&lt;br /&gt;
					else&lt;br /&gt;
						multiref = 0&lt;br /&gt;
					end&lt;br /&gt;
&lt;br /&gt;
					-- Split failed, so make a single entry table with hth_local inside&lt;br /&gt;
					if multiref &amp;lt; 1 then&lt;br /&gt;
						note_res_local_table = { note_res_local }&lt;br /&gt;
					end&lt;br /&gt;
&lt;br /&gt;
					for k,note_res_local in ipairs(note_res_local_table) do&lt;br /&gt;
						if not Args['note_res_'..note_res_local] then&lt;br /&gt;
							-- It does not point to another result note&lt;br /&gt;
							note_ref = respre..'res_'..result_local&lt;br /&gt;
							note_id = '&amp;quot;table_note_res_'..result_local..rand_val..'&amp;quot;' -- Identifier&lt;br /&gt;
							note_text = note_res_local&lt;br /&gt;
						else&lt;br /&gt;
							-- It does point to another result note&lt;br /&gt;
							note_ref = respre..'res_'..note_res_local&lt;br /&gt;
							note_id = '&amp;quot;table_note_res_'..note_res_local..rand_val..'&amp;quot;' -- Identifier&lt;br /&gt;
							note_text = Args['note_res_'..note_res_local]&lt;br /&gt;
						end&lt;br /&gt;
						-- Check whether it is already printed&lt;br /&gt;
						if not note_id_list[note_ref] then&lt;br /&gt;
							-- Print it&lt;br /&gt;
							note_id_list[note_ref] = note_id&lt;br /&gt;
							note_res_string = note_res_string .. frame:expandTemplate{ title = 'efn', args = { group='lower-alpha',  name=note_id, note_text} }&lt;br /&gt;
						else&lt;br /&gt;
							-- Refer to it&lt;br /&gt;
							note_res_string = note_res_string .. frame:extensionTag{ name = 'ref', args = { group = 'lower-alpha', name = note_id} }&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				-- Get text&lt;br /&gt;
				local text_result = Args[respre..'text_'..result_local] or ''&lt;br /&gt;
				if text_result:match('fbmulticomp') then&lt;br /&gt;
					ii_fw = 'padding:0;' .. ii_fw&lt;br /&gt;
					if text_result:match('fbmulticompefn') then&lt;br /&gt;
						notes_exist = true&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				text_field_result = '| style=&amp;quot;'..ii_fw..bg_col..'&amp;quot; rowspan=&amp;quot;'..tostring(N_rows_res)..'&amp;quot; |'..text_result..note_res_string..'\n'&lt;br /&gt;
				-- See whether it is needed (only when blank for all entries)&lt;br /&gt;
				if results_defined then table.insert(t,text_field_result) end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		-- Insert match row if needed&lt;br /&gt;
		if match_table then&lt;br /&gt;
			local legs = tonumber(Args['legs']) or 1&lt;br /&gt;
			-- Add empty cell&lt;br /&gt;
			table.insert(t,'| style=&amp;quot;background-color:white;border-top:white;border-bottom:white;&amp;quot;| \n')&lt;br /&gt;
			&lt;br /&gt;
			-- Now include note to match results if needed &lt;br /&gt;
			for jj=top_pos,N_teams do&lt;br /&gt;
				team_code_jj = team_list[jj]&lt;br /&gt;
				if ii == jj then&lt;br /&gt;
					-- Nothing&lt;br /&gt;
				else&lt;br /&gt;
					for l=1,legs do&lt;br /&gt;
						local m = (legs == 1) and 'match_' or 'match' .. l .. '_'&lt;br /&gt;
						local match_note = Args[m..team_code_ii..'_'..team_code_jj..'_note']&lt;br /&gt;
						if match_note then&lt;br /&gt;
							notes_exist = true&lt;br /&gt;
							-- Only when it exist&lt;br /&gt;
							-- First check for existence of reference for note&lt;br /&gt;
							if not (Args['note_'..match_note] or Args[m..match_note..'_note']) then&lt;br /&gt;
								-- It's the entry&lt;br /&gt;
								note_id = '&amp;quot;table_note_'..team_code_ii..'_'..team_code_jj..rand_val..'&amp;quot;' -- Add random end for unique ID if more tables are present on article (which might otherwise share an ID)&lt;br /&gt;
								note_id_list[team_code_ii..'_'..team_code_jj] = note_id&lt;br /&gt;
								&lt;br /&gt;
								note_string = frame:expandTemplate{ title = 'efn', args = { group='lower-alpha', name=note_id,  match_note} }&lt;br /&gt;
							else &lt;br /&gt;
								-- Check for existence elsewhere&lt;br /&gt;
								note_local_num = team_list[match_note] or ii_end + 1&lt;br /&gt;
								if note_id_list[match_note] or ((note_local_num &amp;gt;= ii_start) and (note_local_num &amp;lt;= ii_end)) then&lt;br /&gt;
									-- It exists&lt;br /&gt;
									note_id = '&amp;quot;table_note_'..match_note..rand_val..'&amp;quot;' -- Identifier&lt;br /&gt;
									note_string = frame:extensionTag{ name = 'ref', args = { group = 'lower-alpha', name = note_id} }&lt;br /&gt;
								else&lt;br /&gt;
									-- Now define the identifier for this&lt;br /&gt;
									note_id = '&amp;quot;table_note_'..match_note..rand_val..'&amp;quot;' -- Add random end for unique ID&lt;br /&gt;
									note_id_list[match_note] = note_id&lt;br /&gt;
									-- Call refn template&lt;br /&gt;
									note_string = frame:expandTemplate{ title = 'efn', args = { group='lower-alpha', name=note_id, Args['note_'..match_note]} }&lt;br /&gt;
								end&lt;br /&gt;
							end&lt;br /&gt;
&lt;br /&gt;
							-- Now append this to the match result string&lt;br /&gt;
							Args[m..team_code_ii..'_'..team_code_jj] = (Args[m..team_code_ii..'_'..team_code_jj] or '')..note_string&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			-- Add rest of match row&lt;br /&gt;
			t = p_matches.row(t,Args,N_teams,team_list,ii,ii_show,legs)&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		-- Now, if needed, insert a split (solid line to indicate split in standings, but only when it is not at the last shown position)&lt;br /&gt;
		if Args['split'..ii] and (ii&amp;lt;ii_end) then&lt;br /&gt;
			-- Base size on N_cols (it needs 2*N_cols |)&lt;br /&gt;
			table.insert(t,'|- style=&amp;quot;background-color:'..result_col['black1']..'; line-height:3pt;&amp;quot;\n')&lt;br /&gt;
			table.insert(t,string.rep('|',2*N_cols)..'\n')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Close table&lt;br /&gt;
	table.insert(t, '|}')&lt;br /&gt;
	&lt;br /&gt;
	-- Get info for footer&lt;br /&gt;
	local update = Args['update']			or 'unknown'&lt;br /&gt;
	local start_date = Args['start_date'] 	or 'unknown'&lt;br /&gt;
	local source = Args['source']			or (title_source == true and '')&lt;br /&gt;
		or frame:expandTemplate{ title = 'citation needed', args = { reason='No source parameter defined', date=os.date('%B %Y') } }&lt;br /&gt;
	local class_rules = Args['class_rules']	or nil&lt;br /&gt;
	&lt;br /&gt;
	-- Create footer text&lt;br /&gt;
	-- Date updating&lt;br /&gt;
	local matches_text = Args['matches_text'] or 'match(es)'&lt;br /&gt;
	if string.lower(update)=='complete' then&lt;br /&gt;
		-- Do nothing&lt;br /&gt;
	elseif update=='' then&lt;br /&gt;
		-- Empty parameter&lt;br /&gt;
		table.insert(t_footer,'Updated to '..matches_text..' played on unknown. ')&lt;br /&gt;
	elseif string.lower(update)=='future' then&lt;br /&gt;
		-- Future start date&lt;br /&gt;
		table.insert(t_footer,'First '..matches_text..' will be played on '..start_date..'. ')&lt;br /&gt;
	else&lt;br /&gt;
		table.insert(t_footer,'Updated to '..matches_text..' played on '..update..'. ')&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Stack footer or not&lt;br /&gt;
	local footer_break = yesno(Args['stack_footer'] or 'no') and true or false&lt;br /&gt;
	&lt;br /&gt;
	-- Variable for linebreak&lt;br /&gt;
	local stack_string = '&amp;lt;br&amp;gt;'&lt;br /&gt;
	&lt;br /&gt;
	if footer_break and (not (string.lower(update)=='complete')) then table.insert(t_footer,stack_string) end&lt;br /&gt;
	&lt;br /&gt;
	if source ~= '' then&lt;br /&gt;
		table.insert(t_footer,'Source: '..source)&lt;br /&gt;
	end&lt;br /&gt;
	if class_rules and full_table and show_class_rules then&lt;br /&gt;
		if (#t_footer &amp;gt; 0) then table.insert(t_footer,'&amp;lt;br&amp;gt;') end&lt;br /&gt;
		table.insert(t_footer,'Rules for classification: '..class_rules)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Now for the named status&lt;br /&gt;
	local status_exist = false&lt;br /&gt;
	local status_string = ''&lt;br /&gt;
	local curr_letter&lt;br /&gt;
	for jjj = 1,mw.ustring.len(t_status.letters) do&lt;br /&gt;
		curr_letter = mw.ustring.upper(mw.ustring.sub(t_status.letters,jjj,jjj))&lt;br /&gt;
		if t_status.called[curr_letter] then&lt;br /&gt;
			if (footer_break and status_exist) then&lt;br /&gt;
				status_string = status_string..stack_string&lt;br /&gt;
			end&lt;br /&gt;
			if t_status.position == 'before' then&lt;br /&gt;
				status_string = status_string..'&amp;lt;span style=&amp;quot;font-weight:bold&amp;quot;&amp;gt;'..string.lower(curr_letter)..' &amp;amp;ndash;&amp;lt;/span&amp;gt; '..t_status.code[curr_letter]..'; '&lt;br /&gt;
			else&lt;br /&gt;
				status_string = status_string..'&amp;lt;span style=&amp;quot;font-weight:bold&amp;quot;&amp;gt;('..curr_letter..')&amp;lt;/span&amp;gt; '..t_status.code[curr_letter]..'; '&lt;br /&gt;
			end&lt;br /&gt;
			status_exist = true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- Now if it contains entries the '; ' needs to be removed&lt;br /&gt;
	if status_exist then&lt;br /&gt;
		if (#t_footer &amp;gt; 0) then table.insert(t_footer,'&amp;lt;br&amp;gt;') end&lt;br /&gt;
		status_string = mw.ustring.sub(status_string,1,mw.ustring.len(status_string)-2)&lt;br /&gt;
		table.insert(t_footer,status_string)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Add notes (if applicable)&lt;br /&gt;
	if notes_exist then&lt;br /&gt;
		if (#t_footer &amp;gt; 0) then table.insert(t_footer,'&amp;lt;br&amp;gt;') end&lt;br /&gt;
		table.insert(t_footer,'Notes:')&lt;br /&gt;
		-- As reflist size text&lt;br /&gt;
		t_footer = '&amp;lt;div class=&amp;quot;sports-table-notes&amp;quot;&amp;gt;'..table.concat(t_footer)..'&amp;lt;/div&amp;gt;'&lt;br /&gt;
		t_footer = t_footer..frame:expandTemplate{ title = 'notelist', args = { group='lower-alpha'} }&lt;br /&gt;
	else&lt;br /&gt;
		-- As reflist size text&lt;br /&gt;
		t_footer = '&amp;lt;div class=&amp;quot;sports-table-notes&amp;quot;&amp;gt;'..table.concat(t_footer)..'&amp;lt;/div&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Add footer to main text table&lt;br /&gt;
	table.insert(t,t_footer)&lt;br /&gt;
	&lt;br /&gt;
	-- Rewrite anchor links&lt;br /&gt;
	for k=1,#t do&lt;br /&gt;
		if t[k]:match('%[%[#[^%[%]]*%|') then&lt;br /&gt;
			t[k] = mw.ustring.gsub(t[k], '(%[%[)(#[^%[%]]*%|)', '%1' .. baselink .. '%2')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Generate tracking&lt;br /&gt;
	if not Args['notracking'] then&lt;br /&gt;
		local getTracking = require('Module:Sports table/argcheck').check&lt;br /&gt;
		local warning_categories, tracking_categories = getTracking(Args, frame:getParent().args)&lt;br /&gt;
		if #warning_categories &amp;gt; 0 then&lt;br /&gt;
			if frame:preprocess( &amp;quot;{{REVISIONID}}&amp;quot; ) == &amp;quot;&amp;quot; then&lt;br /&gt;
				for k=1,#warning_categories do&lt;br /&gt;
					warning_categories[k] = mw.ustring.gsub(warning_categories[k], '^%[%[Category:Pages using sports table with (.*)|(.*)%]%]$', '&amp;lt;div style=&amp;quot;color:red&amp;quot;&amp;gt;Warning: %1 = %2&amp;lt;/div&amp;gt;')&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		for k=1,#warning_categories do&lt;br /&gt;
				table.insert(t, warning_categories[k])&lt;br /&gt;
		end&lt;br /&gt;
		for k=1,#tracking_categories do&lt;br /&gt;
				table.insert(t, tracking_categories[k])&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if(Args['showteam'] == nil) then&lt;br /&gt;
			local getWarnings = require('Module:Sports table/totalscheck').check&lt;br /&gt;
			local total_warnings = getWarnings(Args, team_list, ii_start, ii_end)&lt;br /&gt;
			if #total_warnings &amp;gt; 0 then&lt;br /&gt;
				if frame:preprocess( &amp;quot;{{REVISIONID}}&amp;quot; ) == &amp;quot;&amp;quot; then&lt;br /&gt;
					for k=1,#total_warnings do&lt;br /&gt;
						table.insert(t, '&amp;lt;div style=&amp;quot;color:green&amp;quot;&amp;gt;Possible problem: ' .. total_warnings[k] .. '&amp;lt;/div&amp;gt;')&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		table.insert(t, '[[Category:Pages using sports table with notracking]]')&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if Args['float'] then&lt;br /&gt;
		return frame:expandTemplate{ title = 'stack begin', args = {clear = 'true', margin = '1', float = Args['float']} }&lt;br /&gt;
			.. templatestyles .. '\n' .. table.concat(t) .. frame:expandTemplate{ title = 'stack end'}&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return templatestyles .. '\n' .. table.concat(t)&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>