<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.bharatpedia.org/w/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://en.bharatpedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AInfobox_television_season_name"/>
	<link rel="alternate" type="text/html" href="https://en.bharatpedia.org/w/index.php?title=Module:Infobox_television_season_name&amp;action=history"/>
	<updated>2026-09-07T10:11:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://en.bharatpedia.org/w/index.php?title=Module:Infobox_television_season_name&amp;diff=129136&amp;oldid=prev</id>
		<title>WikiDwarf: Created page with &quot;local match = require(&quot;Module:String&quot;)._match  local p = {}  -- Local function which is used to create an pipped article link. -- local function createArticleTitleWithPipe...&quot;</title>
		<link rel="alternate" type="text/html" href="https://en.bharatpedia.org/w/index.php?title=Module:Infobox_television_season_name&amp;diff=129136&amp;oldid=prev"/>
		<updated>2021-07-11T14:28:43Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local match = require(&amp;quot;Module:String&amp;quot;)._match  local p = {}  --&lt;a href=&quot;/w/index.php?title=Local_function_which_is_used_to_create_an_pipped_article_link._--&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Local function which is used to create an pipped article link. -- (page does not exist)&quot;&gt;Local function which is used to create an pipped article link. --&lt;/a&gt; local function createArticleTitleWithPipe...&amp;quot;&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;
--[[&lt;br /&gt;
Local function which is used to create an pipped article link.&lt;br /&gt;
--]]&lt;br /&gt;
local function createArticleTitleWithPipedLink(article, pipedLink)&lt;br /&gt;
	if (pipedLink == nil or pipedLink == &amp;quot;&amp;quot;) then&lt;br /&gt;
		return &amp;quot;[[&amp;quot; .. article .. &amp;quot;]]&amp;quot;&lt;br /&gt;
	else&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;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local helper function which is used to get the current season number and modified show name&lt;br /&gt;
from the show name.&lt;br /&gt;
--]]&lt;br /&gt;
local function getModifiedShowNameAndCurrentSeasonNumberFromShowName(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;
--[[&lt;br /&gt;
Local helper function which is used to get the current season number from the disambiguation.&lt;br /&gt;
--]]&lt;br /&gt;
local function getCurrentSeasonNumberFromDisambiguation(shortDisambiguation)&lt;br /&gt;
	return match(shortDisambiguation , &amp;quot;%d+&amp;quot;, 1, -1, false, &amp;quot;&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local helper function which is used to get the type of word used for &amp;quot;season&amp;quot;&lt;br /&gt;
in the disambiguation.&lt;br /&gt;
&lt;br /&gt;
Returns one of three options: &amp;quot;season&amp;quot;, &amp;quot;series&amp;quot; or &amp;quot;story arc&amp;quot;.&lt;br /&gt;
--]]&lt;br /&gt;
local function getSeasonType(shortDisambiguation)&lt;br /&gt;
	if (string.find(shortDisambiguation, &amp;quot;story arc&amp;quot;)) then&lt;br /&gt;
		return &amp;quot;story arc&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (string.find(shortDisambiguation, &amp;quot;series&amp;quot;)) then&lt;br /&gt;
		return &amp;quot;series&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return &amp;quot;season&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local helper function which is used to get the short disambiguation,&lt;br /&gt;
without the &amp;quot;(year) TV series,&amp;quot; part, which can cause issues later on.&lt;br /&gt;
--]]&lt;br /&gt;
local function getShortDisambiguation(disambiguation)&lt;br /&gt;
	return string.gsub(disambiguation, &amp;quot;%d+ TV series, &amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local helper function which is used to get the disambiguation from the title.&lt;br /&gt;
--]]&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;
	else&lt;br /&gt;
		return disambiguation&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local helper function which is used to get the show name from the title.&lt;br /&gt;
