Jump to content
Wikipedia The Free Encyclopedia

Module:Infobox television episode

From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
Warning This Lua module is used on approximately 13,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them.
This module depends on the following other modules:

Module:Infobox television episode is used to validate parameter values for Template:Infobox television episode and Template:Infobox television crossover episode.

Functions

above_title

Returns the text used for the |above= field of the infobox.

episode_list

Returns the text used for the |episode_list= field of the infobox.

italic_title

Returns an {{Italic dab2 }} instance if title qualifies. Also returns a maintenance category if conditions are met.

The article's title is italicized if the series name is included in the article's title disambiguation. No italicization happens if one of the following conditions is met:

  • |italic_title=no is set.
  • The article's title does not use disambiguation.
  • No |series= value is set.
  • The article's disambiguation is not equal or does not include the series name.

The page is added to a maintenance category if the title is italicized and there is already an {{Italic dab }}, {{Italic title }} or {{DISPLAYTITLE }} template.

Infobox parameters checked:

  • |series=
  • |italic_title=

validate_values

Returns the relevant maintenance categories based on the {{Infobox television episode }} values validated.

Infobox television crossover episode function

validate_values_crossover

Returns the relevant maintenance categories based on the {{Infobox television crossover episode }} values validated.

See also

Maintenance categories

The module places relevant pages in the following maintenance categories:

The above documentation is transcluded from Module:Infobox television episode/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Subpages of this module.

 --- @module
 localp={}

 localmaintenance_categories={
 incorrectly_formatted="[[Category:Pages using infobox television episode with incorrectly formatted values|%s]]",
 unlinked_values="[[Category:Pages using infobox television episode with unlinked values|%s]]",
 image_values_without_an_image="[[Category:Pages using infobox television episode with image-related values without an image]]",
 unnecessary_title_parameter="[[Category:Pages using infobox television episode with unnecessary title parameter]]",
 non_matching_title="[[Category:Pages using infobox television episode with non-matching title]]",
 flag_icon="[[Category:Pages using infobox television with flag icon]]",
 dates_incorrectly_formatted="[[Category:Pages using infobox television episode with nonstandard dates]]",
 manual_display_title="[[Category:Pages using infobox television episode with unnecessary manual displaytitle]]",
 list_markup="[[Category:Pages using infobox television episode with unnecessary list markup]]",
 }

 --- Returns the text after removing line breaks (<br> tags) and additional spaces as a result.
 ---
 --- @param text string
 --- @return string
 localfunctionget_name_with_br_fixes(text)
 localtitle,_=string.gsub(text,"<br%s?/?>","")
 title,_=string.gsub(title," "," ")
 returntitle
 end

 --- Returns the page name after replacing quotation marks for single quotes and fixing it to use the
 --- "Space+single" and "Single+space" templates if a leading or trailing apostrophe or quotation mark is used.
 ---
 --- Note: per [[MOS:QWQ]] an episode title with quotation marks should be replaced with single quotes.
 ---
 --- @param frame table
 --- @param article_title string
 --- @return string
 localfunctionget_page_name_with_apostrophe_quotation_fixes(frame,article_title)
 localpage_name,_=string.gsub(article_title,'"',"'")

 localleft_side_template=frame:expandTemplate{title="Space+single"}
 localright_side_template=frame:expandTemplate{title="Single+space"}
 page_name,_=string.gsub(string.gsub(page_name,"^'",left_side_template),"'$",right_side_template)

 returnpage_name
 end

 --- Returns the series link.
 ---
 --- @param series string
 --- @return string
 localfunctionget_series_link(series)
 localdelink=require("Module:Delink")._delink
 returndelink({series,wikilinks="target"})
 end

 --- Returns two strings:
 ---- The series name after de-linking it and escaping "-".
 ---- The series name after de-linking it.
 ---
 --- @param series string
 --- @return string, string
 localfunctionget_series_name(series)
 localdelink=require("Module:Delink")._delink
 localseries_name=delink({series})

 -- Escape the character "-" as it is needed for string.find() to work.
 local_
 localseries_name_escaped,_=string.gsub(series_name,"-","%%-")
 returnseries_name_escaped,series_name
 end

 --- Returns a table consisting of the episode's title parts.
 ---
 --- The return table's properties:
 --- - title - The episode's title.
 --- - disambiguation - the disambiguation text without parentheses.
 ---
 --- Note: could potentially be moved to an outside module for other template and module uses.
 ---
 --- @param text string
 --- @return table<string, string | nil>
 localfunctionget_title_parts(text)
 localtitle,disambiguation=string.match(text,"^(.+) (%b())$")

 localtitleString=title-- TODO: needed until https://github.com/Benjamin-Dobell/IntelliJ-Luanalysis/issues/63 is resolved.
 ifnottitleortype(title)~="string"then
 titleString=text
 end

 ---@type table<string, string | nil>
 localtitle_parts={title=--[[---@not number | nil]]titleString,disambiguation=nil}

 ifnotdisambiguationortype(disambiguation)~="string"then
 returntitle_parts
 end

 -- Remove outside parentheses from names which use parentheses as part of the name such as "episode (Randall and Hopkirk (Deceased))".
 disambiguation=string.sub(--[[---@not number | nil]]disambiguation,2,-2)
 title_parts.disambiguation=--[[---@not number]]disambiguation
 returntitle_parts
 end

 --- Returns the title used in the {{Lowercase title}} template and an optional maintenance category.
 ---
 --- @param page_text string
 --- @param args table
 --- @param title_parts table
 --- @return string | nil
 localfunctionget_lowercase_template_status(page_text,args,title_parts)
 locallowercase_template=string.match(page_text,"{{[Ll]owercase title.-}}")
 iflowercase_templatethen
 locallowercase_title,_=string.gsub(title_parts.title,"^%u",string.lower)
 ifargs.titlethen
 ifargs.title==lowercase_titlethen
 returnmaintenance_categories.unnecessary_title_parameter
 else
 returnmaintenance_categories.non_matching_title
 end
 return""
 end
 returnlowercase_title
 end

 returnnil
 end

 --- Returns the title used in the {{Correct title}} template and an optional maintenance category.
 ---
 --- @param page_text string
 --- @param args table
 --- @param return_category boolean
 --- @return string | nil
 localfunctionget_correct_title_value(page_text,args,return_category)
 localcorrect_title_template_pattern="{{[Cc]orrect title|title=(.*)|reason=.-}}"

 localcorrect_title=string.match(page_text,correct_title_template_pattern)

 ifnotcorrect_titlethen
 correct_title_template_pattern="{{[Cc]orrect title|(.*)|reason=.-}}"
 correct_title=string.match(page_text,correct_title_template_pattern)
 end

 ifnotcorrect_titleandtype(correct_title)~="string"then
 returnnil
 end

 localcorrect_title_title_parts=get_title_parts(correct_title)

 ifnotcorrect_title_title_parts.disambiguationthen
 -- If the correct title value has no disambiguation, check if the title used in the infobox is the same as the title used for the correct title value.
 ifreturn_categoryandargs.titlethen
 ifargs.title==correct_title_title_parts.titlethen
 returnmaintenance_categories.unnecessary_title_parameter
 else
 returnmaintenance_categories.non_matching_title
 end
 end
 returncorrect_title_title_parts.title
 end

 localseries_name_escaped,_=get_series_name(args.series)

 ifseries_name_escaped~=""and(correct_title_title_parts.disambiguation==series_name_escapedorstring.find(correct_title_title_parts.disambiguation,series_name_escaped))then
 ifreturn_categoryandargs.titlethen
 ifargs.title==correct_title_title_parts.titlethen
 returnmaintenance_categories.unnecessary_title_parameter
 else
 returnmaintenance_categories.non_matching_title
 end
 end
 returncorrect_title_title_parts.title
 end

 -- Can't determine if the text in parentheses is disambiguation or part of the title since |series= isn't used.
 ifreturn_categorythen
 return""
 end

 returncorrect_title
 end

 --- Returns the display title text used in either the {{DISPLAYTITLE}} or {{Italic title}} templates.
 ---
 --- @param page_text string
 --- @param article_title string
 --- @return string | nil
 localfunctionget_display_title_text(page_text,article_title)
 localtitle_modification=string.match(page_text,"{{DISPLAYTITLE:(.-)}}")
 iftitle_modificationandtype(title_modification)=="string"then
 return--[[---@not number | nil]]title_modification
 end

 title_modification=string.match(page_text,"{{Italic title|string=(.-)}}")
 iftitle_modificationandtype(title_modification)=="string"then
 localitalic_title_text,_=string.gsub(article_title,--[[---@not number | nil]]title_modification,"''"..title_modification.."''")
 returnitalic_title_text
 end

 returnnil
 end

 --- Returns a maintenance category if the italic_title value is not "no".
 ---
 --- Infobox parameters checked:
 --- - |italic_title=
 ---
 --- @param args table
 --- @return string
 localfunctionis_italic_title_valid_value(args)
 ifargs.italic_titleandargs.italic_title~="no"then
 returnstring.format(maintenance_categories.incorrectly_formatted,"italic_title")
 end
 return""
 end

 --- Returns a maintenance category if the date is not formatted correctly with a {{Start date}} template.
 --- Allow "Unaired" as a valid value for unaired television episodes.
 ---
 --- Infobox parameters checked:
 --- - |airdate=
 --- - |released=
 --- - |airdate_overall=
 ---
 --- @param start_date string
 --- @return string
 localfunctionare_dates_formatted_correctly(start_date)
 ifstart_dateand(string.find(start_date,"film%-date")ornotstring.find(start_date,"itvstart")andstart_date~="Unaired")then
 returnmaintenance_categories.dates_incorrectly_formatted
 end
 return""
 end

 --- Returns a maintenance category if list markup is used. The infobox can handle list markup correctly.
 ---
 --- Note: the code here is temporarily checking only the parameters which have been converted
 --- to use the plainlist class directly. Once current uses will be converted, the function will check all parameters
 --- for incorrect usage.
 ---
 --- Infobox parameters checked:
 ---	- Parameters listed below.
 ---
 --- Currently checks for the following list markup:
 --- - <br> tags - per [[MOS:NOBR]].
 --- - <li> tags.
 --- - "plainlist" class.
 --- - "hlist" class.
 ---
 --- @param args table
 --- @return string
 localfunctionuses_list_markup(args)
 localinvalid_tags={
 ["br"]="<[bB][rR]%s?/?>",
 ["li"]="<li>",
 ["plainlist"]="plainlist",
 ["hlist"]="hlist",
 }

 ---@type table<string, boolean>
 localparameters={
 director=true,
 writer=true,
 story=true,
 teleplay=true,
 narrator=true,
 presenter=true,
 producer=true,
 music=true,
 photographer=true,
 editor=true,
 production=true,
 airdate=true,
 guests=true,
 commentary=true,
 }

 forparameter_name,_inpairs(parameters)do
 for_,list_patterninpairs(invalid_tags)do
 localparameter_value=args[parameter_name]
 ifparameter_valueandstring.find(parameter_value,list_pattern)then
 returnmaintenance_categories.list_markup
 end
 end
 end
 return""
 end

 --- Returns a maintenance category if a flag icon is used.
 ---
 --- All of the infobox values are checked.
 ---
 --- @param args table
 --- @return string
 localfunctionhas_flag_icon(args)
 for_,valueinpairs(args)do
 ifstring.find(value,"flagicon")then
 returnmaintenance_categories.flag_icon
 end
 end
 return""
 end

 --- Returns a maintenance category if the values are linked.
 ---
 --- Infobox parameters checked:
 --- - |episode=
 --- - |season=
 --- - |series_no=
 --- - |episode_list=
 ---
 --- The function currently checks if the following values are present:
 --- - ]] - links.
 ---
 --- @param args table
 --- @return string
 localfunctionare_values_linked(args)
 localparameters={
 episode=args.episode,
 season=args.season,
 series_no=args.series_no,
 episode_list=args.episode_list,
 }

 forkey,valueinpairs(parameters)do
 ifstring.find(value,"]]",1,true)then
 returnstring.format(maintenance_categories.incorrectly_formatted,key)
 end
 end
 return""
 end

 --- Returns a maintenance category if the values are formatted.
 ---
 --- Most of the infobox values are checked. Not included are:
 --- - |title= - is handled in is_infobox_title_equal_to_article_title()
 --- - |series= - is handled in are_values_links_only()
 --- - |next= - is handled in are_values_links_only()
 --- - |prev= is handled in are_values_links_only()
 --- - |rtitle=
 --- - |rprev=
 --- - |rnext=
 --- - |image_alt=
 --- - |alt=
 --- - |caption=
 --- - |based_on=
 --- - |music=
 --- - |guests=
 --- - |module=
 ---
 --- The function currently checks if the following values are present:
 --- - '' - italics or bold.
 ---
 --- Note:
 --- If the series is American Horror Story then the season_article value is allowed to be formatted.
 --- If in the future more series need this exception then the hardcoded value in the function should be taken out into a list.
 ---
 --- @param args table
 --- @return string
 localfunctionare_values_formatted(args)
 ---@type table<string, boolean>
 localignore_parameters={
 title=true,
 series=true,
 prev=true,
 next=true,
 rtitle=true,
 rprev=true,
 rnext=true,
 image_alt=true,
 alt=true,
 caption=true,
 based_on=true,
 music=true,
 guests=true,
 module=true,
 }

 forkey,valueinpairs(args)do
 ifnotignore_parameters[key]andstring.find(value,"''",1,true)then
 ifkey=="season_article"andargs.series=="[[American Horror Story]]"then--TODO: This is hardcoded for now.
 -- Do nothing.
 else
 returnstring.format(maintenance_categories.incorrectly_formatted,key)
 end
 end
 end
 return""
 end

 --- Returns a maintenance category if the values use additional overall numbering.
 ---
 --- Infobox parameters checked:
 --- - |episode=
 --- - |season=
 --- - |series_no=
 ---
 --- The function currently checks if the following values are present:
 --- - overall - unsupported series overall numbering.
 ---
 --- @param args table
 --- @return string
 localfunctionare_values_using_overall(args)
 localparameters={
 episode=args.episode,
 season=args.season,
 series_no=args.series_no,
 }

 forkey,valueinpairs(parameters)do
 ifstring.find(value,"overall")then
 returnstring.format(maintenance_categories.incorrectly_formatted,key)
 end
 end

 return""
 end

 --- Returns a maintenance category if the values are unlinked and if additional characters are found in the text.
 ---
 --- Infobox parameters checked:
 --- - |series=
 --- - |prev=
 --- - |next=
 ---
 --- The function currently checks if a value is unlinked or if there is any additional character
 --- before or after the linked text.
 ---
 --- @param args table
 --- @return string
 localfunctionare_values_links_only(args)
 localparameters={
 series=args.series,
 prev=args.prev,
 next=args.next,
 }

 forkey,valueinpairs(parameters)do
 -- Check whether the values are linked.
 ifnotstring.find(value,"%[%[.*%]%]")then
 returnstring.format(maintenance_categories.unlinked_values,key)
 end

 -- Check whether the values have anything before or after link brackets.
 ifstring.gsub(value,"(%[%[.*%]%])","")~=""then
 returnstring.format(maintenance_categories.incorrectly_formatted,key)
 end
 end

 return""
 end

 --- Returns a maintenance category if the |image= value includes the "File:" or "Image:" prefix.
 ---
 --- Infobox parameters checked:
 --- - |image=
 ---
 --- @param image string
 --- @return string
 localfunctionis_image_using_incorrect_syntax(image)
 ifnotimagethen
 return""
 end

 ifstring.find(image,"[Ff]ile:")orstring.find(image,"[Ii]mage:")then
 returnstring.format(maintenance_categories.incorrectly_formatted,"image")
 end

 return""
 end

 --- Returns a maintenance category if the |image_size= value includes "px".
 ---
 --- Infobox parameters checked:
 --- - |image_size=
 ---
 --- @param image_size string
 --- @return string
 localfunctionis_image_size_using_px(image_size)
 ifimage_sizeandstring.find(image_size,"px")then
 returnstring.format(maintenance_categories.incorrectly_formatted,"image_size")
 end
 return""
 end

 --- Returns a maintenance category if there is no image file while image auxiliary values are present.
 ---
 --- Infobox parameters checked:
 --- - |image=
 --- - |image_size=
 --- - |image_upright=
 --- - |image_alt=
 --- - |alt=
 --- - |caption=
 ---
 --- @param args table
 --- @return string
 localfunctionare_image_auxiliary_values_used_for_no_image(args)
 ifargs.imagethen
 return""
 end

 ifargs.image_sizeorargs.image_uprightorargs.image_altorargs.altorargs.captionthen
 returnmaintenance_categories.image_values_without_an_image
 end

 return""
 end

 --- Returns a maintenance category if the infobox title is equal to the article title.
 ---
 --- Infobox parameters checked:
 --- - |title=
 --- - |series=
 --- - |italic_title
 ---
 --- The function currently checks if the infobox title is equal to the article title while ignoring styling such as:
 --- - Nowrap spans.
 --- - Line breaks.
 --- - Leading and trailing apostrophe spaces.
 ---
 --- A return value can be one of three options:
 --- - The value of maintenance_categories.non_matching_title - when the args.title does not match the article title.
 --- - The value of maintenance_categories.unnecessary_title_parameter - when the args.title matches the article title.
 --- - An empty string - when args.title isn't used or the args.title uses an allowed modification
 --- (such as a nowrap template) while the rest of the args.title matchs the article title.
 ---
 --- Testing parameters:
 --- - |page_test= - a real Wikipedia page to read the content of the page.
 --- - |page_title_test= - the title of the page being checked.
 ---
 --- @param frame table
 --- @param args table
 --- @return string
 localfunctionis_infobox_title_equal_to_article_title(frame,args)
 ifnotargs.titlethen
 return""
 end

 localpage_text
 ifargs.page_testthen
 page_text=mw.title.new(args.page_test):getContent()
 else
 page_text=mw.title.getCurrentTitle():getContent()
 end

 -- Check if the article is using a {{Correct title}} template.
 localcorrect_title=get_correct_title_value(page_text,args,true)
 ifcorrect_titlethen
 returncorrect_title
 end

 localarticle_title=args.page_title_test
 ifnotargs.page_title_testthen
 article_title=mw.title.getCurrentTitle().text
 end

 localtitle_parts=get_title_parts(article_title)

 -- Check if the article is using a {{Lowercase title}} template.
 locallowercase_title=get_lowercase_template_status(page_text,args,title_parts)
 iflowercase_titlethen
 returnlowercase_title
 end

 iftitle_parts.disambiguationthen
 localseries_name_escaped,_=get_series_name(args.series)
 series_name_escaped=get_name_with_br_fixes(series_name_escaped)
 ifseries_name_escaped~=""and(title_parts.disambiguation==series_name_escapedorstring.find(title_parts.disambiguation,series_name_escaped))then
 -- Remove disambiguation.
 article_title=title_parts.title
 end
 end

 ifargs.italic_titlethen
 -- Check if the article is using a {{DISPLAYTITLE}} or {{Italic title}} template.
 localtitle_modification=get_display_title_text(page_text,article_title)
 iftitle_modificationthen
 iftitle_modification==args.titlethen
 returnmaintenance_categories.unnecessary_title_parameter
 else
 returnmaintenance_categories.non_matching_title
 end
 end
 end

 localpage_name=get_page_name_with_apostrophe_quotation_fixes(frame,article_title)

 -- Remove nowrap span.
 ifstring.find(args.title,"nowrap")then
 localtitle=frame:expandTemplate{title="Strip tags",args={args.title}}
 iftitle==page_namethen
 return""
 end
 returnmaintenance_categories.non_matching_title
 end

 -- Remove line breaks and additional spaces as a result.
 ifstring.find(args.title,"<br%s?/?>")then
 localtitle=get_name_with_br_fixes(args.title)
 iftitle==page_namethen
 return""
 end
 returnmaintenance_categories.non_matching_title
 end

 ifargs.title==page_namethen
 returnmaintenance_categories.unnecessary_title_parameter
 end

 -- Article and infobox titles do not match.
 returnmaintenance_categories.non_matching_title
 end

 --- Returns the relevant maintenance categories based on the {{Infobox television episode}} values validated.
 ---
 --- @param frame table
 --- @return string
 functionp.validate_values(frame)
 localgetArgs=require("Module:Arguments").getArgs
 localargs=getArgs(frame)

 ---@type string[]
 localcategories={}
 table.insert(categories,is_infobox_title_equal_to_article_title(frame,args))
 table.insert(categories,are_image_auxiliary_values_used_for_no_image(args))
 table.insert(categories,is_image_using_incorrect_syntax(args.image))
 table.insert(categories,is_image_size_using_px(args.image_size))
 table.insert(categories,are_values_links_only(args))
 table.insert(categories,are_values_using_overall(args))
 table.insert(categories,are_values_formatted(args))
 table.insert(categories,are_values_linked(args))
 table.insert(categories,has_flag_icon(args))
 table.insert(categories,uses_list_markup(args))
 table.insert(categories,are_dates_formatted_correctly(args.airdateorargs.released))
 table.insert(categories,is_italic_title_valid_value(args))

 returntable.concat(categories)
 end

 --- Returns an {{Italic dab2}} instance if title qualifies. Also returns a maintenance category if conditions are met.
 ---
 --- The article's title is italicized if the series name is included in the article's title disambiguation.
 --- No italicization happens if one of the following conditions is met:
 ---
 --- - |italic_title= is set to "no".
 --- - The article's title does not use disambiguation.
 --- - No |series= value is set.
 --- - The article's disambiguation is not equal or does not include the series name.
 ---
 --- The page is added to a maintenance category if the title is italicized and there is already an
 --- {{Italic dab}}, {{Italic title}} or {{DISPLAYTITLE}} template.
 ---
 --- Infobox parameters checked:
 --- - |series=
 --- - |italic_title=
 ---
 --- Testing parameters:
 --- - |page_test= - a real Wikipedia page to read the content of the page.
 --- - |page_title_test= - the title of the page being checked.
 ---
 --- @param frame table
 --- @return string, string
 functionp.italic_title(frame)
 localgetArgs=require("Module:Arguments").getArgs
 localargs=getArgs(frame)

 localpage_text
 ifargs.page_testthen
 page_text=mw.title.new(args.page_test):getContent()
 else
 page_text=mw.title.getCurrentTitle():getContent()
 end

 localmaintenance_category=""
 -- In case the page does not need to be italicized or can't be automatically done, a "no" value will disable both
 -- the italicization and the error handling.
 ifargs.italic_title=="no"then
 return"",maintenance_category
 end

 localarticle_title=args.page_title_test
 ifnotargs.page_title_testthen
 article_title=mw.title.getCurrentTitle().text
 end

 -- Check if the page already has an {{Italic dab}}, {{Italic title}} or {{DISPLAYTITLE}} template.
 localhas_italic_dab,_=string.find(page_text,"{{[Ii]talic dab")
 localhas_italic_title,_=string.find(page_text,"{{[Ii]talic title")
 localhas_display_title,_=string.find(page_text,"{{DISPLAYTITLE")

 ifhas_italic_daborhas_italic_titleorhas_display_titlethen
 maintenance_category=maintenance_categories.manual_display_title
 end

 localtitle_parts=get_title_parts(article_title)

 -- The title is not italicized if the title does not use disambiguation or if the series parameter isn't used.
 ifnottitle_parts.disambiguationornotargs.seriesthen
 return"",maintenance_category
 end

 localseries_name_escaped,series_name=get_series_name(args.series)
 series_name_escaped=get_name_with_br_fixes(series_name_escaped)
 series_name=get_name_with_br_fixes(series_name)

 -- Check if the disambiguation equals the series name or if the series name can be found in the disambiguation.
 localitalic_dab
 iftitle_parts.disambiguation==series_namethen
 italic_dab=frame:expandTemplate{title="Italic dab2"}
 elseifstring.find(title_parts.disambiguation,series_name_escaped)then
 italic_dab=frame:expandTemplate{title="Italic dab2",args={string=series_name}}
 else
 return"",maintenance_category
 end

 ifargs.page_title_testanditalic_dabthen
 italic_dab="italic_dab"
 end
 returnitalic_dab,maintenance_category

 end

 --- Returns a formatted title string.
 ---
 --- @param rtitle string
 --- @return string
 localfunctioncreate_title_with_rtitle_value(rtitle)
 localtitle_pattern='"(.*)" and "(.*)"'
 ifstring.find(rtitle,title_pattern)then
 localepisode1,episode2=string.match(rtitle,title_pattern)
 localtitle_format="\"'''%s'''\" and \"'''%s'''\""
 returnstring.format(title_format,episode1,episode2)
 end

 localtitle_pattern_br='"(.*)" and%s?<br%s?/?>%s?"(.*)"'
 ifstring.find(rtitle,title_pattern_br)then
 localepisode1,episode2=string.match(rtitle,title_pattern_br)
 localtitle_format="\"'''%s'''\" and<br/> \"'''%s'''\""
 returnstring.format(title_format,episode1,episode2)
 end

 returnstring.format("'''%s'''",rtitle)
 end

 --- Returns the text used for the |above= field of the infobox.
 ---
 --- Infobox parameters checked:
 --- - |rtitle=
 --- - |title=
 --- - |series=
 ---
 --- Testing parameters:
 --- - |page_test= - a real Wikipedia page to read the content of the page.
 --- - |page_title_test= - the title of the page being checked.
 ---
 --- @param frame table
 --- @return string
 localfunction_above_title(frame,args)
 ifargs.rtitlethen
 returncreate_title_with_rtitle_value(args.rtitle)
 end

 localpage
 ifargs.page_testthen
 page=mw.title.new(args.page_test)
 else
 page=mw.title.getCurrentTitle()
 end

 localpage_text=page:getContent()

 localarticle_title=args.page_title_test
 ifnotargs.page_title_testthen
 article_title=page.text
 end

 localtitle_format="\"'''%s'''\""

 localcorrect_title=get_correct_title_value(page_text,args,false)
 ifcorrect_titlethen
 returnstring.format(title_format,correct_title)
 end

 localtitle_parts=get_title_parts(article_title)

 locallowercase_title=get_lowercase_template_status(page_text,args,title_parts)
 iflowercase_titlethen
 returnstring.format(title_format,lowercase_title)
 end

 localseries_name_escaped,_=get_series_name(args.series)

 -- args.no_bold is used from IMDb episode so it requires this correction here also.
 if(args.italic_titleandnotargs.rtitle)orargs.no_boldthen
 localtitle_modification=get_display_title_text(page_text,article_title)

 iftitle_modificationthen
 iftitle_parts.disambiguation==series_name_escapedthen
 localcorrect_title_title_parts=get_title_parts(title_modification)
 title_modification=correct_title_title_parts.title
 end
 returnstring.format(title_format,title_modification)
 end
 end

 ifargs.titlethen
 returnstring.format(title_format,args.title)
 end

 ifnottitle_parts.disambiguationor(series_name_escaped~=""and(title_parts.disambiguation==series_name_escapedorstring.find(title_parts.disambiguation,series_name_escaped)))orargs.no_boldthen
 returnstring.format(title_format,get_page_name_with_apostrophe_quotation_fixes(frame,title_parts.title))
 end

 returnstring.format(title_format,get_page_name_with_apostrophe_quotation_fixes(frame,article_title))
 end

 --- Returns the episode title from the article title, with textual fixes if needed.
 ---
 --- Used by {{Infobox television episode}} and {{IMDb episode}} to automatically style the title without needing manual input.
 ---
 --- @param frame table
 --- @return string
 functionp.above_title(frame)
 localgetArgs=require("Module:Arguments").getArgs
 localargs=getArgs(frame)
 localtitle=_above_title(frame,args)

 -- The title used by {{IMDb episode}} should not be in bold.
 ifargs.no_boldthen
 title=string.gsub(title,"'''","")
 end
 returntitle
 end

 --- Returns a list of episodes link if not formatted, otherwise returns the text used for args.episode_list.
 ---
 --- Infobox parameters checked:
 --- - |episode_list=
 --- - |series=
 ---
 --- @param frame table
 --- @return string
 functionp.episode_list(frame)
 localgetArgs=require("Module:Arguments").getArgs
 ---@type table<string, string>
 localargs=getArgs(frame)

 ifargs.episode_listthen
 for_,vinpairs({"]]","''"})do
 ifstring.find(args.episode_list,v)then
 returnargs.episode_list
 end
 end

 ifstring.find(args.episode_list,"[Ss]toryline")then
 return"[["..args.episode_list.."|Storylines]]"
 end

 return"[["..args.episode_list.."|List of episodes]]"
 end

 ifargs.seriesthen
 localseries_name=get_series_link(args.series)
 locallist_of_episodes="List of "..series_name.." episodes"

 ifmw.title.new(list_of_episodes):getContent()then
 return"[["..list_of_episodes.."|List of episodes]]"
 end
 end
 end

 --- Returns the relevant maintenance categories based on the {{Infobox television crossover episode}} values validated.
 ---
 --- @param frame table
 --- @return string
 functionp.validate_values_crossover(frame)
 localgetArgs=require("Module:Arguments").getArgs
 localargs=getArgs(frame)

 ---@type string[]
 localcategories={}
 table.insert(categories,are_image_auxiliary_values_used_for_no_image(args))
 table.insert(categories,is_image_using_incorrect_syntax(args.image))
 table.insert(categories,is_image_size_using_px(args.image_size))
 table.insert(categories,has_flag_icon(args))
 table.insert(categories,are_dates_formatted_correctly(args.airdate_overall))

 fori=1,5do
 ifnotargs["series"..i]then
 break
 end

 localnested_args={
 series=args["series"..i],
 episode=args["episode_no"..i],
 season=args["season"..i],
 airdate=args["airdate"..i],
 prev=args["prev"..i],
 next=args["next"..i],
 episode_list=args["episode_list"..i],
 }

 table.insert(categories,are_values_links_only(nested_args))
 table.insert(categories,are_values_using_overall(nested_args))
 table.insert(categories,are_values_formatted(nested_args))
 table.insert(categories,are_values_linked(nested_args))
 table.insert(categories,are_dates_formatted_correctly(nested_args.airdate))
 end

 returntable.concat(categories,"")
 end

 returnp

AltStyle によって変換されたページ (->オリジナル) /