<?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%3AIndianPremierLeagueProgression</id>
	<title>Module:IndianPremierLeagueProgression - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mywikibiz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AIndianPremierLeagueProgression"/>
	<link rel="alternate" type="text/html" href="https://mywikibiz.com/index.php?title=Module:IndianPremierLeagueProgression&amp;action=history"/>
	<updated>2026-04-13T11:48:36Z</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:IndianPremierLeagueProgression&amp;diff=472252&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:IndianPremierLeagueProgression&amp;diff=472252&amp;oldid=prev"/>
		<updated>2021-07-15T23:18:26Z</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;--[[&lt;br /&gt;
    Module for generating league progresion tables intended for use in Indian Premier League season articles.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local _module = {}&lt;br /&gt;
&lt;br /&gt;
_module.create = function(frame)&lt;br /&gt;
    &lt;br /&gt;
    ------------- Functions -------------&lt;br /&gt;
    local strFind = string.find&lt;br /&gt;
    local strMatch = string.match&lt;br /&gt;
    local strSplit = mw.text.split&lt;br /&gt;
    local strFormat = string.format&lt;br /&gt;
    local strTrim = mw.text.trim&lt;br /&gt;
    local strSub = string.sub&lt;br /&gt;
    local strRepeat = string.rep&lt;br /&gt;
    local strUpper = string.upper&lt;br /&gt;
    &lt;br /&gt;
    ------------- Arguments -------------&lt;br /&gt;
    local args = frame.args&lt;br /&gt;
    local matchesPerTeam = tonumber(args.matchesPerTeam) or error(&amp;quot;Invalid or missing parameter 'matchesPerTeam'&amp;quot;)&lt;br /&gt;
    local ktype = tonumber(args.knockoutType) or error(&amp;quot;Invalid or missing parameter 'knockoutType'&amp;quot;)&lt;br /&gt;
    local teams = strSplit(args.teams or error(&amp;quot;Invalid or missing parameter 'knockoutType'&amp;quot;), ',', true)&lt;br /&gt;
    local matchReportArticle = args.matchReportArticle or ''&lt;br /&gt;
    local caption = args.caption&lt;br /&gt;
&lt;br /&gt;
    -- The colours for each result&lt;br /&gt;
    local colours_win           = &amp;quot;#99FF99&amp;quot;   -- Win&lt;br /&gt;
    local colours_loss          = &amp;quot;#FFDDDD&amp;quot;   -- Loss&lt;br /&gt;
    --local colours_tie           = &amp;quot;&amp;quot;&lt;br /&gt;
    local colours_noResult      = &amp;quot;#DFDFFF&amp;quot;   -- No result&lt;br /&gt;
    local colours_eliminated    = &amp;quot;#DCDCDC&amp;quot;   -- Eliminated&lt;br /&gt;
    local colours_notPossible   = &amp;quot;#DCDCDC&amp;quot;   -- Not technically possible (only used for some playoff matches with knockoutType=2)&lt;br /&gt;
    &lt;br /&gt;
    -- The CSS classes applied to the cells of each result&lt;br /&gt;
    local classes_win       = &amp;quot;yes table-yes2&amp;quot;&lt;br /&gt;
    local classes_loss      = &amp;quot;no table-no2&amp;quot;&lt;br /&gt;
    local classes_noResult  = &amp;quot;noresult&amp;quot;&lt;br /&gt;
    --local classes_tie       = &amp;quot;&amp;quot;&lt;br /&gt;
    &lt;br /&gt;
    -- The output buffer&lt;br /&gt;
    local output = {}&lt;br /&gt;
    local outputIndex = 1&lt;br /&gt;
    function print(s)&lt;br /&gt;
        output[outputIndex] = s&lt;br /&gt;
        outputIndex = outputIndex + 1&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    local kMatches = ({ 2, 3 }) [ktype]&lt;br /&gt;
    if not kMatches then&lt;br /&gt;
        error(&amp;quot;Invalid knockout type: &amp;quot; .. ktype)&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    -- Construct the header&lt;br /&gt;
    print(strFormat([[&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: center&amp;quot;%s&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; rowspan=&amp;quot;2&amp;quot; | Team&lt;br /&gt;
! colspan=&amp;quot;%d&amp;quot; style=&amp;quot;border-left: 4px solid #454545&amp;quot; | Group matches&lt;br /&gt;
! colspan=&amp;quot;%d&amp;quot; style=&amp;quot;border-left: 4px solid #454545&amp;quot; | Playoffs&lt;br /&gt;
|-&lt;br /&gt;
]],&lt;br /&gt;
    caption and '\n|+' .. caption or '', matchesPerTeam, kMatches))&lt;br /&gt;
    &lt;br /&gt;
    for i = 1, matchesPerTeam do&lt;br /&gt;
        -- Generate the headers for each group match&lt;br /&gt;
        print(strFormat('! scope=&amp;quot;col&amp;quot; style=&amp;quot;width: 30px;%s&amp;quot; | %d\n', i == 1 and &amp;quot; border-left: 4px solid #454545&amp;quot; or &amp;quot;&amp;quot;, i))&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    --[[&lt;br /&gt;
        Headers specific to each knockout type&lt;br /&gt;
    ]]&lt;br /&gt;
    &lt;br /&gt;
    local knockoutHeaders = {&lt;br /&gt;
    -- Knockout type 1 (used from 2008 to 2010)&lt;br /&gt;
[[&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width: 32px; border-left: 4px solid #454545&amp;quot; | &amp;lt;abbr title=&amp;quot;Semi-final&amp;quot;&amp;gt;SF&amp;lt;/abbr&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width: 32px&amp;quot; | &amp;lt;abbr title=&amp;quot;Final&amp;quot;&amp;gt;F&amp;lt;/abbr&amp;gt;]],&lt;br /&gt;
    -- Knockout type 2 (used from 2011 onwards)&lt;br /&gt;
[[&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width: 32px; border-left: 4px solid #454545&amp;quot; | &amp;lt;abbr title=&amp;quot;Qualifier 1 or Eliminator&amp;quot;&amp;gt;Q1/E&amp;lt;/abbr&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width: 32px&amp;quot; | &amp;lt;abbr title=&amp;quot;Qualifier 2&amp;quot;&amp;gt;Q2&amp;lt;/abbr&amp;gt;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;width: 32px&amp;quot; | &amp;lt;abbr title=&amp;quot;Final&amp;quot;&amp;gt;F&amp;lt;/abbr&amp;gt;]]&lt;br /&gt;
    &lt;br /&gt;
    }&lt;br /&gt;
    print(knockoutHeaders[ktype])&lt;br /&gt;
    &lt;br /&gt;
    local argCounter = 1&lt;br /&gt;
    &lt;br /&gt;
    -- Generate the table&lt;br /&gt;
    for i = 1, #teams do&lt;br /&gt;
    &lt;br /&gt;
        local team = strTrim(teams[i])&lt;br /&gt;
        print('\n|-\n! scope=&amp;quot;row&amp;quot; style=&amp;quot;text-align: left; padding-right: 10px&amp;quot; | [[' .. team .. ']]\n')   -- Add the team name&lt;br /&gt;
        local gs, ks = args[argCounter] or '', args[argCounter + 1] or ''&lt;br /&gt;
        local j, comma, runningScore, lastMatch = 0, 0, 0, 0&lt;br /&gt;
        argCounter = argCounter + 2&lt;br /&gt;
        &lt;br /&gt;
        repeat&lt;br /&gt;
            j = j + 1&lt;br /&gt;
            if j &amp;gt; matchesPerTeam then&lt;br /&gt;
                error(strFormat(&amp;quot;Too many group stage matches. Expected %d (team: %s)&amp;quot;, matchesPerTeam, team))&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            local startPos = comma + 1&lt;br /&gt;
            comma = strFind(gs, ',', startPos, true) or 0&lt;br /&gt;
            &lt;br /&gt;
            print(j == 1 and '| style=&amp;quot;border-left: 4px solid #454545; ' or '|| style=&amp;quot;')&lt;br /&gt;
            &lt;br /&gt;
            local rpos = strFind(gs, '%S', startPos)&lt;br /&gt;
            if rpos and (rpos &amp;lt; comma or comma == 0) then&lt;br /&gt;
                local result, match = strUpper(strSub(gs, rpos, rpos)), tonumber(strMatch(strSub(gs, rpos + 1, comma - 1), '^(.-)%s*$'))&lt;br /&gt;
&lt;br /&gt;
                -- Check that the match number is a valid non-negative integer greater than the preceding match number.&lt;br /&gt;
                if not match or match &amp;lt;= 0 or match % 1 ~= 0 then&lt;br /&gt;
                    error(strFormat(&amp;quot;Match number does not exist or is not a valid integer greater than 0 for group stage result #%d (team: %s)&amp;quot;, j, team))&lt;br /&gt;
                elseif match &amp;lt;= lastMatch then&lt;br /&gt;
                    error(strFormat(&amp;quot;Invalid match number: %d for group stage result #%d, must be greater than the preceding match number (%d) (team: %s)&amp;quot;, match, j, lastMatch, team))&lt;br /&gt;
                end&lt;br /&gt;
                lastMatch = match&lt;br /&gt;
                &lt;br /&gt;
                if result == 'W' then    -- Win&lt;br /&gt;
                    runningScore = runningScore + 2&lt;br /&gt;
                    print(strFormat('background-color: %s&amp;quot; class=&amp;quot;%s&amp;quot; | [[%s#match%s|%d]] ', colours_win, classes_win, matchReportArticle, match, runningScore))&lt;br /&gt;
                elseif result == 'L' then     -- Loss&lt;br /&gt;
                    print(strFormat('background-color: %s&amp;quot; class=&amp;quot;%s&amp;quot; | [[%s#match%s|%d]] ', colours_loss, classes_loss, matchReportArticle, match, runningScore))&lt;br /&gt;
                elseif result == 'N' then     -- No result&lt;br /&gt;
                    runningScore = runningScore + 1&lt;br /&gt;
                    print(strFormat('background-color: %s&amp;quot; class=&amp;quot;%s&amp;quot; | [[%s#match%s|%d]] ', colours_noResult, classes_noResult, matchReportArticle, match, runningScore))&lt;br /&gt;
                --elseif result == 'T' then     -- Tie&lt;br /&gt;
                --    runningScore = runningScore + 1&lt;br /&gt;
                --    print(strFormat('background-color: %s&amp;quot; class=&amp;quot;%s&amp;quot; | [[%s#match%s|%d]] ', colours_tie, classes_tie, matchReportArticle, match, runningScore))&lt;br /&gt;
                else&lt;br /&gt;
                    error(strFormat(&amp;quot;Invalid group stage result #%d: '%s', expecting 'W', 'L', 'N', or 'T' as first character (team: %s)&amp;quot;, j, result, team))&lt;br /&gt;
                end&lt;br /&gt;
            else&lt;br /&gt;
                -- Result not given&lt;br /&gt;
                print('&amp;quot; | ')&lt;br /&gt;
            end&lt;br /&gt;
        until comma == 0&lt;br /&gt;
        if j ~= matchesPerTeam then    -- Output empty cells for the remaining matches&lt;br /&gt;
            print(strRepeat('|| ', matchesPerTeam - j))&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        j, comma = 0, 0&lt;br /&gt;
&lt;br /&gt;
        repeat&lt;br /&gt;
            j = j + 1&lt;br /&gt;
            if j &amp;gt; kMatches then&lt;br /&gt;
                error(strFormat(&amp;quot;Too many playoff stage matches. Expected %d (team: %s)&amp;quot;, kMatches, team))&lt;br /&gt;
            end&lt;br /&gt;
            &lt;br /&gt;
            local startPos = comma + 1&lt;br /&gt;
            comma = strFind(ks, ',', startPos, true) or 0&lt;br /&gt;
            &lt;br /&gt;
            print(j == 1 and '|| style=&amp;quot;border-left: 4px solid #454545; ' or '|| style=&amp;quot;')&lt;br /&gt;
            &lt;br /&gt;
            local rpos = strFind(ks, '%S', startPos)&lt;br /&gt;
            if rpos and (rpos &amp;lt; comma or comma == 0) then&lt;br /&gt;
                local result, match = strUpper(strSub(ks, rpos, rpos)), tonumber(strMatch(strSub(ks, rpos + 1, comma - 1), '^(.-)%s*$'))&lt;br /&gt;
                &lt;br /&gt;
                if result == 'E' then&lt;br /&gt;
                    if comma ~= 0 then&lt;br /&gt;
                        error(&amp;quot;The result 'E' must be the last result in the playoff stage result list. (team: &amp;quot; .. team ..&amp;quot;)&amp;quot;)&lt;br /&gt;
                    end&lt;br /&gt;
                    print(strFormat('background-color: %s&amp;quot; colspan=&amp;quot;%d&amp;quot; | ', colours_eliminated, kMatches - j + 1))&lt;br /&gt;
                    j = kMatches    -- To avoid printing empty cells for the remaining matches&lt;br /&gt;
                    break&lt;br /&gt;
                elseif result == 'U' then&lt;br /&gt;
                    print('background-color: ' .. colours_notPossible .. '&amp;quot; | ')&lt;br /&gt;
                else&lt;br /&gt;
                    if not match or match &amp;lt; 0 or match % 1 ~= 0 then&lt;br /&gt;
                        error(strFormat(&amp;quot;Match number does not exist or is invalid for playoff stage result #%d (team: %s)&amp;quot;, j, team))&lt;br /&gt;
                    elseif match &amp;lt;= lastMatch then&lt;br /&gt;
                        error(strFormat(&amp;quot;Invalid match number: %d for group stage result #%d, must be greater than the preceding match number (%d) (team: %s)&amp;quot;, match, j, lastMatch, team))&lt;br /&gt;
                    end&lt;br /&gt;
                    &lt;br /&gt;
                    lastMatch = match&lt;br /&gt;
                    &lt;br /&gt;
                    if result == 'W' then&lt;br /&gt;
                        print(strFormat('background-color: %s&amp;quot; class=&amp;quot;%s&amp;quot; | [[%s#match%s|W]] ', colours_win, classes_win, matchReportArticle, match))&lt;br /&gt;
                    elseif result == 'L' then&lt;br /&gt;
                        print(strFormat('background-color: %s&amp;quot; class=&amp;quot;%s&amp;quot; | [[%s#match%s|L]] ', colours_loss, classes_loss, matchReportArticle, match))&lt;br /&gt;
                    elseif result == 'N' then&lt;br /&gt;
                        print(strFormat('background-color: %s&amp;quot; class=&amp;quot;%s&amp;quot; | [[%s#match%s|N]] ', colours_noResult, classes_noResult, matchReportArticle, match))&lt;br /&gt;
                    --elseif result == 'T' then&lt;br /&gt;
                    --    print(strFormat('background-color: %s&amp;quot; class=&amp;quot;%s&amp;quot; | [[%s#match%s|T]] ', colours_tie, classes_tie, matchReportArticle, match))&lt;br /&gt;
                    else&lt;br /&gt;
                        error(strFormat(&amp;quot;Invalid group stage result #%d: '%s', expecting 'W', 'L', 'N', ', 'E' or 'U' as first character (team: %s)&amp;quot;, j, result, team))&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            else&lt;br /&gt;
                -- Result not given&lt;br /&gt;
                print('&amp;quot; | ')&lt;br /&gt;
            end&lt;br /&gt;
        until comma == 0&lt;br /&gt;
        if j ~= kMatches then    -- Output empty cells for the remaining matches&lt;br /&gt;
            print(strRepeat('|| ', kMatches - j))&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- Footer&lt;br /&gt;
    print(strFormat([[&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float: right; width: 20%%; text-align: center; font-size: 90%%&amp;quot;&lt;br /&gt;
| class=&amp;quot;%s&amp;quot; style=&amp;quot;background-color: %s&amp;quot; | Win&lt;br /&gt;
| class=&amp;quot;%s&amp;quot; style=&amp;quot;background-color: %s&amp;quot; | Loss&lt;br /&gt;
| class=&amp;quot;%s&amp;quot; style=&amp;quot;background-color: %s&amp;quot; | No result&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul style=&amp;quot;font-size: 90%%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;'''Note''': The total points at the end of each group match are listed.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;'''Note''': Click on the points (group matches) or W/L (playoffs) to see the match summary.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;]],&lt;br /&gt;
    classes_win, colours_win, classes_loss, colours_loss, classes_noResult, colours_noResult))&lt;br /&gt;
    &lt;br /&gt;
    return table.concat(output)&lt;br /&gt;
    &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return _module&lt;/div&gt;</summary>
		<author><name>Zoran</name></author>
	</entry>
</feed>