<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.hedditch.com.au/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfobox_television_season_name</id>
	<title>Module:Infobox television season name - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.hedditch.com.au/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfobox_television_season_name"/>
	<link rel="alternate" type="text/html" href="https://wiki.hedditch.com.au/mediawiki/index.php?title=Module:Infobox_television_season_name&amp;action=history"/>
	<updated>2026-04-22T01:55:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://wiki.hedditch.com.au/mediawiki/index.php?title=Module:Infobox_television_season_name&amp;diff=1378&amp;oldid=prev</id>
		<title>imported&gt;Gonnym: cleanup</title>
		<link rel="alternate" type="text/html" href="https://wiki.hedditch.com.au/mediawiki/index.php?title=Module:Infobox_television_season_name&amp;diff=1378&amp;oldid=prev"/>
		<updated>2021-10-17T12:16:58Z</updated>

		<summary type="html">&lt;p&gt;cleanup&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local match = require(&amp;quot;Module:String&amp;quot;)._match&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
--- Returns a formatted link to the list of episodes article.&lt;br /&gt;
--- @param listOfEpisodesArticle string&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getListOfEpisodesLink(listOfEpisodesArticle)&lt;br /&gt;
	local listOfEpisodesPage = mw.title.new(listOfEpisodesArticle, 0)&lt;br /&gt;
	if listOfEpisodesPage and listOfEpisodesPage.exists and listOfEpisodesPage.redirectTarget ~= mw.title.getCurrentTitle() then&lt;br /&gt;
		return string.format(&amp;quot;[[%s|List of episodes]]&amp;quot;, listOfEpisodesArticle)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns an article link.&lt;br /&gt;
--- @param article string The article&amp;#039;s title.&lt;br /&gt;
--- @param pipedLink string The piped link.&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getArticleLink(article, pipedLink)&lt;br /&gt;
	if not pipedLink or pipedLink == &amp;quot;&amp;quot; then&lt;br /&gt;
		return &amp;quot;[[&amp;quot; .. article .. &amp;quot;]]&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;quot;[[&amp;quot; .. article .. &amp;quot;|&amp;quot; .. pipedLink .. &amp;quot;]]&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the show name and season number from a title.&lt;br /&gt;
--- @param showName string The show&amp;#039;s title.&lt;br /&gt;
--- @return nil | number | string, nil | number | string&lt;br /&gt;
local function getShowNameAndSeasonNumberFromShowName(showName)&lt;br /&gt;
	local _, _, showNameModified, seasonNumber = string.find(showName, &amp;quot;(.*)%s+(%d+)$&amp;quot;)&lt;br /&gt;
	return showNameModified, seasonNumber&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the current season number from the disambiguation.&lt;br /&gt;
