Module:Series overview
Appearance
![]() | This module depends on the following other modules: |
![]() | This Lua module is used on approximately 8,900 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
Usage
Creates a standard Series overview with {{#invoke:Series overview|main}}
With the parameters defined in the documentation of the template.
Tracking categories
-- This module implements {{series overview}}.
require('Module:No globals')
local lang = mw.language.getContentLanguage()
--------------------------------------------------------------------------------
-- EpisodeGroup class
-- A consecutive run of episodes. There is usually only one of these in a
-- season, but there can be more if the season is split.
--------------------------------------------------------------------------------
local EpisodeGroup = {}
function EpisodeGroup.new(options)
options = options or {}
local obj = {}
-- Validates a date and returns it in YYYY-MM-DD format.
local function validateDate(date)
if not date then
return nil
end
local success, ret = pcall(function ()
return lang:formatDate('Y-m-d', date)
end)
if success then
return ret
else
error(string.format('"%s" is not a valid date', tostring(date)), 3)
end
end
local startDate = validateDate(options.startDate)
local endDate = validateDate(options.endDate)
local info = {}
if options.info then
for i, v in ipairs(options.info) do
info[i] = v
end
end
function obj:getColor()
return options.color
end
function obj:getStartDate()
return startDate
end
function obj:getEndDate()
return endDate
end
function obj:getNetwork()
return options.network
end
return obj
end
--------------------------------------------------------------------------------
-- SeriesEntry class
-- This can represent a season or a special.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Series class
-- The main class.
--------------------------------------------------------------------------------