<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://goodoldtv.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AEpisode_list</id>
	<title>Module:Episode list - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://goodoldtv.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AEpisode_list"/>
	<link rel="alternate" type="text/html" href="http://goodoldtv.com/index.php?title=Module:Episode_list&amp;action=history"/>
	<updated>2026-05-10T16:01:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>http://goodoldtv.com/index.php?title=Module:Episode_list&amp;diff=1218&amp;oldid=prev</id>
		<title>Adminpeter: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://goodoldtv.com/index.php?title=Module:Episode_list&amp;diff=1218&amp;oldid=prev"/>
		<updated>2017-03-03T07:29:43Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local getArgs&lt;br /&gt;
local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
local mm = require(&amp;#039;Module:Math&amp;#039;)&lt;br /&gt;
local contrast_ratio = require(&amp;#039;Module:Color contrast&amp;#039;)._ratio&lt;br /&gt;
local HTMLcolor = mw.loadData( &amp;#039;Module:Color contrast/colors&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
function p.sublist(frame)&lt;br /&gt;
	return main(frame,true)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.list(frame)&lt;br /&gt;
	return main(frame,false)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function idtrim(val,search)&lt;br /&gt;
	local valfind = string.find(val, search)&lt;br /&gt;
	if valfind == nil then&lt;br /&gt;
		return val&lt;br /&gt;
	else&lt;br /&gt;
		return string.sub(val, 0, valfind-1)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function main(frame, sublist)&lt;br /&gt;
	if not getArgs then&lt;br /&gt;
		getArgs = require(&amp;#039;Module:Arguments&amp;#039;).getArgs&lt;br /&gt;
	end&lt;br /&gt;
	local args&lt;br /&gt;
&lt;br /&gt;
	-- Most parameters should still display when blank, so don&amp;#039;t remove blanks&lt;br /&gt;
	if sublist then&lt;br /&gt;
		args = getArgs(frame, {removeBlanks = false, wrappers = &amp;#039;Template:Episode list/sublist&amp;#039;})&lt;br /&gt;
	else&lt;br /&gt;
		args = getArgs(frame, {removeBlanks = false, wrappers = &amp;#039;Template:Episode list&amp;#039;})&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local title = mw.title.getCurrentTitle()&lt;br /&gt;
	local page_title = mw.title.getCurrentTitle().text&lt;br /&gt;
	local mainlist = args.MainList or args[&amp;#039;1&amp;#039;] or &amp;#039;&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	-- Is this list on the same page as the page directly calling the template?&lt;br /&gt;
	local on_main_page&lt;br /&gt;
	&lt;br /&gt;
	-- Only sublist had anything about hiding, so only it needs to even check&lt;br /&gt;
	if sublist then&lt;br /&gt;
		on_main_page = mw.uri.anchorEncode(page_title) == mw.uri.anchorEncode(mainlist)&lt;br /&gt;
		-- avoid processing ghost references&lt;br /&gt;
		if on_main_page then&lt;br /&gt;
			args.ShortSummary = nil&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
	-- Normal lists can ALWAYS show the summary&lt;br /&gt;
		on_main_page = false&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Declare all the possible &amp;lt;td&amp;gt;/&amp;lt;th&amp;gt; tags here, and the return string&lt;br /&gt;
	local EpisodeNumber,EpisodeNumber2,Title,Aux1,DirectedBy,WrittenBy,&lt;br /&gt;
			DirectedBy,Aux2,Aux3,OriginalAirDate,AltDate,ProdCode,&lt;br /&gt;
			Viewers,Aux4,return_table&lt;br /&gt;
	&lt;br /&gt;
	-- Need just this parameter removed if blank, no others&lt;br /&gt;
	if args.ShortSummary then&lt;br /&gt;
		if not args.ShortSummary:find(&amp;#039;%S&amp;#039;) then&lt;br /&gt;
			args.ShortSummary = nil&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Default color to light blue&lt;br /&gt;
	local line_color = args.LineColor or &amp;#039;CCCCFF&amp;#039;&lt;br /&gt;
	&lt;br /&gt;
	-- Add # to color if necessary, and set to default color if invalid&lt;br /&gt;
	if HTMLcolor[line_color] == nil then&lt;br /&gt;
		line_color = &amp;#039;#&amp;#039;..(mw.ustring.match(line_color, &amp;#039;^[%s#]*([a-fA-F0-9]*)[%s]*$&amp;#039;) or &amp;#039;&amp;#039;)&lt;br /&gt;
		if line_color == &amp;#039;#&amp;#039; then&lt;br /&gt;
			line_color = &amp;#039;#CCCCFF&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- List of parameter names to test&lt;br /&gt;
	-- Keep this order as is&lt;br /&gt;
	local cell_names = {&lt;br /&gt;
		&amp;#039;EpisodeNumber2&amp;#039;,&lt;br /&gt;
		&amp;#039;Title&amp;#039;,&lt;br /&gt;
		&amp;#039;Aux1&amp;#039;,&lt;br /&gt;
		&amp;#039;DirectedBy&amp;#039;,&lt;br /&gt;
		&amp;#039;WrittenBy&amp;#039;,&lt;br /&gt;
		&amp;#039;Aux2&amp;#039;,&lt;br /&gt;
		&amp;#039;Aux3&amp;#039;,&lt;br /&gt;
		&amp;#039;OriginalAirDate&amp;#039;,&lt;br /&gt;
		&amp;#039;AltDate&amp;#039;,&lt;br /&gt;
		&amp;#039;ProdCode&amp;#039;,&lt;br /&gt;
		&amp;#039;Viewers&amp;#039;,&lt;br /&gt;
		&amp;#039;Aux4&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	-- Is there a way to call a variable by its name stored as a string? Doubt it&lt;br /&gt;
	-- This list matches strings with the table cell variables&lt;br /&gt;
	local td_tags = {&lt;br /&gt;
		[&amp;#039;EpisodeNumber2&amp;#039;] = EpisodeNumber2,&lt;br /&gt;
		[&amp;#039;Title&amp;#039;] = Title,&lt;br /&gt;
		[&amp;#039;Aux1&amp;#039;] = Aux1,&lt;br /&gt;
		[&amp;#039;DirectedBy&amp;#039;] = DirectedBy,&lt;br /&gt;
		[&amp;#039;WrittenBy&amp;#039;] = WrittenBy,&lt;br /&gt;
		[&amp;#039;DirectedBy&amp;#039;] = DirectedBy,&lt;br /&gt;
		[&amp;#039;Aux2&amp;#039;] = Aux2,&lt;br /&gt;
		[&amp;#039;Aux3&amp;#039;] = Aux3,&lt;br /&gt;
		[&amp;#039;OriginalAirDate&amp;#039;] = OriginalAirDate,&lt;br /&gt;
		[&amp;#039;AltDate&amp;#039;] = AltDate,&lt;br /&gt;
		[&amp;#039;ProdCode&amp;#039;] = ProdCode,&lt;br /&gt;
		[&amp;#039;Viewers&amp;#039;] = Viewers,&lt;br /&gt;
		[&amp;#039;Aux4&amp;#039;] = Aux4,&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	local table_row = mw.html.create(&amp;#039;tr&amp;#039;)&lt;br /&gt;
				:addClass(&amp;#039;vevent&amp;#039;)&lt;br /&gt;
				:css(&amp;#039;text-align&amp;#039;,&amp;#039;center&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	local row_color = yesno(args.RowColor, false)&lt;br /&gt;
	if args.RowColor and string.lower(args.RowColor) == &amp;#039;on&amp;#039; then&lt;br /&gt;
		row_color = true&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local top_color&lt;br /&gt;
	local epn = mm._cleanNumber(args.EpisodeNumber) or 1&lt;br /&gt;
	if args.TopColor then&lt;br /&gt;
		top_color = &amp;#039;#&amp;#039;..args.TopColor&lt;br /&gt;
	elseif row_color and not on_main_page and mm._mod(epn,2) == 0 then&lt;br /&gt;
		top_color = &amp;#039;#E9E9E9&amp;#039;&lt;br /&gt;
	elseif not on_main_page and args.ShortSummary then&lt;br /&gt;
		top_color = &amp;#039;#F2F2F2&amp;#039;&lt;br /&gt;
	else&lt;br /&gt;
		top_color = &amp;#039;inherit&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
		&lt;br /&gt;
	table_row:css(&amp;#039;background&amp;#039;,top_color)&lt;br /&gt;
	&lt;br /&gt;
	-- This will decide the colspan= of the summary cell&lt;br /&gt;
	-- Start as 1 because EpisodeNumber is always created&lt;br /&gt;
	local nonnil_params = 1&lt;br /&gt;
	&lt;br /&gt;
	-- Created separately because it is the only &amp;lt;th&amp;gt; tag&lt;br /&gt;
	&lt;br /&gt;
	if args.EpisodeNumber then&lt;br /&gt;
		if (args.EpisodeNumber == &amp;#039;&amp;#039;) then args.EpisodeNumber = frame:expandTemplate{title=&amp;#039;TableTBA&amp;#039;}; end&lt;br /&gt;
		EpisodeNumber = mw.html.create(&amp;#039;th&amp;#039;)&lt;br /&gt;
				:attr(&amp;#039;scope&amp;#039;,&amp;#039;row&amp;#039;)&lt;br /&gt;
				:attr(&amp;#039;id&amp;#039;,&amp;#039;ep&amp;#039;..idtrim(idtrim(args.EpisodeNumber,&amp;#039; ----&amp;#039;),&amp;#039;&amp;lt;&amp;#039;))&lt;br /&gt;
				:css(&amp;#039;text-align&amp;#039;,&amp;#039;center&amp;#039;)&lt;br /&gt;
				:wikitext(args.EpisodeNumber)&lt;br /&gt;
		table_row:css(&amp;#039;background&amp;#039;,top_color)&lt;br /&gt;
		table_row:node(EpisodeNumber)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- The wikitext in the Title cell is a little more involved than the others&lt;br /&gt;
	local function add_title()&lt;br /&gt;
		local title_string = &amp;#039;&amp;#039;&lt;br /&gt;
		&lt;br /&gt;
		-- Surround the Title with quotes; no quotes if empty&lt;br /&gt;
		if args.Title and args.Title:find(&amp;#039;%S&amp;#039;) then&lt;br /&gt;
			title_string = title_string..&amp;#039;&amp;quot;&amp;#039;..args.Title..&amp;#039;&amp;quot;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if args.RTitle then&lt;br /&gt;
			title_string = title_string..args.RTitle&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- Surround the AltTitle with quotes; no quotes if empty&lt;br /&gt;
		if args.AltTitle and args.AltTitle:find(&amp;#039;%S&amp;#039;) then&lt;br /&gt;
			title_string = title_string..&amp;#039;&amp;lt;br&amp;gt;&amp;quot;&amp;#039;..args.AltTitle..&amp;#039;&amp;quot;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
			&lt;br /&gt;
		if args.RAltTitle then&lt;br /&gt;
			title_string = title_string..args.RAltTitle&lt;br /&gt;
		end&lt;br /&gt;
		return title_string&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local categories = &amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	for _,v in ipairs(cell_names) do&lt;br /&gt;
		-- Title is in the middle, so it&amp;#039;s probably better to just switch back and again instead of doing 2 nodes&lt;br /&gt;
		-- and then title, and then the rest in a loop&lt;br /&gt;
		if v == &amp;#039;Title&amp;#039; then&lt;br /&gt;
			-- If Title is blank, then set Raw Title to TBA&lt;br /&gt;
			if args.Title == &amp;#039;&amp;#039; and (args.RTitle == &amp;#039;&amp;#039; or not args.RTitle) then args.RTitle = frame:expandTemplate{title=&amp;#039;TableTBA&amp;#039;}; end&lt;br /&gt;
			nonnil_params = nonnil_params + 1&lt;br /&gt;
			local title_text = add_title()&lt;br /&gt;
			td_tags[v] = mw.html.create(&amp;#039;td&amp;#039;)&lt;br /&gt;
			td_tags[v]:wikitext(title_text)&lt;br /&gt;
					:addClass(&amp;#039;summary&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;text-align&amp;#039;,&amp;#039;left&amp;#039;)&lt;br /&gt;
			table_row:node(td_tags[v])&lt;br /&gt;
		elseif args[v] then&lt;br /&gt;
			-- Air dates that don&amp;#039;t use {{Start date}}&lt;br /&gt;
			if v == &amp;#039;OriginalAirDate&amp;#039; and args[v] ~= &amp;#039;&amp;#039; and string.match(args[v], &amp;#039;%d%d%d%d&amp;#039;) ~= nil and string.find(args[v],&amp;#039;dtstart&amp;#039;) == nil and not on_main_page and title.namespace == 0 then&lt;br /&gt;
				categories = categories..&amp;#039;[[Category:Episode lists with unformatted air dates]]&amp;#039; &lt;br /&gt;
			end&lt;br /&gt;
			-- Alternate air dates that do use {{Start date}}&lt;br /&gt;
			if v == &amp;#039;AltDate&amp;#039; and args[v] ~= &amp;#039;&amp;#039; and string.find(args[v],&amp;#039;dtstart&amp;#039;) ~= nil and not on_main_page and title.namespace == 0 then&lt;br /&gt;
				categories = categories..&amp;#039;[[Category:Episode lists with incorrectly formatted alternate air dates]]&amp;#039; &lt;br /&gt;
			end&lt;br /&gt;
			-- Set empty cells to TBA/TBD&lt;br /&gt;
			if args[v] == &amp;#039;&amp;#039; then&lt;br /&gt;
				-- Set to N/A if viewers haven&amp;#039;t been available for four weeks, else set it as TBD&lt;br /&gt;
				if v == &amp;#039;Viewers&amp;#039; and args.OriginalAirDate and args.OriginalAirDate ~= &amp;#039;&amp;#039; then&lt;br /&gt;
					local month, day, year = args.OriginalAirDate:gsub(&amp;quot;&amp;amp;nbsp;&amp;quot;,&amp;quot; &amp;quot;):match(&amp;quot;(%a+) (%d+), (%d+)&amp;quot;)&lt;br /&gt;
					if month == nil then&lt;br /&gt;
						day, month, year = args.OriginalAirDate:gsub(&amp;quot;&amp;amp;nbsp;&amp;quot;,&amp;quot; &amp;quot;):match(&amp;quot;(%d+) (%a+) (%d+)&amp;quot;)&lt;br /&gt;
					end&lt;br /&gt;
					if day == nil then&lt;br /&gt;
						args[v] = frame:expandTemplate{title=&amp;#039;TableTBA&amp;#039;,args={&amp;#039;TBD&amp;#039;}};&lt;br /&gt;
					else&lt;br /&gt;
						local MONTHS = {January=1, February=2, March=3, April=4, May=5, June=6, July=7, August=8, September=9, October=10, November=11, December=12}&lt;br /&gt;
						local seconds = os.time()-os.time({year=year,month=MONTHS[month],day=day,hour=0,min=0,sec=0})&lt;br /&gt;
						if seconds &amp;gt;= 60*60*24*7*4 then args[v] = frame:expandTemplate{title=&amp;#039;TableTBA&amp;#039;,args={&amp;#039;N/A&amp;#039;}};&lt;br /&gt;
						else args[v] = frame:expandTemplate{title=&amp;#039;TableTBA&amp;#039;,args={&amp;#039;TBD&amp;#039;}}; end&lt;br /&gt;
					end&lt;br /&gt;
				else args[v] = frame:expandTemplate{title=&amp;#039;TableTBA&amp;#039;}; end&lt;br /&gt;
			end&lt;br /&gt;
			nonnil_params = nonnil_params + 1&lt;br /&gt;
			td_tags[v] = mw.html.create(&amp;#039;td&amp;#039;)&lt;br /&gt;
			td_tags[v]:wikitext(args[v])&lt;br /&gt;
			table_row:node(td_tags[v])&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Production code also has an additional attribute, so add it separately here&lt;br /&gt;
	if td_tags.ProdCode and args.ProdCode and (string.find(args.ProdCode,&amp;#039;TBA&amp;#039;) == nil) then&lt;br /&gt;
		td_tags.ProdCode:attr(&amp;#039;id&amp;#039;,&amp;#039;pc&amp;#039;..idtrim(idtrim(args.ProdCode,&amp;#039; ----&amp;#039;),&amp;#039;&amp;lt;&amp;#039;))&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- add these categories only in the mainspace and only if they are on the page where the template is used&lt;br /&gt;
	if not on_main_page and title.namespace == 0 then&lt;br /&gt;
		if args.LineColor and args.LineColor ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			local black_cr = contrast_ratio{args.LineColor, &amp;#039;black&amp;#039;, [&amp;#039;error&amp;#039;] = 0}&lt;br /&gt;
			local white_cr = contrast_ratio{&amp;#039;white&amp;#039;, args.LineColor, [&amp;#039;error&amp;#039;] = 0}&lt;br /&gt;
			if frame:expandTemplate{title=&amp;#039;ColorToLum&amp;#039;,args={args.LineColor}} == &amp;#039;&amp;#039; then&lt;br /&gt;
				categories = categories..&amp;#039;[[Category:Episode lists with faulty line colors]]&amp;#039; &lt;br /&gt;
			elseif black_cr &amp;lt; 7 and white_cr &amp;lt; 7 then&lt;br /&gt;
				categories = categories..&amp;#039;[[Category:Episode lists with non-compliant line colors]]&amp;#039; &lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			categories = categories..&amp;#039;[[Category:Episode list using the default LineColor]]&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if args.TopColor and args.TopColor ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			categories = categories..&amp;#039;[[Category:Episode lists with row deviations]]&amp;#039;&lt;br /&gt;
&lt;br /&gt;
			-- Track top colors that have a color contrast rating below AAA with&lt;br /&gt;
			-- respect to text color, link color, or visited link color. See&lt;br /&gt;
			-- [[WP:COLOR]] for more about color contrast requirements.&lt;br /&gt;
			local text_cr = contrast_ratio{args.TopColor, &amp;#039;black&amp;#039;, [&amp;#039;error&amp;#039;] = 0}&lt;br /&gt;
			local link_cr = contrast_ratio{args.TopColor, &amp;#039;#0B0080&amp;#039;, [&amp;#039;error&amp;#039;] = 0}&lt;br /&gt;
			local visited_link_cr = contrast_ratio{args.TopColor, &amp;#039;#0645AD&amp;#039;, [&amp;#039;error&amp;#039;] = 0}&lt;br /&gt;
			if text_cr &amp;lt; 7 or link_cr &amp;lt; 7 or visited_link_cr &amp;lt; 7 then&lt;br /&gt;
				categories = categories..&amp;#039;[[Category:Episode lists with invalid top colors]]&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Do not show the summary if this is being transcluded on the mainlist page&lt;br /&gt;
	-- Do include it on all other lists&lt;br /&gt;
	if not on_main_page and args.ShortSummary then&lt;br /&gt;
		local bottom_wrapper = mw.html.create(&amp;#039;tr&amp;#039;)&lt;br /&gt;
		-- fix for lists in the Short Summary&lt;br /&gt;
		local ss = args.ShortSummary&lt;br /&gt;
		if ss:match(&amp;#039;^[*:;#]&amp;#039;) or ss:match(&amp;#039;^{|&amp;#039;) then&lt;br /&gt;
			ss = &amp;#039;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;\n&amp;#039; .. ss&lt;br /&gt;
		end&lt;br /&gt;
		if ss:match(&amp;#039;\n[*:;#]&amp;#039;) then&lt;br /&gt;
			ss = ss .. &amp;#039;\n&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		local ShortSummary = mw.html.create(&amp;#039;td&amp;#039;)&lt;br /&gt;
					:addClass(&amp;#039;description&amp;#039;)&lt;br /&gt;
					:css(&amp;#039;border-bottom&amp;#039;,&amp;#039;solid 3px &amp;#039;..line_color)&lt;br /&gt;
					:attr(&amp;#039;colspan&amp;#039;,nonnil_params)&lt;br /&gt;
					:newline()&lt;br /&gt;
					:wikitext(ss)&lt;br /&gt;
		bottom_wrapper:node(ShortSummary)&lt;br /&gt;
		return tostring(table_row)..tostring(bottom_wrapper)..categories&lt;br /&gt;
	else&lt;br /&gt;
		return tostring(table_row)..categories&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Adminpeter</name></author>
	</entry>
</feed>