--- @param disambiguation string The article&amp;#039;s disambiguation.&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getCurrentSeasonNumberFromDisambiguation(disambiguation)&lt;br /&gt;
	return match(disambiguation , &amp;quot;%d+&amp;quot;, 1, -1, false, &amp;quot;&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the type of word used for &amp;quot;season&amp;quot; in the disambiguation.&lt;br /&gt;
---&lt;br /&gt;
--- The returned value can be one of three options: &amp;quot;season&amp;quot;, &amp;quot;series&amp;quot;, &amp;quot;story arc&amp;quot; or &amp;quot;specials&amp;quot;.&lt;br /&gt;
--- @param disambiguation string The article&amp;#039;s disambiguation.&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getSeasonType(disambiguation)&lt;br /&gt;
	for _, seasonType in pairs({&amp;quot;season&amp;quot;, &amp;quot;series&amp;quot;, &amp;quot;story arc&amp;quot;, &amp;quot;specials&amp;quot;}) do&lt;br /&gt;
		if string.find(disambiguation, seasonType) then&lt;br /&gt;
			return seasonType&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return &amp;quot;season&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the disambiguation without the &amp;quot;(year) TV series,&amp;quot; part.&lt;br /&gt;
--- @param disambiguation string The article&amp;#039;s disambiguation.&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getShortDisambiguation(disambiguation)&lt;br /&gt;
	local shortDisambiguation, _ = string.gsub(disambiguation, &amp;quot;%d+ TV series, &amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
	return shortDisambiguation&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the disambiguation from the title.&lt;br /&gt;
--- @param title string The article&amp;#039;s title.&lt;br /&gt;
--- @return string | nil&lt;br /&gt;
local function getDisambiguation(title)&lt;br /&gt;
	local disambiguation = match(title, &amp;quot;%s%((.-)%)&amp;quot;, 1, -1, false, &amp;quot;&amp;quot;)&lt;br /&gt;
	if disambiguation == &amp;quot;&amp;quot; then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	return disambiguation&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the TV program&amp;#039;s disambiguation.&lt;br /&gt;
--- @param disambiguation string The disambiguation used in the season&amp;#039;s article title.&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getTVProgramDisambiguation(disambiguation)&lt;br /&gt;
	if not disambiguation then&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Check if the disambiguation is normal &amp;#039;season #&amp;#039; or &amp;#039;series #&amp;#039;.&lt;br /&gt;
	-- If so, remove disambiguation.&lt;br /&gt;
	if string.match(disambiguation, &amp;quot;^season %d*$&amp;quot;) or string.match(disambiguation, &amp;quot;^series %d*$&amp;quot;) then&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local disambiguationStyle = &amp;quot; (%s)&amp;quot;&lt;br /&gt;
	-- Check if the disambiguation is extended and has &amp;#039;TV series&amp;#039; and isn&amp;#039;t just season #.&lt;br /&gt;
	-- Only leave the TV series disambiguation, not including the season #.&lt;br /&gt;
	-- Example: Teenage Mutant Ninja Turtles (1987 TV series, season 5) will return &amp;#039;1987 TV series&amp;#039;.&lt;br /&gt;
	if string.find(disambiguation, &amp;quot;TV series&amp;quot;) then&lt;br /&gt;
		local shortDisambiguation, _ = disambiguation:match(&amp;quot;^(.*),&amp;quot;)&lt;br /&gt;
		if shortDisambiguation then&lt;br /&gt;
			return string.format(disambiguationStyle, shortDisambiguation)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Check if the disambiguation is extended with country adjective.&lt;br /&gt;
	-- Example: The Office (American season 2) will return &amp;quot;American season 2&amp;quot;.&lt;br /&gt;
	-- Keep only country adjective.&lt;br /&gt;
	local countryDisambiguation = disambiguation:match(&amp;quot;^(.*) season %d*&amp;quot;) or disambiguation:match(&amp;quot;^(.*) series %d*&amp;quot;)&lt;br /&gt;
	local data = mw.loadData(&amp;quot;Module:Country adjective&amp;quot;)&lt;br /&gt;
	local valid_result = data.getCountryFromAdj[countryDisambiguation]&lt;br /&gt;
	-- Check if the country adjective is valid.&lt;br /&gt;
	if valid_result then&lt;br /&gt;
		-- Add &amp;#039;TV series&amp;#039; suffix&lt;br /&gt;
		return string.format(disambiguationStyle, countryDisambiguation .. &amp;quot; TV series&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Not a known disambiguation style. Use whatever was used in the title or manually added.&lt;br /&gt;
	-- Note: might not be a valid style link.&lt;br /&gt;
	return string.format(disambiguationStyle, disambiguation)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the show&amp;#039;s name from the title.&lt;br /&gt;
--- @param title string The article&amp;#039;s title.&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getShowName(title)&lt;br /&gt;
	local name, _ = mw.ustring.gsub(title, &amp;quot;%s+%b()$&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
	return name&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns &amp;quot;true&amp;quot; if the given link is valid; nil otherwise.&lt;br /&gt;
--- A link is valid in the following cases:&lt;br /&gt;
---	-- A season article exists.&lt;br /&gt;
---	-- A redirect exists to a season section.&lt;br /&gt;
---&lt;br /&gt;
--- A link is invalid in the following cases:&lt;br /&gt;
---	-- A season article or redirect do not exist.&lt;br /&gt;
---	-- A redirect exists, but it is a general redirect and not for any specific season section.&lt;br /&gt;
---&lt;br /&gt;
--- Note: Return values are not booleans as the returned value is used in template space.&lt;br /&gt;
--- @param title string The article&amp;#039;s title.&lt;br /&gt;
--- @return string | nil&lt;br /&gt;
local function isLinkValid(title)&lt;br /&gt;
	local article = mw.title.new(title)&lt;br /&gt;
&lt;br /&gt;
	-- Article or redirect do not exist; Not a valid link.&lt;br /&gt;
	if not article or not article.exists then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local redirectTarget = article.redirectTarget&lt;br /&gt;
&lt;br /&gt;
	-- Article exists and is not a redirect; Valid link.&lt;br /&gt;
	if not redirectTarget then&lt;br /&gt;
		return &amp;quot;true&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local fullLink = redirectTarget.fullText&lt;br /&gt;
	local isSection = fullLink:find(&amp;quot;#&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	-- Article is a section redirect; Valid link.&lt;br /&gt;
	if isSection then&lt;br /&gt;
		return &amp;quot;true&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Article is a general redirect; Not a valid link.&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns a season article title and a piped link.&lt;br /&gt;
---&lt;br /&gt;
--- The following are the supported season naming styles:&lt;br /&gt;
---	--  Style: &amp;lt;showName&amp;gt; (&amp;lt;seasonType&amp;gt; &amp;lt;seasonNumber&amp;gt;)&lt;br /&gt;
---		Example: Lost (season 2).&lt;br /&gt;
---		Example: Doctor Who (series 2).&lt;br /&gt;
---	--  Style: &amp;lt;showName&amp;gt; (&amp;lt;country&amp;gt; &amp;lt;seasonType&amp;gt; &amp;lt;seasonNumber&amp;gt;)&lt;br /&gt;
---		Example: The Office (American season 2).&lt;br /&gt;
---		Example: X Factor (British series 2).&lt;br /&gt;
---	--  Style: &amp;lt;showName&amp;gt; (&amp;lt;country&amp;gt; &amp;lt;seasonType&amp;gt;)&lt;br /&gt;
---		Example: Big Brother 2 (American season).&lt;br /&gt;
---	--  Style: &amp;lt;showName&amp;gt; (&amp;lt;year&amp;gt; TV series, &amp;lt;seasonType&amp;gt; &amp;lt;seasonNumber&amp;gt;)&lt;br /&gt;
---		Example: Teenage Mutant Ninja Turtles (1987 TV series, season 2)&lt;br /&gt;
---	--  Style: &amp;lt;showName&amp;gt; (&amp;lt;country&amp;gt; TV series, &amp;lt;seasonType&amp;gt; &amp;lt;seasonNumber&amp;gt;)&lt;br /&gt;
---		Example: Love Island (British TV series, series 2)&lt;br /&gt;
--- @param title string The article&amp;#039;s title.&lt;br /&gt;
--- @param seasonNumberDiff number The number difference between the current season and the other season.&lt;br /&gt;
--- @return string, string&lt;br /&gt;
local function getArticleTitleAndPipedLink(title, seasonNumberDiff)&lt;br /&gt;
	local disambiguation = getDisambiguation(title)&lt;br /&gt;
	local shortDisambiguation&lt;br /&gt;
	local seasonType&lt;br /&gt;
	local seasonNumber&lt;br /&gt;
	local pipedLink = &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if disambiguation then&lt;br /&gt;
		shortDisambiguation = getShortDisambiguation(disambiguation)&lt;br /&gt;
		seasonType = getSeasonType(shortDisambiguation)&lt;br /&gt;
		seasonNumber = getCurrentSeasonNumberFromDisambiguation(shortDisambiguation)&lt;br /&gt;
		pipedLink = seasonType:gsub(&amp;quot;^%l&amp;quot;, string.upper) .. &amp;quot; &amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local showName = getShowName(title)&lt;br /&gt;
	local showNameModified&lt;br /&gt;
	if not seasonNumber or seasonNumber == &amp;quot;&amp;quot; then&lt;br /&gt;
		-- Not a valid next/prev season link&lt;br /&gt;
		if not string.match(showName, &amp;quot;%s+(%d+)$&amp;quot;) then&lt;br /&gt;
			return &amp;quot;&amp;quot;, nil&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		showNameModified, seasonNumber = getShowNameAndSeasonNumberFromShowName(showName)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if tonumber(seasonNumber) == nil then&lt;br /&gt;
		return &amp;quot;&amp;quot;, nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	seasonNumber = seasonNumber + seasonNumberDiff&lt;br /&gt;
	pipedLink = pipedLink .. seasonNumber&lt;br /&gt;
&lt;br /&gt;
	-- Titles such as &amp;quot;Big Brother 1 (American season)&amp;quot;&amp;quot;&lt;br /&gt;
	if showNameModified and disambiguation then&lt;br /&gt;
		return showNameModified .. &amp;quot; &amp;quot; .. seasonNumber .. &amp;quot; (&amp;quot; .. disambiguation .. &amp;quot;)&amp;quot;, pipedLink&lt;br /&gt;
&lt;br /&gt;
	-- Titles such as &amp;quot;Big Brother Brasil 1&amp;quot;&lt;br /&gt;
	elseif showNameModified then&lt;br /&gt;
		return showNameModified .. &amp;quot; &amp;quot; .. seasonNumber, nil&lt;br /&gt;
&lt;br /&gt;
	-- Standard titles such as &amp;quot;Lost (season 1)&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		local newDisambiguation, _ = string.gsub(disambiguation, &amp;quot;%d+$&amp;quot;, seasonNumber)&lt;br /&gt;
		return showName .. &amp;quot; (&amp;quot; .. newDisambiguation .. &amp;quot;)&amp;quot;, pipedLink&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the article&amp;#039;s title either from args (usually from /testcases) or from the page itself.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getTitle(frame)&lt;br /&gt;
	local getArgs = require(&amp;quot;Module:Arguments&amp;quot;).getArgs&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
	local title = args.title&lt;br /&gt;
&lt;br /&gt;
	if not title then&lt;br /&gt;
		title = mw.title.getCurrentTitle().text&lt;br /&gt;
	end&lt;br /&gt;
	return title&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns &amp;quot;true&amp;quot; if the given season link is valid; nil otherwise.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @param seasonNumberDiff number The number difference between the current season and the other season.&lt;br /&gt;
--- @return string | nil&lt;br /&gt;
local function isSeasonLinkValid(frame, seasonNumberDiff)&lt;br /&gt;
	local title = getTitle(frame)&lt;br /&gt;
	local articleTitle, _ = getArticleTitleAndPipedLink(title, seasonNumberDiff)&lt;br /&gt;
	return isLinkValid(articleTitle)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns a season article link.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @param seasonNumberDiff number The number difference between the current season and the other season.&lt;br /&gt;
--- @return string&lt;br /&gt;
local function getSeasonArticleLink(frame, seasonNumberDiff)&lt;br /&gt;
	local title = getTitle(frame)&lt;br /&gt;
	local articleTitle, pipedLink = getArticleTitleAndPipedLink(title, seasonNumberDiff)&lt;br /&gt;
	return getArticleLink(articleTitle, pipedLink)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns &amp;quot;true&amp;quot; if the season link for the next season is valid; nil otherwise.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @return string | nil&lt;br /&gt;
function p.isNextSeasonLinkValid(frame)&lt;br /&gt;
	return isSeasonLinkValid(frame, 1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns &amp;quot;true&amp;quot; if the season link for the previous season is valid; nil otherwise.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @return string | nil&lt;br /&gt;
function p.isPrevSeasonLinkValid(frame)&lt;br /&gt;
	return isSeasonLinkValid(frame, -1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns &amp;quot;true&amp;quot; if the season link for the previous or next season is valid; nil otherwise.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @return string | nil&lt;br /&gt;
function p.isPrevOrNextSeasonLinkValid(frame)&lt;br /&gt;
	if p.isPrevSeasonLinkValid(frame) == &amp;quot;true&amp;quot; then&lt;br /&gt;
		return &amp;quot;true&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	return p.isNextSeasonLinkValid(frame)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the next season article title.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @return string&lt;br /&gt;
function p.getNextSeasonArticle(frame)&lt;br /&gt;
	return getSeasonArticleLink(frame, 1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the previous season article title.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @return string&lt;br /&gt;
function p.getPrevSeasonArticle(frame)&lt;br /&gt;
	return getSeasonArticleLink(frame, -1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the type of season word used - &amp;quot;season&amp;quot; or &amp;quot;series&amp;quot;.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @return string&lt;br /&gt;
function p.getSeasonWord(frame)&lt;br /&gt;
	local title = getTitle(frame)&lt;br /&gt;
	local disambiguation = getDisambiguation(title)&lt;br /&gt;
	if not disambiguation then&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local shortDisambiguation = getShortDisambiguation(disambiguation)&lt;br /&gt;
	local seasonType = getSeasonType(shortDisambiguation)&lt;br /&gt;
	if seasonType == &amp;quot;specials&amp;quot; then&lt;br /&gt;
		seasonType = &amp;quot;season&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return seasonType&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns the relevant text for the sub-header field.&lt;br /&gt;
---&lt;br /&gt;
--- The text is returned in the format of &amp;quot;Season #&amp;quot; or &amp;quot;Series #&amp;quot;,&lt;br /&gt;
--- depending on either what the article disambiguation uses, or on the manually entered parameters of the infobox.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @return string | nil&lt;br /&gt;
function p.getInfoboxSubHeader(frame)&lt;br /&gt;
	local getArgs = require(&amp;quot;Module:Arguments&amp;quot;).getArgs&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
&lt;br /&gt;
	local seasonType&lt;br /&gt;
	local seasonNumber&lt;br /&gt;
	if args.season_number then&lt;br /&gt;
		seasonType = &amp;quot;Season&amp;quot;&lt;br /&gt;
		seasonNumber = args.season_number&lt;br /&gt;
	elseif args.series_number then&lt;br /&gt;
		seasonType = &amp;quot;Series&amp;quot;&lt;br /&gt;
		seasonNumber = args.series_number&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local title = getTitle(frame)&lt;br /&gt;
	local disambiguation = getDisambiguation(title)&lt;br /&gt;
	if not seasonNumber and disambiguation then&lt;br /&gt;
		local shortDisambiguation = getShortDisambiguation(disambiguation)&lt;br /&gt;
&lt;br /&gt;
		seasonType = getSeasonType(shortDisambiguation)&lt;br /&gt;
		if seasonType == &amp;quot;specials&amp;quot; then&lt;br /&gt;
			return shortDisambiguation&lt;br /&gt;
		end&lt;br /&gt;
		seasonType = seasonType:sub(1, 1):upper() .. seasonType:sub(2)&lt;br /&gt;
		seasonNumber = getCurrentSeasonNumberFromDisambiguation(shortDisambiguation)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if seasonNumber and seasonNumber ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		return seasonType .. &amp;quot; &amp;quot; .. seasonNumber&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--- Returns a formatted link to the list of episodes article.&lt;br /&gt;
---&lt;br /&gt;
--- The returned link is in the style of:&lt;br /&gt;
--- [List of &amp;lt;series name&amp;gt; &amp;lt;disambiguation, if present&amp;gt; episodes &amp;lt;range, if present&amp;gt;|List of episodes]&lt;br /&gt;
---&lt;br /&gt;
--- The link will only return if the page exists.&lt;br /&gt;
--- @param frame table The frame invoking the module.&lt;br /&gt;
--- @return string | nil&lt;br /&gt;
function p.getListOfEpisodes(frame)&lt;br /&gt;
	local getArgs = require(&amp;quot;Module:Arguments&amp;quot;).getArgs&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
&lt;br /&gt;
	if args.link then&lt;br /&gt;
		-- Parameter should be unformatted.&lt;br /&gt;
		if string.find(args.link, &amp;quot;%[&amp;quot;) then&lt;br /&gt;
			local delink = require(&amp;quot;Module:Delink&amp;quot;)._delink&lt;br /&gt;
			args.link = delink({args.link, wikilinks = &amp;quot;target&amp;quot;})&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		return getListOfEpisodesLink(args.link)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local title = getTitle(frame)&lt;br /&gt;
	local showName = getShowName(title)&lt;br /&gt;
&lt;br /&gt;
	if showName then&lt;br /&gt;
		local disambiguation = getDisambiguation(title)&lt;br /&gt;
		local TVProgramDisambiguation = getTVProgramDisambiguation(disambiguation)&lt;br /&gt;
		local listOfEpisodesArticle = string.format(&amp;quot;List of %s%s episodes&amp;quot;, showName, TVProgramDisambiguation)&lt;br /&gt;
		return getListOfEpisodesLink(listOfEpisodesArticle)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Gonnym</name></author>
	</entry>
</feed>