<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.filipefonseca.pt/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://wiki.filipefonseca.pt/index.php?action=history&amp;feed=atom&amp;title=Module%3AEpisode_list"/>
	<link rel="alternate" type="text/html" href="http://wiki.filipefonseca.pt/index.php?title=Module:Episode_list&amp;action=history"/>
	<updated>2026-04-18T21:23:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>http://wiki.filipefonseca.pt/index.php?title=Module:Episode_list&amp;diff=4874&amp;oldid=prev</id>
		<title>FilipeFonseca: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="http://wiki.filipefonseca.pt/index.php?title=Module:Episode_list&amp;diff=4874&amp;oldid=prev"/>
		<updated>2021-07-08T14:35:39Z</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;
-- This module requires the use of the following modules:&lt;br /&gt;
local colorContrastModule = require('Module:Color contrast')&lt;br /&gt;
local htmlColor = mw.loadData('Module:Color contrast/colors')&lt;br /&gt;
local delinkModule = require('Module:Delink')&lt;br /&gt;
local langModule = require(&amp;quot;Module:Lang&amp;quot;)&lt;br /&gt;
local mathModule = require('Module:Math')&lt;br /&gt;
local tableEmptyCellModule = require('Module:Table empty cell')&lt;br /&gt;
local yesNoModule = require('Module:Yesno')&lt;br /&gt;
&lt;br /&gt;
-- mw.html object for the generated row.&lt;br /&gt;
local row&lt;br /&gt;
&lt;br /&gt;
-- Variable that will decide the colspan= of the Short Summary cell.&lt;br /&gt;
local nonNilParams = 0&lt;br /&gt;
&lt;br /&gt;
-- Variable that will keep track if a TBA value was entered.&lt;br /&gt;
local cellValueTBA = false&lt;br /&gt;
&lt;br /&gt;
-- Variable that handles the assigned tracking categories.&lt;br /&gt;
local trackingCategories = &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-- List of tracking categories.&lt;br /&gt;
local trackingCategoryList = {&lt;br /&gt;
	[&amp;quot;air_dates&amp;quot;] = &amp;quot;[[Category:Episode lists with unformatted air dates]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;alt_air_dates&amp;quot;] = &amp;quot;[[Category:Episode lists with incorrectly formatted alternate air dates]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;faulty_line_colors&amp;quot;] = &amp;quot;[[Category:Episode lists with faulty line colors]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;non_compliant_line_colors&amp;quot;] = &amp;quot;[[Category:Episode lists with non-compliant line colors]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;default_line_colors&amp;quot;] = &amp;quot;[[Category:Episode list using the default LineColor]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;row_deviations&amp;quot;] = &amp;quot;[[Category:Episode lists with row deviations]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;invalid_top_colors&amp;quot;] = &amp;quot;[[Category:Episode lists with invalid top colors]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;tba_values&amp;quot;] = &amp;quot;[[Category:Episode lists with TBA values]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;nonmatching_numbered_parameters&amp;quot;] = &amp;quot;[[Category:Episode lists with a non-matching set of numbered parameters]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;raw_unformatted_storyteleplay&amp;quot;] = &amp;quot;[[Category:Episode lists with unformatted story or teleplay credits]]&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- List of parameter names in this order.&lt;br /&gt;
local cellNameList = {&lt;br /&gt;
	'Aux1',&lt;br /&gt;
	'DirectedBy',&lt;br /&gt;
	'WrittenBy',&lt;br /&gt;
	'Aux2',&lt;br /&gt;
	'Aux3',&lt;br /&gt;
	'OriginalAirDate',&lt;br /&gt;
	'AltDate',&lt;br /&gt;
	'Guests',&lt;br /&gt;
	'MusicalGuests',&lt;br /&gt;
	'ProdCode',&lt;br /&gt;
	'Viewers',&lt;br /&gt;
	'Aux4'&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- List of pairs which cannot be used together&lt;br /&gt;
local excludeList = {&lt;br /&gt;
	['Guests'] = 'Aux1',&lt;br /&gt;
	['MusicalGuests'] = 'Aux2'&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- List of cells that have parameter groups&lt;br /&gt;
local parameterGroupCells = {}&lt;br /&gt;
local firstParameterGroupCell&lt;br /&gt;
&lt;br /&gt;
-- List of title parameter names in this order.&lt;br /&gt;
-- List used for multi title lists.&lt;br /&gt;
local titleList = {&lt;br /&gt;
	'Title',&lt;br /&gt;
	'RTitle',&lt;br /&gt;
	'AltTitle',&lt;br /&gt;
	'RAltTitle',&lt;br /&gt;
	'NativeTitle',&lt;br /&gt;
	'TranslitTitle',&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to retrieve the episode number or production code number,&lt;br /&gt;
-- without any additional text.&lt;br /&gt;
local function idTrim(val, search)&lt;br /&gt;
	local valFind = string.find(val, search)&lt;br /&gt;
&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;
-- Local function which is used to validate that a parameter has an actual value.&lt;br /&gt;
local function hasValue(param)&lt;br /&gt;
	if (param ~= nil and param ~= &amp;quot;&amp;quot;) then&lt;br /&gt;
		return true&lt;br /&gt;
	else&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create a table data cell.&lt;br /&gt;
local function createTableData(text, rowSpan, textAlign)&lt;br /&gt;
	if (rowSpan ~= nil and tonumber(rowSpan) &amp;gt; 1) then&lt;br /&gt;
		row:tag('td')&lt;br /&gt;
			:attr('rowspan', rowSpan)&lt;br /&gt;
			:wikitext(text)&lt;br /&gt;
	else&lt;br /&gt;
		row:tag('td')&lt;br /&gt;
			:css('text-align', textAlign)&lt;br /&gt;
			:wikitext(text)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to add a tracking category to the page.&lt;br /&gt;
local function addTrackingCategory(category)&lt;br /&gt;
	trackingCategories = trackingCategories .. category&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create a Short Summary row.&lt;br /&gt;
local function createShortSummaryRow(args, lineColor)&lt;br /&gt;
	-- fix for lists in the Short Summary&lt;br /&gt;
	local shortSummaryText = args.ShortSummary&lt;br /&gt;
&lt;br /&gt;
	if (shortSummaryText:match('^[*:;#]') or shortSummaryText:match('^{|')) then&lt;br /&gt;
		shortSummaryText = '&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;\n' .. shortSummaryText&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (shortSummaryText:match('\n[*:;#]')) then&lt;br /&gt;
		shortSummaryText = shortSummaryText .. '\n&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local shortSummaryCell = mw.html.create('td')&lt;br /&gt;
				:addClass('description')&lt;br /&gt;
				:css('border-bottom', 'solid 3px ' .. lineColor)&lt;br /&gt;
				:attr('colspan', nonNilParams)&lt;br /&gt;
				:newline()&lt;br /&gt;
				:wikitext(shortSummaryText)&lt;br /&gt;
&lt;br /&gt;
	return mw.html.create('tr')&lt;br /&gt;
					:addClass('expand-child')&lt;br /&gt;
					:node(shortSummaryCell)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to add tracking categories for Top Color issues.&lt;br /&gt;
local function addTopColorTrackingCategories(args)&lt;br /&gt;
	if (hasValue(args.TopColor)) then&lt;br /&gt;
		addTrackingCategory(trackingCategoryList[&amp;quot;row_deviations&amp;quot;])&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 textContrastRatio = colorContrastModule._ratio{args.TopColor, 'black', ['error'] = 0}&lt;br /&gt;
		local linkContrastRatio = colorContrastModule._ratio{args.TopColor, '#0B0080', ['error'] = 0}&lt;br /&gt;
		local visitedLinkContrastRatio = colorContrastModule._ratio{args.TopColor, '#0645AD', ['error'] = 0}&lt;br /&gt;
&lt;br /&gt;
		if (textContrastRatio &amp;lt; 7 or linkContrastRatio &amp;lt; 7 or visitedLinkContrastRatio &amp;lt; 7) then&lt;br /&gt;
			addTrackingCategory(trackingCategoryList[&amp;quot;invalid_top_colors&amp;quot;])&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to add tracking categories for Line Color issues.&lt;br /&gt;
local function addLineColorTrackingCategories(args)&lt;br /&gt;
	if (hasValue(args.LineColor)) then&lt;br /&gt;
		local blackContrastRatio = colorContrastModule._ratio{args.LineColor, 'black', ['error'] = 0}&lt;br /&gt;
		local whiteContrastRatio = colorContrastModule._ratio{'white', args.LineColor, ['error'] = 0}&lt;br /&gt;
&lt;br /&gt;
		if (colorContrastModule._lum(args.LineColor) == '') then&lt;br /&gt;
			addTrackingCategory(trackingCategoryList[&amp;quot;faulty_line_colors&amp;quot;])&lt;br /&gt;
		elseif (blackContrastRatio &amp;lt; 7 and whiteContrastRatio &amp;lt; 7) then&lt;br /&gt;
			addTrackingCategory(trackingCategoryList[&amp;quot;non_compliant_line_colors&amp;quot;])&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		addTrackingCategory(trackingCategoryList[&amp;quot;default_line_colors&amp;quot;])&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to remove wiki-links from repated information in rowspans.&lt;br /&gt;
-- Used for Doctor Who serials, where the director and writer are the same for each part of serial.&lt;br /&gt;
local function removeWikilinks(args, v)&lt;br /&gt;
	return delinkModule._delink{args[v]}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to set the text of an empty cell&lt;br /&gt;
-- with either &amp;quot;TBD&amp;quot; or &amp;quot;N/A&amp;quot;.&lt;br /&gt;
-- Set to N/A if viewers haven't been available for four weeks, else set it as TBD.&lt;br /&gt;
local function setTBDStatus(args)&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;
&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;
&lt;br /&gt;
	if (day == nil) then&lt;br /&gt;
		return tableEmptyCellModule._main({alt_text = &amp;quot;TBD&amp;quot;})&lt;br /&gt;
	else&lt;br /&gt;
		-- List of months.&lt;br /&gt;
		local monthList = {&lt;br /&gt;
			['January'] = 1,&lt;br /&gt;
			['February'] = 2,&lt;br /&gt;
			['March'] = 3,&lt;br /&gt;
			['April'] = 4,&lt;br /&gt;
			['May'] = 5,&lt;br /&gt;
			['June'] = 6,&lt;br /&gt;
			['July'] = 7,&lt;br /&gt;
			['August'] = 8,&lt;br /&gt;
			['September'] = 9,&lt;br /&gt;
			['October'] = 10,&lt;br /&gt;
			['November'] = 11,&lt;br /&gt;
			['December'] = 12&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		if not monthList[month] then&lt;br /&gt;
			error('Invalid month ' .. month)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		local seconds = os.time() - os.time({year = year, month = monthList[month], day = day, hour = 0, min = 0, sec = 0})&lt;br /&gt;
&lt;br /&gt;
		if (seconds &amp;gt;= 60 * 60 * 24 * 7 * 4) then&lt;br /&gt;
			return tableEmptyCellModule._main({alt_text = &amp;quot;N/A&amp;quot;})&lt;br /&gt;
		else&lt;br /&gt;
			return tableEmptyCellModule._main({alt_text = &amp;quot;TBD&amp;quot;})&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create an empty cell.&lt;br /&gt;
local function createEmptyCell(args, v, unsetParameterGroup)&lt;br /&gt;
	if (unsetParameterGroup) then&lt;br /&gt;
		args[v] = tableEmptyCellModule._main({alt_text = &amp;quot;N/A&amp;quot;})&lt;br /&gt;
	elseif (v == 'Viewers' and hasValue(args.OriginalAirDate)) then&lt;br /&gt;
		args[v] = setTBDStatus(args)&lt;br /&gt;
	else&lt;br /&gt;
		args[v] = tableEmptyCellModule._main({})&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Air dates that don't use {{Start date}}&lt;br /&gt;
local function checkUsageOfDateTemplates(args, v, onInitialPage, title)&lt;br /&gt;
	if (v == 'OriginalAirDate'&lt;br /&gt;
		and args[v] ~= ''&lt;br /&gt;
		and string.match(args[v], '%d%d%d%d') ~= nil&lt;br /&gt;
		and string.match(args[v], '2C2C2C') == nil&lt;br /&gt;
		and string.find(args[v], 'dtstart') == nil&lt;br /&gt;
		and onInitialPage&lt;br /&gt;
		and title.namespace == 0)&lt;br /&gt;
	then&lt;br /&gt;
		addTrackingCategory(trackingCategoryList[&amp;quot;air_dates&amp;quot;])&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Alternate air dates that do use {{Start date}}&lt;br /&gt;
	if (v == 'AltDate' and args[v] ~= '' and string.find(args[v], 'dtstart') ~= nil and onInitialPage and title.namespace == 0) then&lt;br /&gt;
		addTrackingCategory(trackingCategoryList[&amp;quot;alt_air_dates&amp;quot;])&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create a Production Code cell.&lt;br /&gt;
local function createProductionCodeCell(args, v)&lt;br /&gt;
	if (hasValue(args.ProdCode) and string.find(args.ProdCode, 'TBA') == nil) then&lt;br /&gt;
		row:tag('td')&lt;br /&gt;
			:attr('id', 'pc' .. idTrim(idTrim(args.ProdCode, ' ----'), '&amp;lt;'))&lt;br /&gt;
			:css('text-align', 'center')&lt;br /&gt;
			:wikitext(args.ProdCode)&lt;br /&gt;
	elseif (args.ProdCode == '' or string.find(args.ProdCode or '', 'TBA') ~= nil) then&lt;br /&gt;
		createEmptyCell(args, v, false)&lt;br /&gt;
		createTableData(args.ProdCode, 1, &amp;quot;center&amp;quot;)&lt;br /&gt;
	else&lt;br /&gt;
		-- ProductionCode parameter not used; Do nothing.&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	nonNilParams = nonNilParams + 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local function which is used to extract data&lt;br /&gt;
from the numbered serial parameters (Title1, Aux1, etc.), and then convert them to&lt;br /&gt;
use the non-numbered parameter names (Title, Aux).&lt;br /&gt;
&lt;br /&gt;
The function returns the args as non-numbered prameter names.&lt;br /&gt;
]]--&lt;br /&gt;
local function extractDataFromNumberedSerialArgs(args, i, numberOfParameterGroups, title)&lt;br /&gt;
	for _, v in ipairs(cellNameList) do&lt;br /&gt;
		local parameter = v&lt;br /&gt;
		local numberedParameter = v .. &amp;quot;_&amp;quot; .. i&lt;br /&gt;
		local excludeParameter = excludeList[parameter] or 'NULL' .. parameter&lt;br /&gt;
		local excludeNumberParameter = (excludeList[numberedParameter] or 'NULL' .. parameter) .. &amp;quot;_&amp;quot; .. i&lt;br /&gt;
		if (not hasValue(args[numberedParameter]) and not hasValue(args[excludeNumberParameter])&lt;br /&gt;
			and hasValue(parameterGroupCells[parameter]) and not hasValue(args[excludeParameter])) then&lt;br /&gt;
			if (v ~= 'ProdCode') then&lt;br /&gt;
				createEmptyCell(args, parameter, true)&lt;br /&gt;
			else&lt;br /&gt;
				args[parameter] = ''&lt;br /&gt;
			end&lt;br /&gt;
			if (title.namespace == 0) then&lt;br /&gt;
				addTrackingCategory(trackingCategoryList[&amp;quot;nonmatching_numbered_parameters&amp;quot;])&lt;br /&gt;
			end&lt;br /&gt;
		elseif (hasValue(args[numberedParameter]) and not  hasValue(args[excludeNumberParameter])) then&lt;br /&gt;
			args[parameter] = args[numberedParameter]&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return args&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local function which is used to create column cells.&lt;br /&gt;
&lt;br /&gt;
EpisodeNumber, EpisodeNumber2 and Title are created in different functions&lt;br /&gt;
as they require some various if checks.&lt;br /&gt;
&lt;br /&gt;
See:&lt;br /&gt;
	-- createEpisodeNumberCell()&lt;br /&gt;
	-- createEpisodeNumberCellSecondary()&lt;br /&gt;
	-- createTitleCell()&lt;br /&gt;
]]--&lt;br /&gt;
local function createCells(args, isSerial, currentRow, onInitialPage, title, numberOfParameterGroups)&lt;br /&gt;
	for k, v in ipairs(cellNameList) do&lt;br /&gt;
		if (v == 'ProdCode') then&lt;br /&gt;
			createProductionCodeCell(args, v)&lt;br /&gt;
		elseif (args[v]) then&lt;br /&gt;
			-- Set empty cells to TBA/TBD&lt;br /&gt;
			if (args[v] == '') then&lt;br /&gt;
				createEmptyCell(args, v, false)&lt;br /&gt;
			elseif (v == 'WrittenBy' and title.namespace == 0) then&lt;br /&gt;
				if ((string.find(args[v], &amp;quot;''Story&amp;quot;) ~= nil or string.find(args[v], &amp;quot;''Teleplay&amp;quot;) ~= nil) and string.find(args[v], &amp;quot;8202&amp;quot;) == nil) then&lt;br /&gt;
					-- &amp;amp;#8202; is the hairspace added through {{StoryTeleplay}}&lt;br /&gt;
					addTrackingCategory(trackingCategoryList[&amp;quot;raw_unformatted_storyteleplay&amp;quot;])&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			-- If serial titles need to be centered and not left, then this should be removed.&lt;br /&gt;
			local textAlign = &amp;quot;center&amp;quot;&lt;br /&gt;
			if (v == 'Aux1' and isSerial) then&lt;br /&gt;
				textAlign = &amp;quot;left&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			-- Remove wikilinks from links in serial rowspans rows after the first.&lt;br /&gt;
			-- if (currentRow &amp;gt; 1) then&lt;br /&gt;
				-- args[v] = removeWikilinks(args, v)&lt;br /&gt;
			-- end&lt;br /&gt;
&lt;br /&gt;
			local thisRowspan&lt;br /&gt;
			if (firstParameterGroupCell and k &amp;lt; firstParameterGroupCell) then&lt;br /&gt;
				thisRowspan = numberOfParameterGroups&lt;br /&gt;
			else&lt;br /&gt;
				thisRowspan = 1&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if (currentRow == 1 or (currentRow &amp;gt; 1 and k &amp;gt;= (firstParameterGroupCell or 0))) then&lt;br /&gt;
				createTableData(args[v], thisRowspan, textAlign)&lt;br /&gt;
			end&lt;br /&gt;
			nonNilParams = nonNilParams + 1&lt;br /&gt;
			checkUsageOfDateTemplates(args, v, onInitialPage, title)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if (args[v] == &amp;quot;TBA&amp;quot;) then&lt;br /&gt;
			cellValueTBA = true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local function which is used to create the Title cell text.&lt;br /&gt;
&lt;br /&gt;
The title text will be handled in the following way:&lt;br /&gt;
	Line 1: &amp;lt;Title&amp;gt;&amp;lt;RTitle&amp;gt; (with no space between)&lt;br /&gt;
	Line 2: &amp;lt;AltTitle&amp;gt;&amp;lt;RAltTitle&amp;gt; (with no space between) OR&lt;br /&gt;
	Line 2: Transcription: &amp;lt;TranslitTitle&amp;gt; (&amp;lt;Language&amp;gt;: &amp;lt;NativeTitle&amp;gt;)&amp;lt;RAltTitle&amp;gt; (with space between first two parameters)&lt;br /&gt;
&lt;br /&gt;
	If &amp;lt;Title&amp;gt; or &amp;lt;RTitle&amp;gt; are empty,&lt;br /&gt;
	then the values of line 2 will be placed on line 1 instead.&lt;br /&gt;
&lt;br /&gt;
--]]&lt;br /&gt;
local function createTitleText(args)&lt;br /&gt;
	local titleString = ''&lt;br /&gt;
	local isCellPresent = false&lt;br /&gt;
	local useSecondLine = false&lt;br /&gt;
	local lineBreakUsed = false&lt;br /&gt;
