Module:Infobox television disambiguation check
Appearance
![]() | This Lua module is used on approximately 69,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
The module preforms two checks:
- 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:
- Validates the format used is one of the accepted values.
- Validates the country adjective used is correct.
- Validates the year is using 4 digits.
- Validates that the style is ordered as <year> <country adjective> <format>.
- 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
Parameter list
The following parameter can be used as a positional parameter.
Parameter | Explanation | Status |
---|---|---|
1
|
The page's title. | required |
See also
Tracking categories
-- This module requires the use of Module:Arguments.
local getArgs = require('Module:Arguments').getArgs
local p = {}
local validNameList = {
"TV series",
"TV program",
"TV programme",
"TV film",
"film",
"miniseries",
"serial",
"game show",
"talk show",
"web series"
}
local franchise = "franchise"
local categoryList = {
["incorrect"] = "[[Category:Television articles with incorrect naming style]]",
["franchise"] = "[[Category:Television articles using incorrect infobox|F]]"
}
local isValid = false
local category = ""
local function _main(args)
if (args[1] == nil or args[1] == "") then
return ""
end
local disambiguation = string.match(args[1], "%s%((.-)%)")
if (not disambiguation) then
-- Nothing to check.
return ""
end
for _, v in ipairs(validNameList) do
if (not string.match(disambiguation, v)) then
-- Name not valid, do nothing.
else
-- Name valid, set isValid to true.
isValid = true
break
end
end
if (string.match(disambiguation, franchise)) then
isValid = true
category = categoryList["franchise"]
end
if (not isValid) then
category = categoryList["incorrect"]
end
return category
end
function p.main(frame)
local args = getArgs(frame)
return _main(args)
end
return p