--]]&lt;br /&gt;
local function getShowName(title)&lt;br /&gt;
	return mw.ustring.gsub(title, &amp;quot;%s+%b()$&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local function which is used to check if the given article exists.&lt;br /&gt;
The function returns &amp;quot;true&amp;quot; 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;
The function returns nil 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;
local function checkArticle(articleTitle)&lt;br /&gt;
	local article = mw.title.new(articleTitle)&lt;br /&gt;
	if (article ~= nil and article.exists) then&lt;br /&gt;
		local redirectTarget = article.redirectTarget&lt;br /&gt;
		if (redirectTarget) then&lt;br /&gt;
			local fullLink = redirectTarget.fullText&lt;br /&gt;
			local isSection = fullLink:find(&amp;quot;#&amp;quot;)&lt;br /&gt;
			if (isSection) then&lt;br /&gt;
				return &amp;quot;true&amp;quot;								-- Article is a section redirect; Valid link.&lt;br /&gt;
			else&lt;br /&gt;
				return nil									-- Article is a general redirect; Not a valid link.&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;true&amp;quot;									-- Article exists and is not a redirect; Valid link.&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return nil											-- Article or redirect do not exist; Not a valid link.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local function which 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;
	-- &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;
	-- &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;
	-- &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;
	-- &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;
		-- &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;
--]]&lt;br /&gt;
local function getArticleTitle(title, prevOrNextSeasonNumber)&lt;br /&gt;
	local showName = getShowName(title)&lt;br /&gt;
	local disambiguation = getDisambiguation(title)&lt;br /&gt;
	local shortDisambiguation&lt;br /&gt;
	local seasonType&lt;br /&gt;
	local seasonNumber = &amp;quot;&amp;quot;&lt;br /&gt;
	local pipedLink = &amp;quot;&amp;quot;&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 showNameModified&lt;br /&gt;
	if (seasonNumber == &amp;quot;&amp;quot;) then&lt;br /&gt;
		if (string.match(showName , &amp;quot;%s+(%d+)$&amp;quot;)) then&lt;br /&gt;
			showNameModified, seasonNumber = getModifiedShowNameAndCurrentSeasonNumberFromShowName(showName)&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot; -- Not a valid next/prev season link&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if (tonumber(seasonNumber) == nil) then&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		seasonNumber = seasonNumber + prevOrNextSeasonNumber&lt;br /&gt;
		pipedLink = pipedLink .. seasonNumber&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;
			disambiguation = string.gsub(disambiguation, &amp;quot;%d+$&amp;quot;, seasonNumber)&lt;br /&gt;
			return showName .. &amp;quot; (&amp;quot; .. disambiguation .. &amp;quot;)&amp;quot;, pipedLink&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local helper function which is used to get the title,&lt;br /&gt;
either from args (usually from /testcases) or from the page itself.&lt;br /&gt;
--]]&lt;br /&gt;
local function getTitle(frame)&lt;br /&gt;
	local getArgs = require(&amp;#039;Module:Arguments&amp;#039;).getArgs&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
	local title = args.title&lt;br /&gt;
	if (not title) then&lt;br /&gt;
		title = mw.title.getCurrentTitle().text&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return title&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local helper function which is called to create a TV season title for the next or previous season.&lt;br /&gt;
Passes the value &amp;quot;1&amp;quot; or -1&amp;quot; to increment or decrement the current season number.&lt;br /&gt;
--]]&lt;br /&gt;
local function createArticleTitleHelper(frame, number)&lt;br /&gt;
	local title = getTitle(frame)&lt;br /&gt;
	return getArticleTitle(title, number)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local helper function which is used to check if a season article exists.&lt;br /&gt;
--]]&lt;br /&gt;
local function checkSeason(frame, number)&lt;br /&gt;
	local articleTitle = createArticleTitleHelper(frame, number)&lt;br /&gt;
	return checkArticle(articleTitle)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Local helper function which is used to create a season article link.&lt;br /&gt;
--]]&lt;br /&gt;
local function getSeasonArticleLink(frame, number)&lt;br /&gt;
	local articleTitle, pipedLink = createArticleTitleHelper(frame, number)&lt;br /&gt;
	return createArticleTitleWithPipedLink(articleTitle, pipedLink)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Public function which is used to check if the next season has&lt;br /&gt;
a valid created article or redirect.&lt;br /&gt;
--]]&lt;br /&gt;
function p.checkNextSeason(frame)&lt;br /&gt;
	return checkSeason(frame, 1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Public function which is used to check if the previous season has&lt;br /&gt;
a valid article or redirect.&lt;br /&gt;
--]]&lt;br /&gt;
function p.checkPrevSeason(frame)&lt;br /&gt;
	return checkSeason(frame, -1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Public function which is used to check if the next or previous season have&lt;br /&gt;
a valid article or redirect.&lt;br /&gt;
&lt;br /&gt;
Parameters: &lt;br /&gt;
--]]&lt;br /&gt;
function p.checkAll(frame)&lt;br /&gt;
	if (p.checkPrevSeason(frame) == &amp;quot;true&amp;quot;) then&lt;br /&gt;
		return &amp;quot;true&amp;quot;&lt;br /&gt;
	else&lt;br /&gt;
		return p.checkNextSeason(frame)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Public function which is used to get the next season article title.&lt;br /&gt;
--]]&lt;br /&gt;
function p.getNextSeasonArticle(frame)&lt;br /&gt;
	return getSeasonArticleLink(frame, 1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Public function which is used to get the previous season article title.&lt;br /&gt;
--]]&lt;br /&gt;
function p.getPrevSeasonArticle(frame)&lt;br /&gt;
	return getSeasonArticleLink(frame, -1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Public function which is used to get the type of season word used - &amp;quot;season&amp;quot; or &amp;quot;series&amp;quot;.&lt;br /&gt;
--]]&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 (disambiguation) then&lt;br /&gt;
		local shortDisambiguation = getShortDisambiguation(disambiguation)&lt;br /&gt;
		return getSeasonType(shortDisambiguation)&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