&lt;br /&gt;
	-- Surround the Title with quotes; No quotes if empty.&lt;br /&gt;
	if (args.Title ~= nil) then&lt;br /&gt;
		if (args.Title == &amp;quot;&amp;quot;) then&lt;br /&gt;
			isCellPresent = true&lt;br /&gt;
		else&lt;br /&gt;
			titleString = '&amp;quot;' .. args.Title .. '&amp;quot;'&lt;br /&gt;
			useSecondLine = true&lt;br /&gt;
			isCellPresent = true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (args.RTitle ~= nil) then&lt;br /&gt;
		if (args.RTitle == &amp;quot;&amp;quot;) then&lt;br /&gt;
			isCellPresent = true&lt;br /&gt;
		else&lt;br /&gt;
			titleString = titleString .. args.RTitle&lt;br /&gt;
			useSecondLine = true&lt;br /&gt;
			isCellPresent = true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Surround the AltTitle/TranslitTitle with quotes; No quotes if empty.&lt;br /&gt;
	if (args.AltTitle or args.TranslitTitle) then&lt;br /&gt;
&lt;br /&gt;
		isCellPresent = true&lt;br /&gt;
&lt;br /&gt;
		if (useSecondLine) then&lt;br /&gt;
			titleString = titleString .. &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;&lt;br /&gt;
			lineBreakUsed = true&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if (hasValue(args.AltTitle)) then&lt;br /&gt;
			titleString = titleString .. '&amp;quot;' .. args.AltTitle .. '&amp;quot;'&lt;br /&gt;
		elseif (hasValue(args.TranslitTitle)) then&lt;br /&gt;
			if (hasValue(args.NativeTitleLangCode)) then&lt;br /&gt;
				titleString = titleString .. 'Transcription: &amp;quot;' .. langModule._transl({args.NativeTitleLangCode, args.TranslitTitle, italic = 'no'})  .. '&amp;quot;'&lt;br /&gt;
			else&lt;br /&gt;
				titleString = titleString .. 'Transcription: &amp;quot;' .. args.TranslitTitle .. '&amp;quot;'&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (args.NativeTitle ~= nil) then&lt;br /&gt;
		if (args.NativeTitle == &amp;quot;&amp;quot;) then&lt;br /&gt;
			isCellPresent = true&lt;br /&gt;
		else&lt;br /&gt;
			isCellPresent = true&lt;br /&gt;
