This is an old revision of this page, as edited by Gonnym(talk | contribs) at 11:36, 4 January 2019(creating sandbox version). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.Revision as of 11:36, 4 January 2019 by Gonnym(talk | contribs)(creating sandbox version)
The following parameters can be used as named parameters or nameless positional parameters.
Parameter
Explanation
Status
title
The title of TV program. If not supplied, will use the article title.
optional
link
Only for getListOfEpisodes. The plain link to the list of episode article. If not supplied, will create one based on the series name.
optional
Function list
Function
Explanation
checkAll
Checks if the next or previous season have a created article or redirect.
checkPrevSeason
Checks if the previous season has a created article or redirect.
checkNextSeason
Checks if the next season has a created article or redirect.
getPrevSeasonArticle
Retrieves the previous season article title.
getNextSeasonArticle
Retrieves the next season article title.
getSeasonWord
Returns either the word "season" or "series" as used in the disambiguation of the article title.
getInfoboxSubHeader
Returns the relevant text for the sub-header field. The text is returned in the format of Season # or Series #, depending on either what the article disambiguation uses, or on manually entered parameters of the infobox.
getListOfEpisodes
Returns the formatted link to the list of episodes article in the style of: [[List of <series name> <disambiguation if present> episodes <seasons if present>|List of ''<series name>'' episodes <seasons if present>]]. The link will only return if the page exists.
-- This module requires the use of Module:Arguments.localgetArgs=require('Module:Arguments').getArgslocalpipedLinklocalp={}-- Local function which is used to create an pipped article link.localfunctioncreateArticleTitleWithPipedLink(article)return"[["..article.."|"..pipedLink.."]]"end-- Local function which is used to check if the given article exists.localfunctioncheckArticle(articleName)localarticle=mw.title.new(articleName)if(article~=nilandarticle.exists)thenreturn"true"elsereturnnilendend-- Local function which is used to create a TV season link.localfunctioncreateLink(args,number)localshowName=args[1]orargs['show_name']if(showName==nil)thenshowName=""elseshowName=showName.." "endlocalpreSeasonQualifier=args[2]orargs['pre_season_qualifier']if(preSeasonQualifier==nil)thenpreSeasonQualifier=""elsepreSeasonQualifier=preSeasonQualifier.." "endlocalseasonQualifier=args[3]orargs['season_qualifier']if(seasonQualifier==nil)thenseasonQualifier=""elseseasonQualifier=seasonQualifier.." "endlocalseasonType=args[4]orargs['season_type']if(seasonType==nil)thenseasonType="season"endseasonType=seasonType.." "localseasonNumber=args[5]orargs['season_number']if(seasonNumber==nil)thenseasonNumber=0endif(tonumber(seasonNumber)==nil)thenreturn""elseseasonNumber=seasonNumber+numberpipedLink=seasonType:gsub("^%l",string.upper)..seasonNumberreturnshowName..preSeasonQualifier.."("..seasonQualifier..seasonType..seasonNumber..")"endend-- Local function which is called to create a TV season link for the next season.-- Passes the value "1" to increment the current season number.localfunctioncreateNextSeasonArticle(args)returncreateLink(args,1)end-- Local function which is called to create a TV season link for the previous season.-- Passes the value "-1" to decrement the current season number.localfunctioncreatePreviousSeasonArticle(args)returncreateLink(args,-1)end--[[Wrapper function which handles the processing of the arguments from multiple public invoked functions.Parameters: -- |show_name= — required; The title of TV program. -- |pre_season_qualifier= — optional; For cases where disambiguation before the season is required (e.g. the pre-season qualifier for Dallas (1978 TV series) (season 7) is (1978 TV series)). -- |season_qualifier= — optional; For cases where disambiguation (typically of the show's origin country) before the season type is required (e.g. the season qualifier for The Apprentice (U.S. season 2) is U.S.). -- |season_type= — optional; To determine the usage of the word "season" for American-based shows, or "series" for shows using British-English. -- |season_number= — optional; Season number. The N season of this particular show. --]]localfunctionmakeInvokeFunc(funcName)returnfunction(frame)localargs=getArgs(frame)returnp[funcName](args)endendp.checkNextSeason=makeInvokeFunc('_checkNextSeason')--[[Public function which is used to check if the next season hasa created article or redirect.Parameters: See makeInvokeFunc() for documentation.--]]functionp._checkNextSeason(args)localseasonNumber=args[5]orargs['season_number']if(seasonNumber==nil)thenreturnnilelselocalarticleName=createNextSeasonArticle(args)returncheckArticle(articleName)endendp.checkPrevSeason=makeInvokeFunc('_checkPrevSeason')--[[Public function which is used to check if the previous season hasa created article or redirect.Parameters: See makeInvokeFunc() for documentation.--]]functionp._checkPrevSeason(args)localseasonNumber=args[5]orargs['season_number']if(seasonNumber==nil)thenreturnnilelselocalarticleName=createPreviousSeasonArticle(args)returncheckArticle(articleName)endendp.checkAll=makeInvokeFunc('_checkAll')--[[Public function which is used to check if the next or previous season havea created article or redirect.Parameters: See makeInvokeFunc() for documentation.--]]functionp._checkAll(args)if(p._checkPrevSeason(args)=="true")thenreturn"true"elsereturnp._checkNextSeason(args)endendp.getNextSeasonArticle=makeInvokeFunc('_getNextSeasonArticle')--[[Public function which is used to get the next season article title.Parameters: See makeInvokeFunc() for documentation.--]]functionp._getNextSeasonArticle(args)localarticleTitle=createNextSeasonArticle(args)returncreateArticleTitleWithPipedLink(articleTitle)endp.getPrevSeasonArticle=makeInvokeFunc('_getPrevSeasonArticle')--[[Public function which is used to get the previous season article title.Parameters: See makeInvokeFunc() for documentation.--]]functionp._getPrevSeasonArticle(args)localarticleTitle=createPreviousSeasonArticle(args)returncreateArticleTitleWithPipedLink(articleTitle)endreturnp