Public function which is used to return the relevant text for the sub-header field.&lt;br /&gt;
The text is returned in the format of &amp;lt;code&amp;gt;Season #&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;Series #&amp;lt;/code&amp;gt;,&lt;br /&gt;
depending on either what the article disambiguation uses, or on manually entered parameters of the infobox.&lt;br /&gt;
--]]&lt;br /&gt;
function p.getInfoboxSubHeader(frame)&lt;br /&gt;
	local getArgs = require(&amp;#039;Module:Arguments&amp;#039;).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 showName = getShowName(title)&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;
		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;
--[[&lt;br /&gt;
Public function which is used to return the formatted link&lt;br /&gt;
to the list of episodes article 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;seasons if present&amp;gt;|List of &amp;#039;&amp;#039;&amp;lt;series name&amp;gt;&amp;#039;&amp;#039; episodes &amp;lt;seasons if present&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
The link will only return if the page exists.&lt;br /&gt;
--]]&lt;br /&gt;
function p.getListOfEpisodes(frame)&lt;br /&gt;
	local getArgs = require(&amp;#039;Module:Arguments&amp;#039;).getArgs&lt;br /&gt;
	local args = getArgs(frame)&lt;br /&gt;
&lt;br /&gt;
	local listRange = &amp;quot;&amp;quot;&lt;br /&gt;
	local title = getTitle(frame)&lt;br /&gt;
	local showName&lt;br /&gt;
	local disambiguation&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;#039;Module:Delink&amp;#039;)._delink&lt;br /&gt;
			args.link = delink({args.link})&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- Get the season or year range if present.&lt;br /&gt;
		-- Examples:&lt;br /&gt;
		-- List of The Simpsons episodes (seasons 1–20) will return &amp;#039;(seasons 1–20)&amp;#039;.&lt;br /&gt;
		-- List of Doctor Who episodes (2005–present) will return &amp;#039;(2005–present)&amp;#039;.&lt;br /&gt;
		listRange = args.link:match(&amp;#039;episodes(.*)$&amp;#039;) or &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
		-- Get the series name with disambiguation.&lt;br /&gt;
		local seriesNameWithDisambiguation = args.link:match(&amp;#039;List of (.*) episodes&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
		if (seriesNameWithDisambiguation) then&lt;br /&gt;
			showName = getShowName(seriesNameWithDisambiguation)&lt;br /&gt;
			disambiguation = getDisambiguation(seriesNameWithDisambiguation)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	else&lt;br /&gt;
		showName = getShowName(title)&lt;br /&gt;
		disambiguation = getDisambiguation(title)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (disambiguation) then&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;
			-- 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;
			disambiguation = &amp;quot;&amp;quot;&lt;br /&gt;
		elseif (string.find(disambiguation, &amp;quot;TV series&amp;quot;)) then&lt;br /&gt;
			-- Check if the disambiguation is extended&lt;br /&gt;
			-- 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 55) will return &amp;#039;1987 TV series&amp;#039;.&lt;br /&gt;
			disambiguation = disambiguation:match(&amp;#039;^(.*),&amp;#039;) or disambiguation&lt;br /&gt;
			disambiguation = string.format(&amp;quot; (%s)&amp;quot;, disambiguation)&lt;br /&gt;
		else&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;#039;^(.*) season %d*&amp;#039;) or disambiguation:match(&amp;#039;^(.*) series %d*&amp;#039;)&lt;br /&gt;
			local data = mw.loadData(&amp;#039;Module:Country adjective&amp;#039;)&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;
				disambiguation = string.format(&amp;quot; (%s)&amp;quot;, countryDisambiguation .. &amp;#039; TV series&amp;#039;)&lt;br /&gt;
			else&lt;br /&gt;
				-- Not a known diambiguation 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;
				disambiguation = string.format(&amp;quot; (%s)&amp;quot;, disambiguation)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		disambiguation = &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (showName) then&lt;br /&gt;
		local episodeListArticle = &amp;quot;List of %s%s episodes%s&amp;quot;&lt;br /&gt;
		episodeListArticle = episodeListArticle:format(showName, disambiguation, listRange)&lt;br /&gt;
		local episodeListArticlePage = mw.title.new(episodeListArticle, 0)&lt;br /&gt;
&lt;br /&gt;
		if (episodeListArticlePage.exists and episodeListArticlePage.redirectTarget ~= mw.title.getCurrentTitle()) then&lt;br /&gt;
			local episodeList = &amp;quot;[[%s|List of &amp;#039;&amp;#039;%s&amp;#039;&amp;#039; episodes%s]]&amp;quot;&lt;br /&gt;
			episodeList = episodeList:format(episodeListArticle, showName, listRange)&lt;br /&gt;
			return episodeList&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>WikiDwarf</name></author>
	</entry>
</feed>