&lt;br /&gt;
			if (useSecondLine and lineBreakUsed == false) then&lt;br /&gt;
				titleString = titleString .. &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if (hasValue(args.NativeTitleLangCode)) then&lt;br /&gt;
				local languageCode = &amp;quot;Lang-&amp;quot; .. args.NativeTitleLangCode&lt;br /&gt;
				titleString = titleString .. &amp;quot; (&amp;quot; .. langModule._lang_xx_inherit({code = args.NativeTitleLangCode, args.NativeTitle}) .. &amp;quot;)&amp;quot;&lt;br /&gt;
			else&lt;br /&gt;
				titleString = titleString .. &amp;quot; (&amp;quot; .. args.NativeTitle .. &amp;quot;)&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (args.RAltTitle ~= nil) then&lt;br /&gt;
		if (args.RAltTitle == &amp;quot;&amp;quot;) then&lt;br /&gt;
			isCellPresent = true&lt;br /&gt;
		else&lt;br /&gt;
			isCellPresent = true&lt;br /&gt;
&lt;br /&gt;
			if (useSecondLine and lineBreakUsed == false) then&lt;br /&gt;
				titleString = titleString .. &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			titleString = titleString .. args.RAltTitle&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return titleString, isCellPresent&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local function which is used to extract data&lt;br /&gt;
