![]() | This Lua module is used on approximately 29,000 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. |
![]() | This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
![]() | This module depends on the following other modules: |
Module:Episode list creates a table row, for use in a list of episodes tables, primarily for television. This module can be used in conjunction with Module:Episode table which creates a consistent and Manual of Style ready table, or with a manually created table. See Template:Episode list for further explanation and documentation.
Usage
Create a standard Episode list with:
{{#invoke:Episode list|list}}
Create a sublist which removes episode summaries on the transcluded page with:
{{#invoke:Episode list|sublist}}
Tracking categories
- Category:Episode list using the default LineColor (5,950)
- Category:Episode lists with a non-matching set of numbered parameters (100)
- Category:Episode lists with faulty line colors (0)
- Category:Episode lists with incorrectly formatted alternate air dates (0)
- Category:Episode lists with invalid top colors (1)
- Category:Episode lists with non-compliant line colors (10)
- Category:Episode lists with row deviations (35)
- Category:Episode lists with row dividers (0)
- Category:Episode lists with TBA values (465)
- Category:Episode lists with unformatted air dates (0)
- Category:Episode lists with unformatted story or teleplay credits (2)
local p = {}
local getArgs
local yesno = require('Module:Yesno')
local _mod = require('Module:Math').mod()
function p.sublist(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
local args = getArgs(frame, {wrappers = 'Template:Episode list/sublist'})
local on_same_page
local page_title = tostring(mw.title.getCurrentTitle())
local mainlist = args.MainList or args[1] or page_title
on_same_page = mw.uri.anchorEncode(page_title) == mw.uri.anchorEncode(mainlist)
local EpisodeNumber,EpisodeNumber2,Title,Aux1,DirectedBy,WrittenBy,DirectedBy,Aux2,Aux3,OriginalAirDate,AltDate,ProdCode,Viewers,Aux4
local line_color = args.LineColor or 'CCCCFF'
local cell_names = {
'EpisodeNumber2',
'Title',
'Aux1',
'DirectedBy',
'WrittenBy',
'DirectedBy',
'Aux2',
'Aux3',
'OriginalAirDate',
'AltDate',
'ProdCode',
'Viewers',
'Aux4'
}
local td_tags = {
['EpisodeNumber2'] = EpisodeNumber2,
['Title'] = Title,
['Aux1'] = Aux1,
['DirectedBy'] = DirectedBy,
['WrittenBy'] = WrittenBy,
['DirectedBy'] = DirectedBy,
['Aux2'] = Aux2,
['Aux3'] = Aux3,
['OriginalAirDate'] = OriginalAirDate,
['AltDate'] = AltDate,
['ProdCode'] = ProdCode,
['Viewers'] = Viewers,
['Aux4'] = Aux4,
}
local nonnil_params = 0
local table_row = mw.html.create('tr')
:addClass('vevent')
:css('text-align','center')
local row_color = yesno(args.RowColor, false)
local top_color
local epn = args.EpisodeNumber or 1
if args.TopColor then
top_color = '#'..args.TopColor
elseif row_color and on_same_page and _mod(epn) == 0 then
top_color = '#E9E9E9'
elseif args.ShortSummary then
top_color = '#F2F2F2'
else
top_color = 'inherit'
end
table_row:css('background',top_color)
if args.EpisodeNumber then
EpisodeNumber = mw.html.create('th')
:attr('scope','row')
:attr('id','ep'..args.EpisodeNumber)
:css('text-align','center')
table_row:css('background',top_color)
table_row:node(EpisodeNumber)
end
for _,v in ipairs(cell_names) do
if args[v] then
nonnil_params = nonnil_params + 1
td_tags = mw.html.create('td')
:wikitext(args[v])
table_row:node(v)
end
end
if args.ProdCode then
ProdCode:attr('id','pc'..args.ProdCode)
end
if args.Title then
local title_string = '"'..args.Title..'"'
if args.RTitle then
title_string = title_string..RTitle
end
if args.AltTitle then
title_string = title_string..'"'..AltTitle..'"'
end
if args.RAltTitle then
title_string = title_string..RAltTitle
end
Title:wikitext(title_string)
end
if args.ShortSummary then
local bottom_wrapper = mw.html.create('tr')
local ShortSummary = mw.html.create('td')
:addClass('description')
:css('border-bottom','solid 3px #'..line_color)
:attr('colspan',nonnil_params)
:wikitext(args.ShortSummary)
table_row:node(ShortSummary)
end
return tostring(table_row)
end
return p