Jump to content

Module:Infobox television season disambiguation check/sandbox

From Wikipedia, the free encyclopedia
require("strict")

-- This module requires the use of the following modules.
local getArgs = require("Module:Arguments").getArgs
local validateDisambiguation = require("Module:Television infoboxes disambiguation check/sandbox")

local p = {}

local validDisambiguationTypeList = {
	"TV series",
}

local validDisambiguationPatternList = {
	-- "VALIDATION_TYPE_YEAR_COUNTRY_SEASON_NUMBER" - title (1999 American TV series) season 2
	validateDisambiguation.DisambiguationPattern{pattern = "^%((%d+) ([%D]+) TV series%) (season|series) (%d+)$", type = validateDisambiguation["VALIDATION_TYPE_YEAR_COUNTRY_SEASON_NUMBER"]},

	-- "VALIDATION_TYPE_YEAR_SEASON_NUMBER" - title (1999 TV series) season 2
	validateDisambiguation.DisambiguationPattern{pattern = "^%((%d+) TV series%) (season|series) (%d+)$", type = validateDisambiguation["VALIDATION_TYPE_YEAR_SEASON_NUMBER"]},

	-- "VALIDATION_TYPE_COUNTRY_SEASON_NUMBER" - title (American TV series) season 2
	validateDisambiguation.DisambiguationPattern{pattern = "^%(([%D]+) TV series%) (season|series) (%d+)$", type = validateDisambiguation["VALIDATION_TYPE_COUNTRY_SEASON_NUMBER"]},

	-- "VALIDATION_TYPE_COUNTRY_SEASON_NUMBER" - title season 2
	validateDisambiguation.DisambiguationPattern{pattern = "^(season|series) (%d+)$", type = validateDisambiguation["VALIDATION_TYPE_SEASON_NUMBER"]},
}

local exceptionList = {
	"^Bigg Boss %(Bangla season %d+%)$",
	"^Bigg Boss %(Hindi season %d+%)$",
	"^Bigg Boss %(Malayalam season %d+%)$",
	"^Bigg Boss %(Tamil season %d+%)$",
	"^Bigg Boss %(Telugu season %d+%)$"
}

local otherInfoboxList = {
	["^[^,]*TV series$"] = "[[Category:Television articles using incorrect infobox|T]]"
}

local invalidTitleStyleList = {
	"List of"
}

local function getOtherInfoboxListMerged()
	local infoboxTelevisionDisambiguation = require("Module:Infobox television disambiguation check")
	local list = infoboxTelevisionDisambiguation.getDisambiguationTypeList()

	for i = 1, #list do
		otherInfoboxList[list[i]] = "[[Category:Television articles using incorrect infobox|T]]"
	end
	
	return otherInfoboxList
end

local function _main(args)
	local title = args[1]
	local otherInfoboxListMerged = getOtherInfoboxListMerged()
	return validateDisambiguation.main(title, "infobox television season", validDisambiguationTypeList, validDisambiguationPatternList, exceptionList, otherInfoboxListMerged, invalidTitleStyleList)
end

function p.main(frame)
	local args = getArgs(frame)
	local category, debugString = _main(args)
	return category
end

function p.test(frame)
	local args = getArgs(frame)
	local category, debugString = _main(args)
	return debugString
end

return p