from the numbered title parameters (Title1, RTitle2, etc.), and then convert them to&lt;br /&gt;
use the non-numbered prameter names (Title, RTitle).&lt;br /&gt;
&lt;br /&gt;
The function returns two results:&lt;br /&gt;
	-- The args parameter table.&lt;br /&gt;
	-- A boolean indicating if the title group has data.&lt;br /&gt;
]]--&lt;br /&gt;
local function extractDataFromNumberedTitleArgs(args, i)&lt;br /&gt;
	local nextGroupValid = false&lt;br /&gt;
&lt;br /&gt;
	for _, v in ipairs(titleList) do&lt;br /&gt;
		local parameter = v&lt;br /&gt;
		local numberedParameter = v .. &amp;quot;_&amp;quot; .. i&lt;br /&gt;
		args[parameter] = args[numberedParameter]&lt;br /&gt;
&lt;br /&gt;
		if (nextGroupValid == false and hasValue(args[numberedParameter])) then&lt;br /&gt;
			nextGroupValid = true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return args, nextGroupValid&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to process the multi title list.&lt;br /&gt;
local function processMultiTitleList(args, numberOfParameterGroups)&lt;br /&gt;
	local nativeTitleLangCode = args.NativeTitleLangCode&lt;br /&gt;
	local titleText = &amp;quot;&amp;quot;&lt;br /&gt;
	local isCellPresent = false&lt;br /&gt;
	local isFirstTitleGroup = true -- Making sure that the title cell is created at least once and isn't created again if other #N titles are empty.&lt;br /&gt;
