Module:Sandbox/isaacl/NHL standings explained

-- This module copies content from Template:2012–13_NHL_Eastern_Conference_standings;-- see the history of that page for attribution.

-- TODO:-- add support for annotations:-- - y = won division-- - z = best record in conference-- - p = best record in league-- add support for sorting by playoff ranking-- add support for wild card-based tables

local me =

local nhlInfo

-- if mw.loadData not supported, use require insteadif mw.loadData then nhlInfo = mw.loadData('Module:Sandbox/isaacl/NHL standings/2013 2014 NHL info')else nhlInfo = require('Module:Sandbox/isaacl/NHL standings/2013 2014 NHL info')end

local Navbar = require('Module:Navbar')

local config =

config.inputFormat = '2005-2006-rules'config.outputFormat = '2013-2014-rules'config.standingsType = 'league'config.separatorFormat = 'default'config.seedInfo = config.tableHeaderText = config.entityForTeam = nil

config.tableTitleForStandingsType =

config.scopeForStandingsType =

local function initEntityForTeamTable config.entityForTeam =

for conferenceName, conferenceInfo in pairs(nhlInfo.structure.conference) do for divisionName, teamList in pairs(conferenceInfo.division) do for idx, teamName in ipairs(teamList) do if (config.entityForTeam[teamName]

nil) then config.entityForTeam[teamName] = end config.entityForTeam[teamName].conference = conferenceName config.entityForTeam[teamName].division = divisionName end -- loop over team names end -- loop over divisions end -- loop over conferencesend -- function initTeamsForEntity

local function filterTeamsByEntity(listOfTeams, entityType, entity) if (config.entityForTeam

nil) then initEntityForTeamTable end local filteredTeams = for idx, teamInfo in ipairs(listOfTeams) do if (config.entityForTeam[teamInfo.name]) then if (entity

config.entityForTeam[teamInfo.name][entityType]) then table.insert(filteredTeams, teamInfo) end end end return filteredTeamsend -- function filterTeamsByEntity

local function compareTeamsByRank(teamA, teamB) local result; if (teamA.points ~= teamB.points) then return teamA.points > teamB.points elseif (teamA.games ~= teamB.games) then return teamA.games < teamB.games elseif (teamA.nonShootoutWins ~= teamB.nonShootoutWins) then return teamA.nonShootoutWins > teamB.nonShootoutWins else -- The next tie-breaker is the head-to-head records of the -- two teams. As this information is not given to this -- template, just preserve the original order. return teamA.originalPosition < teamB.originalPosition endend -- function compareTeams

local readTeamInfo = -- readTeamInfo object

local function initTableHeaderText(frame) config.tableHeaderText = end

local generateTableHeader = \n')

return table.concat(outputBuffer)

end -- function me.generateStandingsTable

function me.generateStandingsTable_fromTemplate(frame) return me.generateStandingsTable(frame:getParent)end -- function me.generateStandingsTable_fromTemplate

return me