มอดูล:Infobox television season disambiguation check

จากวิกิพีเดีย สารานุกรมเสรี
Documentation icon คู่มือการใช้งานมอดูล[สร้าง]
-- This module requires the use of the following modules.
local getArgs = require('มอดูล:Arguments').getArgs
local validateDisambiguation = require('มอดูล:Television infoboxes disambiguation check')

local p = {}

local validDisambiguationTypeList = {
	"ซีรีส์โทรทัศน์, ฤดูกาล",
	"ซีรีส์โทรทัศน์, ซีรีส์",
	"ซีซั่น", "ซีซั่นที่",
	"ซีซัน", "ซีซันที่",
	"ฤดูกาล", "ฤดูกาลที่",
	"ซีรีส์",
	"ละครชุด"
}

local validDisambiguationPatternList = {
	validateDisambiguation.DisambiguationPattern{pattern = "^(%d+) ([%D]+) ซีรีส์โทรทัศน์, ฤดูกาลที่ (%d+)$", type = 8},	-- "VALIDATION_TYPE_YEAR_COUNTRY_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "^(%d+) ([%D]+) ซีรีส์โทรทัศน์, ซีรีส์ (%d+)$", type = 8},	-- "VALIDATION_TYPE_YEAR_COUNTRY_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "^(%d+) ซีรีส์โทรทัศน์, ฤดูกาลที่ (%d+)$", type = 4},			-- "VALIDATION_TYPE_YEAR_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "^(%d+) ซีรีส์โทรทัศน์, ซีรีส์ (%d+)$", type = 4},
	validateDisambiguation.DisambiguationPattern{pattern = "^([%D]+) ซีรีส์โทรทัศน์, ฤดูกาลที่ (%d+)$", type = 5},			-- "VALIDATION_TYPE_COUNTRY_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "^([%D]+) ซีรีส์โทรทัศน์, ซีรีส์ (%d+)$", type = 5},
	validateDisambiguation.DisambiguationPattern{pattern = "^([%D]+) ฤดูกาลที่ (%d+)$", type = 5},						-- "VALIDATION_TYPE_COUNTRY_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "^([%D]+) ซีรีส์ (%d+)$", type = 5},
	validateDisambiguation.DisambiguationPattern{pattern = "^([%D]+) season$", type = 7},							-- "VALIDATION_TYPE_COUNTRY_SEASON"
	validateDisambiguation.DisambiguationPattern{pattern = "^ฤดูกาลที่ (%d+)$", type = 6},								-- "VALIDATION_TYPE_SEASON_NUMBER"
	validateDisambiguation.DisambiguationPattern{pattern = "^ฤดูกาล (%d+)$", type = 6},
	validateDisambiguation.DisambiguationPattern{pattern = "^ซีซั่น (%d+)$", type = 6},
	validateDisambiguation.DisambiguationPattern{pattern = "^ซีซัน (%d+)$", type = 6},
	validateDisambiguation.DisambiguationPattern{pattern = "^ซีซั่นที่ (%d+)$", type = 6},
	validateDisambiguation.DisambiguationPattern{pattern = "^ซีซันที่ (%d+)$", type = 6},
	validateDisambiguation.DisambiguationPattern{pattern = "^ซีรีส์ (%d+)$", type = 6}
}

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 = {
	["^[^,]*รายการโทรทัศน์$"] = "[[หมวดหมู่:บทความเกี่ยวกับโทรทัศน์ที่ใช้กล่องข้อมูลที่ไม่ถูกต้อง]]"
}

local invalidTitleStyleList = {
	"รายชื่อ"
}

local function getOtherInfoboxListMerged()
	local infoboxTelevisionDisambiguation = require('มอดูล:Infobox television disambiguation check')
	local list = infoboxTelevisionDisambiguation.getDisambiguationTypeList()

	for i = 1, #list do
		otherInfoboxList[list[i]] = "[[หมวดหมู่:บทความเกี่ยวกับโทรทัศน์ที่ใช้กล่องข้อมูลที่ไม่ถูกต้อง]]"
	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