<?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%2FWL_goal_points</id>
	<title>Module:Sports table/WL goal points - 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%2FWL_goal_points"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:Sports_table/WL_goal_points&amp;action=history"/>
	<updated>2026-06-14T12:43:35Z</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/WL_goal_points&amp;diff=479603&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/WL_goal_points&amp;diff=479603&amp;oldid=prev"/>
		<updated>2021-07-16T07:21:33Z</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;-- Style for football tables&lt;br /&gt;
local pp = {}&lt;br /&gt;
 &lt;br /&gt;
function pp.header(t,Args,p_sub,pos_label,group_col,VTE_text,full_table,results_header_txt)&lt;br /&gt;
	-- Load relevant modules&lt;br /&gt;
	local yesno = require('Module:Yesno')&lt;br /&gt;
	&lt;br /&gt;
	-- Create table header&lt;br /&gt;
	-- Pre stuff&lt;br /&gt;
	local team_width = Args['teamwidth'] or '190'&lt;br /&gt;
	local sort_text = ''&lt;br /&gt;
	local sort_table_val = Args['sortable_table'] 	or 'no'&lt;br /&gt;
	if yesno(sort_table_val) then sort_text = 'sortable' end&lt;br /&gt;
	local show_played = true&lt;br /&gt;
	local hide_played_val = Args['hide_played'] 	or 'no'&lt;br /&gt;
	if yesno(hide_played_val) then show_played = false end&lt;br /&gt;
	&lt;br /&gt;
	table.insert(t,'{|class=&amp;quot;wikitable '..sort_text..'&amp;quot; style=&amp;quot;text-align:center;&amp;quot;\n')            			-- Open table&lt;br /&gt;
	&lt;br /&gt;
	-- Custom header options&lt;br /&gt;
	local group_head_text = Args['group_header'] or '&amp;lt;abbr title=&amp;quot;Group&amp;quot;&amp;gt;Grp&amp;lt;/abbr&amp;gt;'&lt;br /&gt;
	&lt;br /&gt;
	-- What to rank the teams by&lt;br /&gt;
	local ranking_style = Args['ranking_style'] or 'pts'&lt;br /&gt;
	local show_points, show_perc = false&lt;br /&gt;
	ranking_style = string.lower(ranking_style)&lt;br /&gt;
	if ranking_style=='w' or ranking_style=='win' or ranking_style=='wins' then&lt;br /&gt;
		-- Based on wins&lt;br /&gt;
	elseif ranking_style=='perc' or ranking_style=='percentage' or ranking_style=='%' then&lt;br /&gt;
		-- Based on percentage&lt;br /&gt;
		show_perc = true&lt;br /&gt;
	else&lt;br /&gt;
		-- Based on points&lt;br /&gt;
		show_points = true&lt;br /&gt;
	end&lt;br /&gt;
	-- Use points or frames instead of goals for/against&lt;br /&gt;
	local for_against_style = Args['for_against_style'] 	or 'goals'&lt;br /&gt;
	local fa_letter, fa_word_sing, fa_word_plur&lt;br /&gt;
	local hide_for_against = false&lt;br /&gt;
	for_against_style = string.lower(for_against_style)&lt;br /&gt;
	if for_against_style=='g' or for_against_style=='goal' or for_against_style=='goals' then&lt;br /&gt;
		fa_letter = 'G'&lt;br /&gt;
		fa_word_sing = 'Goal'&lt;br /&gt;
		fa_word_plur = 'Goals'&lt;br /&gt;
	elseif for_against_style=='f' or for_against_style=='frame' or for_against_style=='frames' then&lt;br /&gt;
		fa_letter = 'F'&lt;br /&gt;
		fa_word_sing = 'Frame'&lt;br /&gt;
		fa_word_plur = 'Frames'&lt;br /&gt;
	elseif for_against_style=='game' or for_against_style=='games' then&lt;br /&gt;
		fa_letter = 'G'&lt;br /&gt;
		fa_word_sing = 'Game'&lt;br /&gt;
		fa_word_plur = 'Games'&lt;br /&gt;
	elseif for_against_style=='p' or for_against_style=='point' or for_against_style=='points' then&lt;br /&gt;
		fa_letter = 'P'&lt;br /&gt;
		fa_word_sing = 'Point'&lt;br /&gt;
		fa_word_plur = 'Points'&lt;br /&gt;
	elseif for_against_style=='none' then&lt;br /&gt;
		hide_for_against = true&lt;br /&gt;
	else&lt;br /&gt;
		fa_letter = 'G'&lt;br /&gt;
		fa_word_sing = 'Goal'&lt;br /&gt;
		fa_word_plur = 'Goals'&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Whether to use goal ratio (goal average) instead&lt;br /&gt;
	local use_ratio_val = Args['use_goal_ratio'] 	or 'no'&lt;br /&gt;
	local do_ratio = false&lt;br /&gt;
	if yesno(use_ratio_val) then do_ratio = true end&lt;br /&gt;
	-- Use games behind header&lt;br /&gt;
	local show_GB = Args['show_GB'] 	or 'no'&lt;br /&gt;
	local do_GB = false&lt;br /&gt;
	if yesno(show_GB) then do_GB = true end&lt;br /&gt;
	&lt;br /&gt;
	-- Initialize&lt;br /&gt;
	local tt = {}&lt;br /&gt;
	tt.count = 0 		-- Up by one after every call&lt;br /&gt;
	tt.tab_text = t		-- Actual text&lt;br /&gt;
	-- Actual headers&lt;br /&gt;
	tt = p_sub.colhead(tt,28,pos_label)											-- Position col&lt;br /&gt;
	-- Add group header&lt;br /&gt;
	if full_table and group_col then&lt;br /&gt;
		tt = p_sub.colhead(tt,28,group_head_text)								-- Group col&lt;br /&gt;
	end&lt;br /&gt;
	tt = p_sub.colhead(tt,team_width,'Team'..VTE_text)							-- Team col&lt;br /&gt;
	if show_played then&lt;br /&gt;
		tt = p_sub.colhead(tt,28,'&amp;lt;abbr title=&amp;quot;Played&amp;quot;&amp;gt;Pld&amp;lt;/abbr&amp;gt;')				-- Matches played col&lt;br /&gt;
	end&lt;br /&gt;
	if full_table then&lt;br /&gt;
		tt = p_sub.colhead(tt,28,'&amp;lt;abbr title=&amp;quot;Won&amp;quot;&amp;gt;W&amp;lt;/abbr&amp;gt;')					-- Win col&lt;br /&gt;
		tt = p_sub.colhead(tt,28,'&amp;lt;abbr title=&amp;quot;Lost&amp;quot;&amp;gt;L&amp;lt;/abbr&amp;gt;')					-- Loss col&lt;br /&gt;
		if not hide_for_against then&lt;br /&gt;
			tt = p_sub.colhead(tt,28,'&amp;lt;abbr title=&amp;quot;'..fa_word_plur..' for&amp;quot;&amp;gt;'..fa_letter..'F&amp;lt;/abbr&amp;gt;')		-- For col&lt;br /&gt;
			tt = p_sub.colhead(tt,28,'&amp;lt;abbr title=&amp;quot;'..fa_word_plur..' against&amp;quot;&amp;gt;'..fa_letter..'A&amp;lt;/abbr&amp;gt;')	-- Against col&lt;br /&gt;
			if not do_ratio then&lt;br /&gt;
				tt = p_sub.colhead(tt,28,'&amp;lt;abbr title=&amp;quot;'..fa_word_sing..' difference&amp;quot;&amp;gt;'..fa_letter..'D&amp;lt;/abbr&amp;gt;')	-- Difference col&lt;br /&gt;
			else&lt;br /&gt;
				tt = p_sub.colhead(tt,36,'&amp;lt;abbr title=&amp;quot;'..fa_word_sing..' ratio&amp;quot;&amp;gt;'..fa_letter..'R&amp;lt;/abbr&amp;gt;')	-- Ratio col&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if show_points then&lt;br /&gt;
		tt = p_sub.colhead(tt,28,'&amp;lt;abbr title=&amp;quot;Points&amp;quot;&amp;gt;Pts&amp;lt;/abbr&amp;gt;')					-- Points col&lt;br /&gt;
	elseif show_perc then&lt;br /&gt;
		tt = p_sub.colhead(tt,36,'&amp;lt;abbr title=&amp;quot;Win percentage&amp;quot;&amp;gt;PCT&amp;lt;/abbr&amp;gt;')					-- Percentage col&lt;br /&gt;
	end&lt;br /&gt;
	if full_table then&lt;br /&gt;
		if do_GB then -- Games behind header&lt;br /&gt;
			tt = p_sub.colhead(tt,28,'&amp;lt;abbr title=&amp;quot;Games behind&amp;quot;&amp;gt;GB&amp;lt;/abbr&amp;gt;')&lt;br /&gt;
		end&lt;br /&gt;
		tt.count = tt.count+1&lt;br /&gt;
		table.insert(tt.tab_text,results_header_txt)&lt;br /&gt;
	end&lt;br /&gt;
 &lt;br /&gt;
	return tt&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