&lt;br /&gt;
	for i = 1, numberOfParameterGroups do&lt;br /&gt;
		local args, nextGroupValid = extractDataFromNumberedTitleArgs(args, i)&lt;br /&gt;
		if (nextGroupValid) then&lt;br /&gt;
			if (isFirstTitleGroup == false) then&lt;br /&gt;
				titleText = titleText .. &amp;quot;&amp;lt;hr /&amp;gt;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			local titleTextRow&lt;br /&gt;
			titleTextRow = createTitleText(args)&lt;br /&gt;
			titleText = titleText .. titleTextRow&lt;br /&gt;
			isFirstTitleGroup = false&lt;br /&gt;
		else&lt;br /&gt;
			if (isFirstTitleGroup) then&lt;br /&gt;
				titleText, isCellPresent = createTitleText(args)&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			-- Valid titles have to be in succession (#1, #2, #3 and not #1, #4 #5), so exit for loop if next group is empty.&lt;br /&gt;
			return titleText, isCellPresent&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return titleText&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create a Title cell.&lt;br /&gt;
local function createTitleCell(args, numberOfParameterGroups, multiTitleListEnabled, isSerial)&lt;br /&gt;
	local titleText&lt;br /&gt;
	local isCellPresent&lt;br /&gt;
&lt;br /&gt;
	if (multiTitleListEnabled) then&lt;br /&gt;
		titleText, isCellPresent = processMultiTitleList(args, numberOfParameterGroups)&lt;br /&gt;
	else&lt;br /&gt;
		titleText, isCellPresent = createTitleText(args)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (isCellPresent == false) then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local textAlign = &amp;quot;left&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	-- If Title is blank, then set Raw Title to TBA&lt;br /&gt;
	if (hasValue(titleText) == false) then&lt;br /&gt;
		titleText = tableEmptyCellModule._main({})&lt;br /&gt;
		textAlign = &amp;quot;left&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- If title is the first cell, create it with a !scope=&amp;quot;row&amp;quot;&lt;br /&gt;
	if (nonNilParams == 0) then&lt;br /&gt;
		if (isSerial) then&lt;br /&gt;
			row:tag('th')&lt;br /&gt;
				:addClass('summary')&lt;br /&gt;
				:attr('scope', 'row')&lt;br /&gt;
				:attr('rowspan', numberOfParameterGroups)&lt;br /&gt;
				:css('text-align', textAlign)&lt;br /&gt;
				:wikitext(titleText)&lt;br /&gt;
		else&lt;br /&gt;
			row:tag('th')&lt;br /&gt;
				:addClass('summary')&lt;br /&gt;
				:attr('scope', 'row')&lt;br /&gt;
				:css('text-align', textAlign)&lt;br /&gt;
				:wikitext(titleText)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		if (isSerial) then&lt;br /&gt;
			row:tag('td')&lt;br /&gt;
				:addClass('summary')&lt;br /&gt;
				:attr('rowspan', numberOfParameterGroups)&lt;br /&gt;
				:css('text-align', textAlign)&lt;br /&gt;
				:wikitext(titleText)&lt;br /&gt;
		else&lt;br /&gt;
			row:tag('td')&lt;br /&gt;
				:addClass('summary')&lt;br /&gt;
				:css('text-align', textAlign)&lt;br /&gt;
				:wikitext(titleText)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	nonNilParams = nonNilParams + 1&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create a table row header for either the&lt;br /&gt;
-- EpisodeNumber or EpisodeNumber2 column cells.&lt;br /&gt;
local function createTableRowEpisodeNumberHeader(episodeNumber, numberOfParameterGroups, episodeText)&lt;br /&gt;
		local epID = string.match(episodeNumber, &amp;quot;^%w+&amp;quot;)&lt;br /&gt;
		row:tag('th')&lt;br /&gt;
			:attr('scope', 'row')&lt;br /&gt;
			:attr('rowspan', numberOfParameterGroups)&lt;br /&gt;
			:attr('id', epID and 'ep' .. epID or '')&lt;br /&gt;
			:css('text-align', 'center')&lt;br /&gt;
			:wikitext(episodeText)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local function which is used to extract the text from the EpisodeNumber or EpisodeNumber2&lt;br /&gt;
parameters and format them into a correct MoS compliant version.&lt;br /&gt;
&lt;br /&gt;
Styles supported:&lt;br /&gt;
	-- A number range of two numbers, indicating the start and end of the range,&lt;br /&gt;
	seperated by an en-dash (–) with no spaces in between.&lt;br /&gt;
		Example: &amp;quot;1 - 2&amp;quot; -&amp;gt; &amp;quot;1–2&amp;quot;; &amp;quot;1-2-3&amp;quot; -&amp;gt; &amp;quot;1–3&amp;quot;.&lt;br /&gt;
	-- An alphanumeric or letter range, similar to the above.&lt;br /&gt;
		Example: &amp;quot;A - B&amp;quot; -&amp;gt; &amp;quot;A–B&amp;quot;; &amp;quot;A-B-C&amp;quot; -&amp;gt; &amp;quot;A–C&amp;quot;.&lt;br /&gt;
		Example: &amp;quot;A1 - B1&amp;quot; -&amp;gt; &amp;quot;A1–B1&amp;quot;; &amp;quot;A1-B1-C1&amp;quot; -&amp;gt; &amp;quot;A1–C1&amp;quot;.&lt;br /&gt;
	-- A number range of two numbers, indicating the start and end of the range,&lt;br /&gt;
	seperated by a visual &amp;lt;hr /&amp;gt; (divider line).&lt;br /&gt;
	-- An alphanumeric or letter range, similar to the above.&lt;br /&gt;
]]--&lt;br /&gt;
local function getEpisodeText(episodeNumber)&lt;br /&gt;
	if (episodeNumber == '') then&lt;br /&gt;
		return tableEmptyCellModule._main({})&lt;br /&gt;
	else&lt;br /&gt;
