Module:Infobox television season name/sandbox2: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 194:
--- @return string, string
local function getArticleTitleAndPipedLink(title, seasonNumberDiff)
local disambiguation = getDisambiguation(title)
local seasonType = getSeasonType(title)
local seasonNumber = getSeasonNumberNew(title)
 
local showName = getShowName(title)
local showNameModified
if not seasonNumber or seasonNumber == "" then
-- Not a valid next/prev season link.
if not string.match(showName, "%s+(%d+)$") then
return "", nil
end
showNameModified, seasonNumber = getShowNameAndSeasonNumberFromShowName(showName)
end
 
if tonumber(seasonNumber) == nil then
return "", nil
end
 
seasonNumber = seasonNumber + seasonNumberDiff
local modifiedTitle = string.gsub(title, "%d+$", seasonNumber)
pipedLink = seasonType:gsub("^%l", string.upper) .. " " .. seasonNumber
 
local disambiguation = getDisambiguation(title)
-- Titles such as "Big Brother 1 (American season)".
if showNameModifieddisambiguation and disambiguation ~= "" then
return showNameModified .. " " .. seasonNumber .. " (" .. disambiguation .. ")"modifiedTitle, pipedLink
 
-- Titles such as "Big Brother Brasil 1".
elseif showNameModifiednot seasonType then
return showNameModified .. " " .. seasonNumbermodifiedTitle, nil
 
-- Invalid usages of TV series articles with the television season infobox.
Line 227 ⟶ 216:
return "", nil
 
-- Standard titles such as "Lost (season 1)".
else
return modifiedTitle, pipedLink
local r = showName .. " " .. seasonType .. " " .. seasonNumber , pipedLink
--mw.log(r)
return r
end
end
Line 266 ⟶ 253:
local title = getTitle(frame)
local articleTitle, pipedLink = getArticleTitleAndPipedLink(title, seasonNumberDiff)
mw.log(articleTitle)
mw.log(pipedLink)
return getArticleLink(articleTitle, pipedLink)
end