function pp.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;
	-- Build the inner parts of individual rows&lt;br /&gt;
	&lt;br /&gt;
	-- Sub-module usage&lt;br /&gt;
	local mm = require('Module:Math')&lt;br /&gt;
	local yesno = require('Module:Yesno')&lt;br /&gt;
	&lt;br /&gt;
	-- Get custom/default options for in table&lt;br /&gt;
	local win_points = tonumber(Args['winpoints'])				or 3&lt;br /&gt;
	local loss_points = tonumber(Args['losspoints'])			or 0&lt;br /&gt;
 &lt;br /&gt;
	-- Get some input&lt;br /&gt;
	local wins = tonumber(Args['win_'..team_code_ii])			or 0&lt;br /&gt;
	local losses = tonumber(Args['loss_'..team_code_ii])		or 0&lt;br /&gt;
	local gfor = tonumber(Args['gf_'..team_code_ii] or Args['pf_'..team_code_ii] or '0') or '?'&lt;br /&gt;
	local gaig = tonumber(Args['ga_'..team_code_ii] or Args['pa_'..team_code_ii] or '0') or '?'&lt;br /&gt;
	local s_pts = tonumber(Args['adjust_points_'..team_code_ii]) or tonumber(Args['startpoints_'..team_code_ii]) or 0&lt;br /&gt;
	local hth_local = Args['hth_'..team_code_ii]				or nil&lt;br /&gt;
	-- Then calculate some values&lt;br /&gt;
	local matches = wins + losses&lt;br /&gt;
	local points = win_points*wins + gfor + s_pts&lt;br /&gt;
	local win_perc = mm._precision_format(wins / matches, 3)&lt;br /&gt;
	if matches == 0 then &lt;br /&gt;
		-- Escape for zero matches&lt;br /&gt;
		win_perc = '&amp;amp;mdash;' &lt;br /&gt;
	elseif losses &amp;gt; 0 then&lt;br /&gt;
		-- Drop the leading zero (from the string)&lt;br /&gt;
		win_perc = string.sub(win_perc,2,string.len(win_perc))&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Some local vars	&lt;br /&gt;
	local hth_string&lt;br /&gt;
	local tt_return = p_sub.hth(frame,Args,full_table,hth_id_list,hth_local,notes_exist,team_list,team_code_ii,ii_start,ii_end,rand_val)&lt;br /&gt;
	hth_string = tt_return.str&lt;br /&gt;
	hth_id_list = tt_return.list&lt;br /&gt;
	notes_exist = tt_return.notes_exist&lt;br /&gt;
 &lt;br /&gt;
 	-- What to rank the teams by&lt;br /&gt;
	local ranking_style = Args['ranking_style'] or 'pts'&lt;br /&gt;
	local rank_points, rank_perc = false&lt;br /&gt;
	local win_fw, win_string&lt;br /&gt;
	ranking_style = string.lower(ranking_style)&lt;br /&gt;
	if ranking_style=='w' or ranking_style=='win' or ranking_style=='wins' then&lt;br /&gt;
		-- Based on wins&lt;br /&gt;
		win_fw = 'font-weight: bold;'&lt;br /&gt;
		win_string = hth_string&lt;br /&gt;
	elseif ranking_style=='perc' or ranking_style=='percentage' or ranking_style=='%' then&lt;br /&gt;
		-- Based on percentage&lt;br /&gt;
		rank_perc = true&lt;br /&gt;
		win_fw=ii_fw&lt;br /&gt;
		win_string = ''&lt;br /&gt;
	else&lt;br /&gt;
		-- Based on points&lt;br /&gt;
		rank_points = true&lt;br /&gt;
		win_fw=ii_fw&lt;br /&gt;
		win_string = ''&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Show games played&lt;br /&gt;
	local show_played = true&lt;br /&gt;
	local hide_played_val = Args['hide_played'] 	or 'no'&lt;br /&gt;
	if yesno(hide_played_val) then show_played = false end&lt;br /&gt;
	&lt;br /&gt;
	-- Show for/against&lt;br /&gt;
	local for_against_style = Args['for_against_style'] 	or 'goals'&lt;br /&gt;
	local hide_for_against = false&lt;br /&gt;
	for_against_style = string.lower(for_against_style)&lt;br /&gt;
	if for_against_style=='none' then&lt;br /&gt;
		hide_for_against = true&lt;br /&gt;
	end&lt;br /&gt;
	-- Comparison of for and against&lt;br /&gt;
	local gcomp&lt;br /&gt;
	-- Whether to use goal ratio (goal average) instead&lt;br /&gt;
	local use_ratio_val = Args['use_goal_ratio'] 	or 'no'&lt;br /&gt;
	local skip_sign&lt;br /&gt;
	if yesno(use_ratio_val) then&lt;br /&gt;
		-- Now it is the goal ratio/goal average&lt;br /&gt;
		if (gfor == '?') or (gaig == '?') or gaig == 0 then&lt;br /&gt;
			gcomp = '&amp;amp;mdash;'&lt;br /&gt;
		else&lt;br /&gt;
			gcomp = mm._precision_format(gfor / gaig, 3)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- It's goal difference&lt;br /&gt;
		if (gfor == '?') or (gaig == '?') then&lt;br /&gt;
			gcomp = '&amp;amp;mdash;'&lt;br /&gt;
		else&lt;br /&gt;
			gcomp = gfor - gaig&lt;br /&gt;
			-- Formatting with signs&lt;br /&gt;
			if gcomp&amp;gt;0 then&lt;br /&gt;
				gcomp='+'..gcomp&lt;br /&gt;
			elseif gcomp &amp;lt; 0 then&lt;br /&gt;
				gcomp='&amp;amp;minus;'..-gcomp&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	-- Use actual values if gfor or gaig is not numeric&lt;br /&gt;
	if (gfor == '?') then gfor = Args['gf_'..team_code_ii] or Args['pf_'..team_code_ii] or '' end&lt;br /&gt;
	if (gaig == '?') then gaig = Args['ga_'..team_code_ii] or Args['pa_'..team_code_ii] or '' end&lt;br /&gt;
	&lt;br /&gt;
	-- Show games behind&lt;br /&gt;
	local show_GB = Args['show_GB'] 	or 'no'&lt;br /&gt;
	local do_GB = false&lt;br /&gt;
	local GB_text = '&amp;amp;mdash;'&lt;br /&gt;
	if yesno(show_GB) then&lt;br /&gt;
		do_GB = true&lt;br /&gt;
		&lt;br /&gt;
		local GB_team_no = tonumber(Args['GB_team']) or 1&lt;br /&gt;
		if ii == GB_team_no then&lt;br /&gt;
			-- Do nothing, it's vs this team&lt;br /&gt;
		else&lt;br /&gt;
			local wins_GB = tonumber(Args['win_'..team_list[GB_team_no]])		or 0&lt;br /&gt;
			local losses_GB = tonumber(Args['loss_'..team_list[GB_team_no]])	or 0&lt;br /&gt;
			local GB_num = (wins_GB-wins+losses-losses_GB)/2&lt;br /&gt;
			-- Display options&lt;br /&gt;
			if GB_num &amp;gt;0 then&lt;br /&gt;
				-- Indicates trailing GB_team&lt;br /&gt;
				GB_text = GB_num&lt;br /&gt;
			elseif GB_num == 0 then&lt;br /&gt;
				-- Equal, do nothing to get dash&lt;br /&gt;
			else &lt;br /&gt;
				-- Ahead of GB team, should be noted by plus (instead of minus that comes from formula)&lt;br /&gt;
				GB_text = '+'..-GB_num&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
 &lt;br /&gt;
	-- Row building&lt;br /&gt;
	if show_played then&lt;br /&gt;
		table.insert(t,'| style=&amp;quot;'..ii_fw..bg_col..'&amp;quot; |'..matches..'\n') 		-- Played&lt;br /&gt;
	end&lt;br /&gt;
	if full_table then&lt;br /&gt;
		table.insert(t,'| style=&amp;quot;'..win_fw..bg_col..'&amp;quot; |'..wins..win_string..'\n') 			-- Won&lt;br /&gt;
		table.insert(t,'| style=&amp;quot;'..ii_fw..bg_col..'&amp;quot; |'..losses..'\n') 		-- Lost&lt;br /&gt;
		if not hide_for_against then&lt;br /&gt;
			table.insert(t,'| style=&amp;quot;'..ii_fw..bg_col..'&amp;quot; |'..gfor..'\n') 		-- GF&lt;br /&gt;
			table.insert(t,'| style=&amp;quot;'..ii_fw..bg_col..'&amp;quot; |'..gaig..'\n')		-- GA&lt;br /&gt;
			table.insert(t,'| style=&amp;quot;'..ii_fw..bg_col..'&amp;quot; |'..gcomp..'\n')      -- Goal comparison&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if rank_points then&lt;br /&gt;
		-- Add &amp;amp;minus; for negative point totals&lt;br /&gt;
		if points&amp;lt;0 then&lt;br /&gt;
			table.insert(t,'| style=&amp;quot;font-weight: bold;'..bg_col..'&amp;quot; | &amp;amp;minus;'..-points..hth_string..'\n')&lt;br /&gt;
		else&lt;br /&gt;
			table.insert(t,'| style=&amp;quot;font-weight: bold;'..bg_col..'&amp;quot; | '..points..hth_string..'\n')&lt;br /&gt;
		end&lt;br /&gt;
	elseif rank_perc then&lt;br /&gt;
		table.insert(t,'| style=&amp;quot;font-weight: bold;'..bg_col..'&amp;quot; | '..win_perc..hth_string..'\n')&lt;br /&gt;
	end&lt;br /&gt;
	if do_GB then&lt;br /&gt;
		table.insert(t,'| style=&amp;quot;'..ii_fw..bg_col..'&amp;quot; |'..GB_text..'\n')  -- GB&lt;br /&gt;
	end&lt;br /&gt;
 &lt;br /&gt;
	return {t=t, notes_exist=notes_exist, hth_id_list=hth_id_list}&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
