Content deleted Content added
No edit summary |
No edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 57:
--- @param title string The article's title.
--- @return string | nil
local function
return match(title , "%d+", 1, -1, false, "")
end
Line 132:
name, _ = mw.ustring.gsub(name, "series %d*$", "")
name, _ = mw.ustring.gsub(name, "specials", "")
name, _ = mw.ustring.gsub(name, "story arc %d*$", "")
name = string.match(name, "^%s*(.-)%s*$") -- Trim spaces.
return name
Line 196 ⟶ 197:
local function getArticleTitleAndPipedLink(title, seasonNumberDiff)
local seasonType = getSeasonType(title)
local seasonNumber =
if tonumber(seasonNumber) == nil then
return "", nil
Line 232 ⟶ 233:
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
if args.italic_title then
return "no"
end
local title = args.title
if not title then
title = mw.title.getCurrentTitle().text
Line 308 ⟶ 312:
end
--- Returns
--- @param frame table
--- @return string
function p.getItalicTitle(frame)
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
-- If italic_title is set then "no" is the only valid value.
-- Don't set an italic title.
if args.italic_title then
return ""
end
local title = getTitle(frame)
title = getShowName(getTitleWithoutDisambiguation(title))
-- If the infobox is used on List of articles don't set an italic title.
-- TODO: this can be fixed in the future but current usages use a manual display title.
if string.find(title, "List of") then
return ""
end
return frame:expandTemplate{title = "Italic title", args = {string = title}}
end
--- Returns the text used for the |above= field of the infobox.
---
--- @param frame table
--- @return string
function p.getAboveTitle(frame)
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
local title = getTitle(frame)
title = getShowName(getTitleWithoutDisambiguation(title))
end
--- Returns the text used for the |subheader= field of the infobox.
---
--- The text is returned in the format of "Season #" or "Series #",
Line 314 ⟶ 356:
--- @param frame table The frame invoking the module.
--- @return string | nil
function p.
local getArgs = require("Module:Arguments").getArgs
local args = getArgs(frame)
Line 331 ⟶ 373:
local title = getTitle(frame)
local titleWithoutDisambiguation = getTitleWithoutDisambiguation(title)
seasonNumber =
seasonType = getSeasonType(titleWithoutDisambiguation)
-- For pages like "Doctor Who specials (2008–2010)".
if seasonType == "specials" then
return disambiguation .. " " .. seasonType
end
seasonType = seasonType:sub(1, 1):upper() .. seasonType:sub(2)
Line 372 ⟶ 415:
local title = getTitle(frame)
local showName = getShowName(getTitleWithoutDisambiguation(title))
▲ mw.log(title)
if showName then
local disambiguation = getDisambiguation(title)
if disambiguation then
disambiguation = " (" .. disambiguation .. ")"
end
|