Jump to content

Module:Sandbox/Gonnym/episodewikidata

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Gonnym (talk | contribs) at 17:37, 27 May 2019. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- This module requires the use of the following modules.
local getArgs = require('Module:Arguments').getArgs
local validateDisambiguation = require('Module:Sandbox/Gonnym/Infobox disambiguation check')

local p = {}

local validDisambiguationTypeList = {
	"TV series, season",
	"TV series, series",
	"season",
	"series"
}

local validDisambiguationPatternList = {
	validateDisambiguation.DisambiguationPattern{pattern = "^(%d+) (%d+)", type = 4}, --"VALIDATION_TYPE_YEAR_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "([%D]+) (%d+)", type = 5}, -- "VALIDATION_TYPE_COUNTRY_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "(%d+)", type = 6}, -- "VALIDATION_TYPE_SEASON_NUMBER"
}

local validDisambiguationPatternListOLD = {
	validateDisambiguation.DisambiguationPattern{pattern = "^(%d+) TV series, season (%d+)", type = 4}, --"VALIDATION_TYPE_YEAR_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "^(%d+) TV series, series (%d+)", type = 4},
	validateDisambiguation.DisambiguationPattern{pattern = "([%D]+) season (%d+)", type = 5}, -- "VALIDATION_TYPE_COUNTRY_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "([%D]+) series (%d+)", type = 5},
	validateDisambiguation.DisambiguationPattern{pattern = "season (%d+)", type = 6}, -- "VALIDATION_TYPE_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "series (%d+)", type = 6} 
}

-- Currently unused lists that need to be passed to the base module.
local exceptionList = {}
local otherInfoboxList = {}

local function _main(args)
	local title = args[1]
	return validateDisambiguation.main(title, validDisambiguationTypeList, validDisambiguationPatternList, exceptionList, otherInfoboxList)
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