&lt;br /&gt;
		local episodeNumber1&lt;br /&gt;
		local episodeNumber2&lt;br /&gt;
&lt;br /&gt;
		-- Used for double episodes that need a visual &amp;quot;–&amp;quot;&amp;quot; or &amp;quot;&amp;lt;hr /&amp;gt;&amp;quot;&amp;quot; added.&lt;br /&gt;
		local divider&lt;br /&gt;
&lt;br /&gt;
		episodeNumber = episodeNumber:gsub('%s*&amp;lt;br%s*/?%s*&amp;gt;%s*', '&amp;lt;hr /&amp;gt;')&lt;br /&gt;
&lt;br /&gt;
		if (episodeNumber:match('^(%w+)%s*&amp;lt;hr */%s*&amp;gt;%s*(%w+)$')) then&lt;br /&gt;
			episodeNumber1, episodeNumber2 = episodeNumber:match('^(%w+)%s*&amp;lt;hr */%s*&amp;gt;%s*(%w+)$')&lt;br /&gt;
			divider = &amp;quot;&amp;lt;hr /&amp;gt;&amp;quot;&lt;br /&gt;
		elseif (episodeNumber:match('^(%w+)%s*&amp;lt;hr */%s*&amp;gt;.-&amp;lt;hr */%s*&amp;gt;%s*(%w+)$')) then  -- 3 or more elements&lt;br /&gt;
			episodeNumber1, episodeNumber2 = episodeNumber:match('^(%w+)%s*&amp;lt;hr */%s*&amp;gt;.-&amp;lt;hr */%s*&amp;gt;%s*(%w+)$')&lt;br /&gt;
			divider = &amp;quot;&amp;lt;hr /&amp;gt;&amp;quot;&lt;br /&gt;
		elseif (mw.ustring.match(episodeNumber, '^(%w+)%s*[%s%-–/&amp;amp;]%s*(%w+)$')) then&lt;br /&gt;
			episodeNumber1, episodeNumber2 = mw.ustring.match(episodeNumber, '^(%w+)%s*[%s%-–/&amp;amp;]%s*(%w+)$')&lt;br /&gt;
			divider = &amp;quot;–&amp;quot;&lt;br /&gt;
		else&lt;br /&gt;
			episodeNumber1, episodeNumber2 = mw.ustring.match(episodeNumber, '^(%w+)%s*[%s%-–/&amp;amp;].-[%s%-–/&amp;amp;]%s*(%w+)$')  -- 3 or more elements&lt;br /&gt;
			divider = &amp;quot;–&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if (not episodeNumber1) then&lt;br /&gt;
			return episodeNumber&lt;br /&gt;
		elseif (not episodeNumber2) then&lt;br /&gt;
			return string.match(episodeNumber, '%w+')&lt;br /&gt;
		else&lt;br /&gt;
			return episodeNumber1 .. divider .. episodeNumber2&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create EpisodeNumber2 and EpisodeNumber3 cells.&lt;br /&gt;
local function _createEpisodeNumberCellSecondary(episodeValue, numberOfParameterGroups)&lt;br /&gt;
	if (episodeValue) then&lt;br /&gt;
		local episodeText = getEpisodeText(episodeValue)&lt;br /&gt;
