Content deleted Content added
No edit summary Tag: Reverted |
|||
Line 37:
local function getCurrentSeasonNumberFromDisambiguation(disambiguation)
return match(disambiguation , "%d+", 1, -1, false, "")
end▼
--- @param title string The article's title.▼
--- @return string | nil▼
local function getDisambiguation(title)▼
local disambiguation = match(title, "%s%((.-)%)", 1, -1, false, "")▼
if disambiguation == "" then▼
return nil▼
end▼
end▼
--- Returns the title without its disambiguation.▼
local function getTitleWithoutDisambiguation(title)▼
local disambiguation = match(title, "%s%((.-)%)", 1, -1, false, "")▼
return string.gsub(title, "%(" .. disambiguation .. "%)", "")▼
end
Line 67 ⟶ 45:
--- @return string
local function getSeasonType(title)
if string.find(getTitleWithoutDisambiguation(title), seasonType) then▼
return seasonType
end
end
return "season"
end
Line 99 ⟶ 64:
local function getSeasonNumberNew(title)
return match(title , "%d+", 1, -1, false, "")
▲end
▲--- Returns the title without its disambiguation.
▲--- @param title string The article's title.
▲--- @return string | nil
▲local function getTitleWithoutDisambiguation(title)
▲ local disambiguation = match(title, "%s%((.-)%)", 1, -1, false, "")
▲ return string.gsub(title, "%(" .. disambiguation .. "%)", "")
▲ end
▲end
--TODO: keep for now
▲local function getDisambiguation(title)
end
Line 220 ⟶ 201:
local disambiguation = getDisambiguation(title)
-- Titles such as "Big Brother 2 (American season) and Teenage Mutant Ninja Turtles (1987 TV series) season 2".
if disambiguation and disambiguation ~= "" then
local titleWithoutDisambiguation = string.gsub(title, disambiguation, "_DAB_")
modifiedTitle = string.gsub(titleWithoutDisambiguation, "%d+", seasonNumber)
Line 233 ⟶ 213:
-- Invalid usages of TV series articles with the television season infobox.
elseif
return "", nil
Line 319 ⟶ 299:
function p.getSeasonWord(frame)
local title = getTitle(frame)
local seasonType = getSeasonType(title)
if seasonType == "specials" then
Line 349 ⟶ 330:
if not seasonNumber then
local title = getTitle(frame)
seasonNumber = getSeasonNumberNew(
seasonType = getSeasonType(title)
--TODO: need to check where this is used
if seasonType == "specials" then
return
end
seasonType = seasonType:sub(1, 1):upper() .. seasonType:sub(2)
|