Difference between revisions of "Module:Infobox television disambiguation check/sandbox"

From blackwiki
Jump to navigation Jump to search
test>Gonnym
m (46 revisions imported)
 
(9 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
-- This module requires the use of the following modules.
 
-- This module requires the use of the following modules.
 
local getArgs = require('Module:Arguments').getArgs
 
local getArgs = require('Module:Arguments').getArgs
−
local validateDisambiguation = require('Module:Television infoboxes disambiguation check')
+
local validateDisambiguation = require('Module:Television infoboxes disambiguation check/sandbox')
  
 
local p = {}
 
local p = {}
Line 7: Line 7:
 
local validDisambiguationTypeList = {
 
local validDisambiguationTypeList = {
 
"TV series",
 
"TV series",
 +
"TV programme",
 
"TV program",
 
"TV program",
−
"TV programme",
 
 
"TV film",
 
"TV film",
 
"film",
 
"film",
Line 26: Line 26:
 
local exceptionList = {
 
local exceptionList = {
 
"The (206)",
 
"The (206)",
 +
"Bigg Boss (Hindi TV series)",
 
"Cinderella (Apakah Cinta Hanyalah Mimpi?)",
 
"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 Live with Your Parents (For the Rest of Your Life)",
 
"I (Almost) Got Away With It",
 
"I (Almost) Got Away With It",
 
"Monty Python: Almost the Truth (Lawyers Cut)",
 
"Monty Python: Almost the Truth (Lawyers Cut)",
 
"Randall and Hopkirk (Deceased)",
 
"Randall and Hopkirk (Deceased)",
 +
"Who the (Bleep)...",
 +
"Who the (Bleep) Did I Marry?",
 
}
 
}
  
 
local otherInfoboxList = {
 
local otherInfoboxList = {
−
["franchise"] = "[[Category:Television articles using incorrect infobox|F]]",
+
["franchise"] = "[[Category:Television articles using incorrect infobox|FRANCHISE]]",
 +
["radio"] = "[[Category:Television articles using incorrect infobox|R]]",
 
["season"] = "[[Category:Television articles using incorrect infobox|S]]",
 
["season"] = "[[Category:Television articles using incorrect infobox|S]]",
−
["radio"] = "[[Category:Television articles using incorrect infobox|R]]"
+
["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]]"
 
}
 
}
 +
 +
-- Empty for now.
 +
local invalidTitleStyleList = {}
  
 
local function _main(args)
 
local function _main(args)
 
local title = args[1]
 
local title = args[1]
−
return validateDisambiguation.main(title, validDisambiguationTypeList, validDisambiguationPatternList, exceptionList, otherInfoboxList)
+
return validateDisambiguation.main(title, "infobox television", validDisambiguationTypeList, validDisambiguationPatternList, exceptionList, otherInfoboxList, invalidTitleStyleList)
 
end
 
end
  
Line 48: Line 59:
 
local category, debugString = _main(args)
 
local category, debugString = _main(args)
 
return category
 
return category
 +
end
 +
 +
local function removeFromArray(t, delete)
 +
    local j = 1
 +
    local n = #t
 +
 +
    for i = 1, n do
 +
        if (t[i] ~= delete) then
 +
            -- Move i's kept value to j's position, if it's not already there.
 +
            if (i ~= j) then
 +
                t[j] = t[i]
 +
                t[i] = nil
 +
            end
 +
            j = j + 1 -- Increment position of where we'll place the next kept value.
 +
        else
 +
            t[i] = nil
 +
        end
 +
    end
 +
 +
    return t
 +
end
 +
 +
function p.getDisambiguationTypeList()
 +
return removeFromArray(validDisambiguationTypeList, "TV series")
 
end
 
end
  

Latest revision as of 12:55, 19 September 2020

Documentation for this module may be created at Module:Infobox television disambiguation check/sandbox/doc

-- 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",
	"TV programme",
	"TV program",
	"TV film",
	"film",
	"miniseries",
	"serial",
	"game show",
	"talk show",
	"web series"
}

local validDisambiguationPatternList  = {
	validateDisambiguation.DisambiguationPattern{pattern = "^(%d+) (%D+)", type = 1}, --"VALIDATION_TYPE_YEAR_COUNTRY"
	validateDisambiguation.DisambiguationPattern{pattern = "^%d+$", type = 2}, --"VALIDATION_TYPE_YEAR"
	validateDisambiguation.DisambiguationPattern{pattern = "^%D+$", type = 3} --"VALIDATION_TYPE_COUNTRY"
}

local exceptionList = {
	"The (206)",
	"Bigg Boss (Hindi 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)",
	"I (Almost) Got Away With It",
	"Monty Python: Almost the Truth (Lawyers Cut)",
	"Randall and Hopkirk (Deceased)",
	"Who the (Bleep)...",
	"Who the (Bleep) Did I Marry?",
}

local otherInfoboxList = {
	["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]]"
}

-- Empty for now.
local invalidTitleStyleList = {}

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

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

local function removeFromArray(t, delete)
    local j = 1
    local n = #t

    for i = 1, n do
        if (t[i] ~= delete) then
            -- Move i's kept value to j's position, if it's not already there.
            if (i ~= j) then
                t[j] = t[i]
                t[i] = nil
            end
            j = j + 1 -- Increment position of where we'll place the next kept value.
        else
            t[i] = nil
        end
    end

    return t
end

function p.getDisambiguationTypeList()
	return removeFromArray(validDisambiguationTypeList, "TV series")
end

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

return p