Module:PakistanSuperLeagueProgression

--   Module for generating league progresion tables intended for use in Pakistan Super League season articles.

local _module = {}

_module.create = function(frame) - Functions - local strFind = string.find local strMatch = string.match local strSplit = mw.text.split local strFormat = string.format local strTrim = mw.text.trim local strSub = string.sub local strRepeat = string.rep local strUpper = string.upper - Arguments - local args = frame.args local matchesPerTeam = tonumber(args.matchesPerTeam) or error("Invalid or missing parameter 'matchesPerTeam'") local ktype = tonumber(args.knockoutType) or error("Invalid or missing parameter 'knockoutType'") local teams = strSplit(args.teams or error("Invalid or missing parameter 'knockoutType'"), ',', true) local matchReportArticle = args.matchReportArticle or '' local caption = args.caption

-- The colours for each result local colours_win          = "#99FF99"   -- Win local colours_loss         = "#FFDDDD"   -- Loss --local colours_tie          = "" local colours_noResult     = "#DFDFFF"   -- No result local colours_eliminated   = "#DCDCDC"   -- Eliminated local colours_notPossible  = "#DCDCDC"   -- Not technically possible (only used for some playoff matches with knockoutType=2) -- The CSS classes applied to the cells of each result local classes_win      = "yes table-yes2" local classes_loss     = "no table-no2" local classes_noResult = "noresult" --local classes_tie      = "" -- The output buffer local output = {} local outputIndex = 1 function print(s) output[outputIndex] = s       outputIndex = outputIndex + 1 end local kMatches = ({ 2, 3 }) [ktype] if not kMatches then error("Invalid knockout type: " .. ktype) end -- Construct the header print(strFormat([[

 Note: The total points at the end of each group match are listed. Note: Click on the points (group matches) or W/L (playoffs) to see the match summary. ]], classes_win, colours_win, classes_loss, colours_loss, classes_noResult, colours_noResult)) return table.concat(output) end

return _module