Modul:Infobox television season name: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
RaFaDa20631 (bicara | kontrib) Tidak ada ringkasan suntingan |
RaFaDa20631 (bicara | kontrib) Tidak ada ringkasan suntingan |
||
Baris 1:
local match = require("Module:String")._match
Baris 40 ⟶ 39:
end
--- Returns the type of word used for "
---
--- The returned value can be one of three options: "
--- @param
--- @return string
local function getSeasonType(
for _, seasonType in pairs({"musim", "seri", "story arc", "
if string.find(
return seasonType
end
end
return "
end
--- Returns the
--- @param
--- @return string
local function
return shortDisambiguation
end
Baris 66:
local function getDisambiguation(title)
local disambiguation = match(title, "%s%((.-)%)", 1, -1, false, "")
if
return nil
end
return disambiguation
end
Baris 129 ⟶ 118:
--- @return string
local function getShowName(title)
local name, _ = mw.ustring.gsub(title, "
return name
end
Baris 179 ⟶ 164:
---
--- The following are the supported season naming styles:
--- -- Style: <showName> (<seasonType> <seasonNumber>)
--- Example: Lost (season 2).
--- Example: Doctor Who (series 2).
--- -- Style: <showName> (<country>
--- Example: The Office (American
--- Example:
--- -- Style: <showName> (<country> <seasonType>)
--- Example: Big Brother 2 (American season).
--- -- Style: <showName> (<year> TV series, <seasonType> <seasonNumber>)
--- Example: Teenage Mutant Ninja Turtles (1987 TV series, season 2)
--- -- Style: <showName> (<country> TV series, <seasonType> <seasonNumber>)
--- Example: Love Island (British TV series, series 2)
--- @param title string The article's title.
--- @param seasonNumberDiff number The number difference between the current season and the other season.
--- @return string, string
local function getArticleTitleAndPipedLink(title, seasonNumberDiff)
local
local shortDisambiguation
local seasonType
local seasonNumber
local pipedLink = ""
if disambiguation then
shortDisambiguation = getShortDisambiguation(disambiguation)
seasonType = getSeasonType(shortDisambiguation)
seasonNumber = getCurrentSeasonNumberFromDisambiguation(shortDisambiguation)
pipedLink = seasonType:gsub("^%l", string.upper) .. " "
end
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
-- Titles such as "Big Brother 1 (American season)".
if showNameModified and disambiguation then
return showNameModified .. " " .. seasonNumber .. " (" .. disambiguation .. ")", pipedLink
-- Titles such as "Big Brother Brasil
elseif
return
-- Invalid usages of TV series articles with the television season infobox.
elseif
return "", nil
-- Standard titles such as "Lost (season 1)".
else
local newDisambiguation, _ = string.gsub(disambiguation, "%d+$", seasonNumber)
return showName .. " (" .. newDisambiguation .. ")", pipedLink
end
end
Baris 233 ⟶ 234:
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
local title = args.title
if not title then
title = mw.title.getCurrentTitle().text
Baris 302 ⟶ 300:
end
--- Returns the type of season word used - "season" or "
--- @param frame table The frame invoking the module.
--- @return string
function p.getSeasonWord(frame)
local title = getTitle(frame)
local disambiguation = getDisambiguation(title)
if not disambiguation then
return ""
end
local shortDisambiguation = getShortDisambiguation(disambiguation)
local seasonType = getSeasonType(shortDisambiguation)
if seasonType == "spesials" then
seasonType = "season"
end
return seasonType
end
--- Returns the relevant text
---
--- The text is returned in the format of "Season #" or "Seri #",
--- depending on either what the article disambiguation uses, or on the manually entered parameters of the infobox.
--- @param frame table The frame invoking the module.
--- @return string | nil
function p.
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
Baris 366 ⟶ 335:
seasonNumber = args.season_number
elseif args.series_number then
seasonType = "
seasonNumber = args.series_number
end
local title = getTitle(frame)
if not seasonNumber and disambiguation then
local shortDisambiguation = getShortDisambiguation(disambiguation)
seasonType = getSeasonType(shortDisambiguation)
if seasonType == "spesials" then
return shortDisambiguation
end
seasonType = seasonType:sub(1, 1):upper() .. seasonType:sub(2)
seasonNumber = getCurrentSeasonNumberFromDisambiguation(shortDisambiguation)
end
Baris 414 ⟶ 382:
local title = getTitle(frame)
local showName = getShowName
if showName then
local disambiguation = getDisambiguation(title)
local TVProgramDisambiguation = getTVProgramDisambiguation(disambiguation)
local listOfEpisodesArticle = string.format("List of %s%s episodes", showName, TVProgramDisambiguation)
return getListOfEpisodesLink(listOfEpisodesArticle)
end
|