Jump to content
Wikipedia The Free Encyclopedia

Module:Infobox television disambiguation check/sandbox

From Wikipedia, the free encyclopedia
This is the module sandbox page for Module:Infobox television disambiguation check (diff).
See also the companion subpage for test cases (run).
Module documentation[view] [edit] [history] [purge]
Warning This Lua module is used on approximately 70,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 disambiguation check is used to validate the disambiguation of a page using {{Infobox television }}.

What it does

[edit ]

The module preforms two checks:

  1. It checks by a series of validations if one of the accepted WP:NCTV disambiguation styles appears in the parenthesis. If it is incorrect, it places the page in Category:Television articles with incorrect naming style. Validations currently supported:
    1. Validates the format used is one of the accepted values.
    2. Validates the country adjective used is correct.
    3. Validates the year is using 4 digits.
    4. Validates that the style is ordered as <year> <country adjective> <format>.
  2. It checks if a page is using "(film series)", "(franchise)", "(radio)", "(season #)", "(series #)" or "(TV programming block)" as disambiguation, but uses {{Infobox television }} instead of {{Infobox media franchise }}, {{Infobox radio show }}, {{Infobox television season }} or {{Infobox programming block }}}. If so, it places the page in Category:Television articles using incorrect infobox.

Usage

[edit ]

Parameter list

[edit ]

The following parameter can be used as a positional parameter.

Parameter Explanation Status
1 The page's title. required

False positives

[edit ]

If a title has disambiguation as part of its title, such as Snoopy Presents: To Mom (and Dad), With Love, the module will detect it as an incorrect title. To manually tell the module to allow this title, add it to the exceptionList.

See also

[edit ]

Tracking categories

[edit ]
The above documentation is transcluded from Module:Infobox television disambiguation check/doc. (edit | history)
Editors can experiment in this module's sandbox (edit | diff) and testcases (edit | run) pages.
Add categories to the /doc subpage. Subpages of this module.
 require("strict")

 localgetArgs=require("Module:Arguments").getArgs
 localvalidateDisambiguation=require("Module:Television infoboxes disambiguation check/sandbox")

 localp={}

 -----------------------------------------------------------------------
 -- Valid disambiguation types for infobox television
 -----------------------------------------------------------------------
 localvalidDisambiguationTypeList={
 "TV series",
 "TV programme",
 "TV program",
 "TV film",
 "film",
 "miniseries",
 "serial",
 "game show",
 "talk show",
 "web series"
 }

 -----------------------------------------------------------------------
 -- Valid disambiguation patterns (AFTER removing type)
 -----------------------------------------------------------------------
 localvalidDisambiguationPatternList={
 -- YEAR + COUNTRY → "1999 American"
 validateDisambiguation.DisambiguationPattern{
 pattern="^(%d+)%s+(%D+)$",
 type=validateDisambiguation.VALIDATION_TYPE_YEAR_COUNTRY
 },

 -- YEAR ONLY → "1999"
 validateDisambiguation.DisambiguationPattern{
 pattern="^%d+$",
 type=validateDisambiguation.VALIDATION_TYPE_YEAR
 },

 -- COUNTRY ONLY → "American"
 validateDisambiguation.DisambiguationPattern{
 pattern="^%D+$",
 type=validateDisambiguation.VALIDATION_TYPE_COUNTRY
 }
 }

 -----------------------------------------------------------------------
 -- Titles where parentheses are NOT disambiguation
 -----------------------------------------------------------------------
 localexceptionList={
 "The (206)",
 "Bigg Boss (Hindi TV series)",
 "Bigg Boss (Malayalam TV series)",
 "Bigg Boss (Tamil TV series)",
 "Bigg Boss (Telugu TV series)",
 "Cinderella (Apakah Cinta Hanyalah Mimpi?)",
 "Deal or No Deal Malaysia (English-language game show)",
 "Deal or No Deal Malaysia (Mandarin-language game show)",
 "How to Live with Your Parents (For the Rest of Your Life)",
 "How to Sell Drugs Online (Fast)",
 "I (Almost) Got Away With It",
 "Kevin (Probably) Saves the World",
 "Love (ft. Marriage and Divorce)",
 "M.R.S. (Most Requested Show)",
 "Monty Python: Almost the Truth (Lawyers Cut)",
 "Off Sides (Pigs vs. Freaks)",
 "Randall and Hopkirk (Deceased)",
 "Wednesday 9:30 (8:30 Central)",
 "Who the (Bleep)...",
 "Who the (Bleep) Did I Marry?"
 }

 -----------------------------------------------------------------------
 -- Infoboxes that should NOT use this module
 -----------------------------------------------------------------------
 localotherInfoboxList={
 ["franchise"]="[[Category:Television articles using incorrect infobox|FRANCHISE]]",
 ["radio"]="[[Category:Television articles using incorrect infobox|R]]",
 ["season"]="[[Category:Television articles using incorrect infobox|S]]",
 ["series %d*"]="[[Category:Television articles using incorrect infobox|S]]",
 ["TV programming block"]="[[Category:Television articles using incorrect infobox|P]]",
 ["film series"]="[[Category:Television articles using incorrect infobox|FILM]]"
 }

 -----------------------------------------------------------------------
 -- No invalid title styles for this module
 -----------------------------------------------------------------------
 localinvalidTitleStyleList={}

 -----------------------------------------------------------------------
 -- Internal main
 -----------------------------------------------------------------------
 localfunction_main(args)
 localtitle=args[1]
 returnvalidateDisambiguation.main(
 title,
 "infobox television",
 validDisambiguationTypeList,
 validDisambiguationPatternList,
 exceptionList,
 otherInfoboxList,
 invalidTitleStyleList
 )
 end

 -----------------------------------------------------------------------
 -- Public entry point
 -----------------------------------------------------------------------
 functionp.main(frame)
 localargs=getArgs(frame)
 localcategory=_main(args)
 returncategory
 end

 -----------------------------------------------------------------------
 -- Utility: remove a value from an array
 -----------------------------------------------------------------------
 localfunctionremoveFromArray(t,delete)
 localj=1
 localn=#t

 fori=1,ndo
 ift[i]~=deletethen
 ifi~=jthen
 t[j]=t[i]
 t[i]=nil
 end
 j=j+1
 else
 t[i]=nil
 end
 end

 returnt
 end

 -----------------------------------------------------------------------
 -- Export list of disambiguation types EXCEPT "TV series"
 -- Used by the season module to detect incorrect infobox usage
 -----------------------------------------------------------------------
 functionp.getDisambiguationTypeList()
 returnremoveFromArray(mw.clone(validDisambiguationTypeList),"TV series")
 end

 -----------------------------------------------------------------------
 -- Test entry point (returns debug string)
 -----------------------------------------------------------------------
 functionp.test(frame)
 localargs=getArgs(frame)
 local_,debugString=_main(args)
 returndebugString
 end

 returnp

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