&lt;br /&gt;
		if (nonNilParams == 0) then&lt;br /&gt;
			createTableRowEpisodeNumberHeader(episodeValue, numberOfParameterGroups, episodeText)&lt;br /&gt;
		else&lt;br /&gt;
			createTableData(episodeText, numberOfParameterGroups, &amp;quot;center&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		nonNilParams = nonNilParams + 1&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create seconday episode number cells.&lt;br /&gt;
local function createEpisodeNumberCellSecondary(args, numberOfParameterGroups)&lt;br /&gt;
	_createEpisodeNumberCellSecondary(args.EpisodeNumber2, numberOfParameterGroups)&lt;br /&gt;
	_createEpisodeNumberCellSecondary(args.EpisodeNumber3, numberOfParameterGroups)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create an EpisodeNumber cell.&lt;br /&gt;
local function createEpisodeNumberCell(args, numberOfParameterGroups)&lt;br /&gt;
	if (args.EpisodeNumber) then&lt;br /&gt;
		local episodeText = getEpisodeText(args.EpisodeNumber)&lt;br /&gt;
		createTableRowEpisodeNumberHeader(args.EpisodeNumber, numberOfParameterGroups, episodeText)&lt;br /&gt;
		nonNilParams = nonNilParams + 1&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create a single row of cells.&lt;br /&gt;
-- This is the standard function called.&lt;br /&gt;
local function createSingleRowCells(args, numberOfParameterGroups, multiTitleListEnabled, onInitialPage, title)&lt;br /&gt;
	createEpisodeNumberCell(args, 1)&lt;br /&gt;
	createEpisodeNumberCellSecondary(args, 1)&lt;br /&gt;
	createTitleCell(args, numberOfParameterGroups, multiTitleListEnabled, false)&lt;br /&gt;
	createCells(args, false, 1, onInitialPage, title, numberOfParameterGroups)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to create a multiple row of cells.&lt;br /&gt;
-- This function is called when part of the row is rowspaned.&lt;br /&gt;
-- Current use is for Doctor Who serials.&lt;br /&gt;
local function createMultiRowCells(args, numberOfParameterGroups, onInitialPage, title, topColor)&lt;br /&gt;
	createEpisodeNumberCell(args, numberOfParameterGroups)&lt;br /&gt;
	createEpisodeNumberCellSecondary(args, numberOfParameterGroups)&lt;br /&gt;
	createTitleCell(args, numberOfParameterGroups, false, true)&lt;br /&gt;
&lt;br /&gt;
	for i = 1, numberOfParameterGroups do&lt;br /&gt;
		args = extractDataFromNumberedSerialArgs(args, i, numberOfParameterGroups, title)&lt;br /&gt;
		createCells(args, true, i, onInitialPage, title, numberOfParameterGroups)&lt;br /&gt;
		if (i ~= numberOfParameterGroups) then&lt;br /&gt;
			row = row:done()  -- Use done() to close the 'tr' tag in rowspaned rows.&lt;br /&gt;
				:tag('tr')&lt;br /&gt;
				:css('background', topColor)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to retrieve the NumParts value.&lt;br /&gt;
local function getnumberOfParameterGroups(args)&lt;br /&gt;
	for k, v in ipairs(cellNameList) do&lt;br /&gt;
		local numberedParameter = v .. &amp;quot;_&amp;quot; .. 1&lt;br /&gt;
		if (args[numberedParameter]) then&lt;br /&gt;
			parameterGroupCells[v] = true&lt;br /&gt;
			if not firstParameterGroupCell then&lt;br /&gt;
				firstParameterGroupCell = k&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (hasValue(args.NumParts)) then&lt;br /&gt;
		return args.NumParts, true&lt;br /&gt;
	else&lt;br /&gt;
		return 1, false&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to retrieve the Top Color value.&lt;br /&gt;
local function getTopColor(args, rowColorEnabled, onInitialPage)&lt;br /&gt;
	local episodeNumber = mathModule._cleanNumber(args.EpisodeNumber) or 1&lt;br /&gt;
	if (args.TopColor) then&lt;br /&gt;
		if (string.find(args.TopColor, &amp;quot;#&amp;quot;)) then&lt;br /&gt;
			return args.TopColor&lt;br /&gt;
		else&lt;br /&gt;
			return '#' .. args.TopColor&lt;br /&gt;
		end&lt;br /&gt;
	elseif (rowColorEnabled and onInitialPage and mathModule._mod(episodeNumber, 2) == 0) then&lt;br /&gt;
		return '#E9E9E9'&lt;br /&gt;
	elseif (onInitialPage and args.ShortSummary) then&lt;br /&gt;
		return '#F2F2F2'&lt;br /&gt;
	else&lt;br /&gt;
		return 'inherit'&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to retrieve the Row Color value.&lt;br /&gt;
local function isRowColorEnabled(args)&lt;br /&gt;
	local rowColorEnabled = yesNoModule(args.RowColor, false)&lt;br /&gt;
&lt;br /&gt;
	if (args.RowColor and string.lower(args.RowColor) == 'on') then&lt;br /&gt;
		rowColorEnabled = true&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return rowColorEnabled&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to retrieve the Line Color value.&lt;br /&gt;
local function getLineColor(args)&lt;br /&gt;
	-- Default color to light blue&lt;br /&gt;
	local lineColor = args.LineColor or 'CCCCFF'&lt;br /&gt;
&lt;br /&gt;
	-- Add # to color if necessary, and set to default color if invalid&lt;br /&gt;
	if (htmlColor[lineColor] == nil) then&lt;br /&gt;
		lineColor = '#' .. (mw.ustring.match(lineColor, '^[%s#]*([a-fA-F0-9]*)[%s]*$') or '')&lt;br /&gt;
		if (lineColor == '#') then&lt;br /&gt;
			lineColor = '#CCCCFF'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return lineColor&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which is used to check if the table is located on the page&lt;br /&gt;
-- currently viewed, or on a transcluded page instead.&lt;br /&gt;
-- If it is on a transcluded page, the episode summary should not be shown.&lt;br /&gt;
local function isOnInitialPage(args, sublist, pageTitle, initiallistTitle)&lt;br /&gt;
	-- This should be the only check needed, however, it was previously implemented with two templates&lt;br /&gt;
	-- with one of them not requiring an article name, so for backward compatability, the whole sequence is kept.&lt;br /&gt;
	local onInitialPage&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;
		onInitialPage = mw.uri.anchorEncode(pageTitle) == mw.uri.anchorEncode(initiallistTitle)&lt;br /&gt;
		-- avoid processing ghost references&lt;br /&gt;
		if (not onInitialPage) then&lt;br /&gt;
			args.ShortSummary = nil&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		if (initiallistTitle == &amp;quot;&amp;quot;) then&lt;br /&gt;
			onInitialPage = true&lt;br /&gt;
		else&lt;br /&gt;
			onInitialPage = mw.uri.anchorEncode(pageTitle) == mw.uri.anchorEncode(initiallistTitle)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return onInitialPage&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which does the actual main process.&lt;br /&gt;
local function _main(args, sublist)&lt;br /&gt;
	local title = mw.title.getCurrentTitle()&lt;br /&gt;
	local pageTitle = title.text&lt;br /&gt;
	local initiallistTitle = args['1'] or ''&lt;br /&gt;
&lt;br /&gt;
	-- Is this list on the same page as the page directly calling the template?&lt;br /&gt;
	local onInitialPage = isOnInitialPage(args, sublist, pageTitle, initiallistTitle)&lt;br /&gt;
&lt;br /&gt;
	-- Need just this parameter removed if blank, no others&lt;br /&gt;
	if (hasValue(args.ShortSummary) == false) then&lt;br /&gt;
		args.ShortSummary = nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local lineColor = getLineColor(args)&lt;br /&gt;
	local rowColorEnabled = isRowColorEnabled(args)&lt;br /&gt;
	local topColor = getTopColor(args, rowColorEnabled, onInitialPage)&lt;br /&gt;
&lt;br /&gt;
	local root = mw.html.create()							-- Create the root mw.html object to return&lt;br /&gt;
	row = root:tag('tr')									-- Create the table row and store it globally&lt;br /&gt;
				:addClass('vevent')&lt;br /&gt;
				:css('text-align', 'center')&lt;br /&gt;
				:css('background', topColor)&lt;br /&gt;
&lt;br /&gt;
	local numberOfParameterGroups, multiTitleListEnabled = getnumberOfParameterGroups(args)&lt;br /&gt;
&lt;br /&gt;
	if (multiTitleListEnabled and not args.Title_2) then&lt;br /&gt;
		createMultiRowCells(args, numberOfParameterGroups, onInitialPage, title, topColor)&lt;br /&gt;
	else&lt;br /&gt;
		createSingleRowCells(args, numberOfParameterGroups, multiTitleListEnabled, onInitialPage, title)&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 (onInitialPage and title.namespace == 0) then&lt;br /&gt;
		addLineColorTrackingCategories(args)&lt;br /&gt;
		addTopColorTrackingCategories(args)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (cellValueTBA == true and title.namespace == 0) then&lt;br /&gt;
		addTrackingCategory(trackingCategoryList[&amp;quot;tba_values&amp;quot;])&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Do not show the summary if this is being transcluded on the initial list page&lt;br /&gt;
	-- Do include it on all other lists&lt;br /&gt;
	if (onInitialPage and args.ShortSummary) then&lt;br /&gt;
		local bottomWrapper = createShortSummaryRow(args, lineColor)&lt;br /&gt;
		return tostring(root) .. tostring(bottomWrapper) .. trackingCategories&lt;br /&gt;
	else&lt;br /&gt;
		return tostring(root) .. trackingCategories&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Local function which handles both module entry points.&lt;br /&gt;
local function main(frame, sublist)&lt;br /&gt;
	local getArgs = require('Module:Arguments').getArgs&lt;br /&gt;
	local args&lt;br /&gt;
&lt;br /&gt;
	-- Most parameters should still display when blank, so don't remove blanks&lt;br /&gt;
	if (sublist) then&lt;br /&gt;
		args = getArgs(frame, {removeBlanks = false, wrappers = 'Template:Episode list/sublist'})&lt;br /&gt;
	else&lt;br /&gt;
		args = getArgs(frame, {removeBlanks = false, wrappers = 'Template:Episode list'})&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- args['1'] = mw.getCurrentFrame():getParent():getTitle()&lt;br /&gt;
	return _main(args, sublist, frame)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Public function which is used to create an Episode row&lt;br /&gt;
for an Episode Table used for lists of episodes where each table is on a different page,&lt;br /&gt;
usually placed on individual season articles.&lt;br /&gt;
&lt;br /&gt;
For tables which are all on the same page see p.list().&lt;br /&gt;
&lt;br /&gt;
Parameters:&lt;br /&gt;
	-- |1=					— required; The title of the article where the Episode Table is located at.&lt;br /&gt;
	-- |EpisodeNumber=		— suggested; The overall episode number in the series.&lt;br /&gt;
	-- |EpisodeNumber2=		— suggested; The episode number in the season.&lt;br /&gt;
	-- |Title=				— suggested; The English title of the episode.&lt;br /&gt;
	-- |RTitle=				— optional; Unformatted parameter that can be used to add a reference after &amp;quot;Title&amp;quot;,&lt;br /&gt;
											or can be used as a &amp;quot;raw title&amp;quot; to replace &amp;quot;Title&amp;quot; completely.&lt;br /&gt;
	-- |AltTitle=			— optional; An alternative title, such as the title of a foreign show's episode in its native language,&lt;br /&gt;
											or a title that was originally changed.&lt;br /&gt;
	-- |TranslitTitle=		— optional; The title of the episode transliteration (Romanization) to Latin characters.&lt;br /&gt;
	-- |RAltTitle=			— optional; Unformatted parameter that can be used to add a reference after &amp;quot;AltTitle&amp;quot;,&lt;br /&gt;
											or can be used as a &amp;quot;raw title&amp;quot; to replace &amp;quot;AltTitle&amp;quot; completely.&lt;br /&gt;
	-- |NativeTitle=		— optional; The title of the episode in the native language.&lt;br /&gt;
	-- |NativeTitleLangCode — optional; The language code of the native title language.&lt;br /&gt;
	-- |Aux1=				— optional; General purpose parameter. The meaning is specified by the column header.&lt;br /&gt;
										This parameter is also used for Serial episode titles, such as those used in Doctor Who.&lt;br /&gt;
	-- |DirectedBy=			— optional; Name of the episode's director. May contain links.&lt;br /&gt;
	-- |WrittenBy=			— optional; Primary writer(s) of the episode. May include links.&lt;br /&gt;
	-- |Aux2=				— optional; General purpose parameter. The meaning is specified by the column header.&lt;br /&gt;
	-- |Aux3=				— optional; General purpose parameter. The meaning is specified by the column header.&lt;br /&gt;
	-- |OriginalAirDate=	— optional; This is the date the episode first aired on TV, or is scheduled to air.&lt;br /&gt;
	-- |AltDate=			— optional; The next notable air date, such as the first air date of an anime in English.&lt;br /&gt;
	-- |Guests=             — optional; List of Guests for talk shows.  Cannot be used simultaneously with Aux1.&lt;br /&gt;
	-- |MusicalGuests=      — optional; List of MusicalGuests for talk shows.  Cannot be used simultaneously with Aux2. &lt;br /&gt;
	-- |ProdCode=			— optional; The production code in the series. When defined, this parameter also creates a link anchor,&lt;br /&gt;
											prefixed by &amp;quot;pc&amp;quot;; for example, List of episodes#pc01.&lt;br /&gt;
	-- |Viewers=			— optional; Number of viewers who watched the episode. Should include a reference.&lt;br /&gt;
	-- |Aux4=				— optional; General purpose parameter. The meaning is specified by the column header.&lt;br /&gt;
	-- |ShortSummary=		— optional; A short 100–200 word plot summary of the episode.&lt;br /&gt;
	-- |LineColor=			— optional; Colors the separator line between episode entries. If not defined the color defaults to &amp;quot;#CCCCFF&amp;quot;&lt;br /&gt;
											and the article is placed in Category:Episode list using the default LineColor.&lt;br /&gt;
											Use of &amp;quot;#&amp;quot;, or anything but a valid hex code will result in an invalid syntax.&lt;br /&gt;
	-- |TopColor=			— discouraged; Colors the main row of information (that is, not the ShortSummary row).&lt;br /&gt;
											Articles using this parameter are placed in Category:Episode lists with row deviations.&lt;br /&gt;
	-- |RowColor=			— optional; Switch parameter that must only be defined when the EpisodeNumber= entry is not a regular number&lt;br /&gt;
											(e.g. &amp;quot;12–13&amp;quot; for two episodes described in one table entry).&lt;br /&gt;
											If the first episode number is even, define pass &amp;quot;on&amp;quot;. If the first episode number is odd, pass &amp;quot;off&amp;quot;.&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;
--[[&lt;br /&gt;
Public function which is used to create an Episode row&lt;br /&gt;
for an Episode Table used for lists of episodes where all tables are on the same page.&lt;br /&gt;
&lt;br /&gt;
For tables which are on different pages see p.sublist().&lt;br /&gt;
&lt;br /&gt;
For complete parameter documentation, see the documentation at p.sublist().&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;
return p&lt;/div&gt;</summary>
		<author><name>FilipeFonseca</name></author>
	</entry>
</feed>