function pp.status(Args)&lt;br /&gt;
	-- Declare status options&lt;br /&gt;
	-- ------------------------------------------------------------&lt;br /&gt;
	-- NOTE: If you add to status_code, also add to status_called and status_letters!!&lt;br /&gt;
	-- Or functionality will be compromised&lt;br /&gt;
	-- ------------------------------------------------------------&lt;br /&gt;
	local status_code, status_called = {}, {}&lt;br /&gt;
	status_code = {	A='Advances to a further round', C='Champion', D='Disqualified', &lt;br /&gt;
		E='Eliminated', H='Host', O='Play-off winner', P='Promoted', Q='Qualified to the phase indicated',&lt;br /&gt;
		R='Relegated', T='Qualified, but not yet to the particular phase indicated'}&lt;br /&gt;
	local status_letters = (Args['status_order'] or '') .. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'&lt;br /&gt;
	&lt;br /&gt;
	-- Status position (before or after read and default)&lt;br /&gt;
	local stat_pos_val = Args['status_pos'] or ''&lt;br /&gt;
	local status_position = 'after' 	-- Default location&lt;br /&gt;
	stat_pos_val = string.lower(stat_pos_val)&lt;br /&gt;
	if stat_pos_val=='before' then&lt;br /&gt;
		status_position = 'before'&lt;br /&gt;
	elseif stat_pos_val=='after' then&lt;br /&gt;
		status_position = 'after'&lt;br /&gt;
	end&lt;br /&gt;
	-- Read in custom status options&lt;br /&gt;
	for l in mw.text.gsplit(status_letters, '') do&lt;br /&gt;
		status_called[l] = false&lt;br /&gt;
		status_code[l] = status_code[l] or '?'&lt;br /&gt;
		status_letters = mw.ustring.gsub(status_letters, '(' .. l ..'.-)' .. l, '%1')&lt;br /&gt;
&lt;br /&gt;
		if Args['status_text_' .. l] then&lt;br /&gt;
			status_code[l] = Args['status_text_' .. l]&lt;br /&gt;
		end&lt;br /&gt;
	 end&lt;br /&gt;
	&lt;br /&gt;
	return {code=status_code, called=status_called, letters=status_letters, position=status_position}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return pp&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>