Content deleted Content added
add oldid parameters for OTD, automatically link ITN dates, don't separate each date with "on" in date lists, and remove the tracking category for ITN link parameters |
Update featured portal wording per request |
||
(29 intermediate revisions by 15 users not shown) | |||
Line 56:
-- calculations.
local function getYmdDate(date)
if date then
return tonumber(date)
else
return nil
end
end
Line 164 ⟶ 169:
-- dates contained in dateData (made with the makeDateData function).
-- The parameter $1 in the blurb will be replaced with the list of dates.
local function makeDateText(dateData, blurb, wantBold)
local bold = wantBold and "'''" or ""
local dates, doneLinks = {}, {}
for i, t in ipairs(dateData) do
local date
if t.link and not doneLinks[t.link] then
doneLinks[t.link] = true
else
end
dates[i] = bold .. date .. bold
end
local dateList = mw.text.listToText(dates, ', ', ', and ')
Line 179 ⟶ 187:
return {
-------------------------------------------------------------------------------
-- CONFIG TABLE START
Line 199 ⟶ 207:
-- iconSize: The icon size, including "px" suffix. The default is defined in
-- defaultStatusIconSize.
-- iconMultiSize: The icon size if we are outputting multiple status rows. The
-- default is
-- text: The status text. This may be a string or a function. If it is a
-- function, it takes an article history object as input, and should return
Line 243 ⟶ 249:
link = link or 'Wikipedia:Featured article candidates/' .. articlePage
local text = "'''%s''' is a [[Wikipedia:Featured articles|featured article]]; " ..
"it (or a previous version of it) has been
"as one of the best articles produced by the [[Wikipedia:Wikipedians|Wikipedia community]]. " ..
"Even so, if you can update or improve it, [[Wikipedia:Be bold|please do so]]."
Line 268 ⟶ 274:
text = "'''$1''' is a former [[Wikipedia:Featured article candidates|featured article candidate]]. " ..
"Please view the links under Article milestones below to see why " ..
"the nomination
"[[Wikipedia:Featured article candidates/Archived nominations/Index|archive]]."
},
Line 289 ⟶ 295:
link = link or 'Wikipedia:Featured list candidates/' .. articlePage
local text = "'''%s''' is a [[Wikipedia:Featured lists|featured list]], " ..
"which means it has been
"[[Wikipedia:
"If you can update or improve it, [[Wikipedia:Be bold|please do so]]."
return string.format(text, articlePage, link)
Line 305 ⟶ 311:
"[[Wikipedia:Featured list criteria|featured list standard]], you may " ..
"[[Wikipedia:Featured list candidates|renominate]] the article to " ..
"become a [[Wikipedia:Featured
},
FFLC = {
Line 313 ⟶ 319:
iconCaption = 'Former FLC',
text = "'''$1''' is a former [[Wikipedia:Featured list candidates|featured list candidate]]. " ..
"Please view the link under Article milestones below to see why the nomination
"Once the objections have been addressed you may " ..
"[[Wikipedia:Featured list candidates#Resubmitting nominations|resubmit]] " ..
Line 324 ⟶ 330:
isMulti = true,
statuses = {'FFA', 'GA'}
},
['FFAC/GA'] = {
id = 'FFAC/GA',
name = 'Former featured article candidate, current good article',
isMulti = true,
statuses = {'FFAC', 'GA'}
},
GA = {
Line 346 ⟶ 358:
if title.namespace == 1 then
ret[#ret + 1] = Category.new('Wikipedia good articles')
local topic = getGoodArticleTopic(articleHistoryObj.args.topic)
if topic then
Line 367 ⟶ 378:
name = 'Former good article nominee',
aliases = {'FAILEDGA'},
icon = 'Symbol
text = function (articleHistoryObj)
local articlePage = articleHistoryObj.currentTitle.subjectPageTitle.prefixedText
Line 373 ⟶ 384:
local text = "'''%s''' was a '''''[[%s|%s]]''''' nominee, " ..
"but did not meet the [[Wikipedia:Good article criteria|good article criteria]] " ..
"at the time. There
"Once these issues have been addressed, the article can be " ..
"[[Wikipedia:Good article nominations|renominated]]. " ..
Line 422 ⟶ 433:
"[[Wikipedia:Featured topic candidates|featured topic candidate]]. " ..
"Please view the links under Article milestones below to see why " ..
"the nomination
},
FPO = {
id = 'FPO',
name = 'Featured portal',
icon = '
text = "
"as a [[Wikipedia:Featured portals|featured portal]] " ..
"
categories = function (articleHistoryObj)
return {Category.new(
Line 462 ⟶ 471:
"[[Wikipedia:Featured portal candidates|featured portal candidate]]. " ..
"Please see the links under Portal milestones below for its " ..
"original nomination page and why the nomination failed."
},
PR = {
Line 532 ⟶ 535:
-- Get the status ID. The status code is the code passed in from the
-- arguments, and the ID is the value contained in the config.
local statusCode = articleHistoryObj.args[articleHistoryObj.cfg.currentStatusParam]
local statusId = articleHistoryObj:getStatusIdForCode(statusCode)
Line 598 ⟶ 600:
-- iconSize: The icon size, including "px" suffix. The default is defined in
-- defaultIconSize.
-- text: The notice text. This may be a string or a function. If it is a
-- function, it takes an article history object as the first parameter, and
Line 662:
data[#data + 1] = makeTopicData(args.ftname, args.ftmain)
if prefixArgs.ft then
for
if t[1] > 1 then -- we use args.ftname instead of args.ft1name
data[#data + 1] = makeTopicData(t.name, t.main, t[1])
Line 714:
end,
iconSize = '48px',
text = function (articleHistoryObj, noticeObj)
local data = noticeObj:getData(articleHistoryObj)
Line 741 ⟶ 740:
local hasGoodLink = false
local text = {}
-- First topic
do
Line 821 ⟶ 820:
elseif status == 'FL' then
addCat('FL-Class Featured topics articles')
elseif status == 'FFA/GA' or status == 'FFAC/GA' or status == 'GA' then
addCat('GA-Class Featured topics articles')
else
Line 829 ⟶ 828:
-- Topic-specific status categories
local function addTopicCats(catFormat)
for
addCat(string.format(catFormat, topic.name))
end
Line 843 ⟶ 842:
-- Importance categories
local hasTop, hasHigh, hasMid, hasLow -- These check for dupes
for
local cat, sort
if topic.status == 'FT' then
Line 885 ⟶ 884:
local status = articleHistoryObj:getStatusId()
local data = {}
local function validateMainDate(argName, dataName, dataTimestampName)
data[dataName] = args[argName]
if data[dataName] then
data[dataTimestampName] = getYmdDate(data[dataName])
if not data[dataTimestampName] then
articleHistoryObj:raiseError(
string.format(
"invalid date '%s' detected in parameter '%s'",
data[dataName],
argName
),
'Template:Article history#Invalid date'
)
end
end
end
validateMainDate('maindate', 'mainDate', 'mainDateTimestamp')
if data.
validateMainDate('maindate2', 'mainDate2', 'mainDate2Timestamp')
if data.mainDate2 and data.mainDateTimestamp >= data.mainDate2Timestamp then
articleHistoryObj:raiseError(
"
'Template:Article history#Main Page date order'
)
end
end
data.currentTimestamp = getYmdDate()
-- Whether the page is a list or not for the purposes of the Main
-- Page. The first Today's Featured List was on 13 June 2011, so
-- lists that were featured before then count as articles.
data.isList = (status == 'FL' or status == 'FFL')
and (not data.mainDate or data.mainDateTimestamp >= 20110613)
return data
Line 916 ⟶ 928:
text = function (articleHistoryObj, noticeObj)
local data = noticeObj:getData(articleHistoryObj)
if not data or not data.
return nil
end
-- Build the blurb for all the possible combinations of past,
-- present and future appearances of maindate and maindate2.
local pagetype = data.isList and 'list' or 'article'
local mainDateLong = getLongDate(data.mainDate)
local mainDate2Long = data.mainDate2 and getLongDate(data.mainDate2)
local todaysFA = "Today's featured " .. pagetype
local function makeFeaturedLink(date, display)
return string.format(
"[[Wikipedia:Today's featured %s/%s|%s]]",
pagetype,
date,
display or date
)
end
local function isPast(timestamp)
return timestamp < data.currentTimestamp
end
local function isCurrent(timestamp)
return timestamp == data.currentTimestamp
end
local function isFuture(timestamp)
return timestamp > data.currentTimestamp
end
if data.mainDate2 then
if isPast(data.mainDateTimestamp) then
if isPast(data.mainDate2Timestamp) then
return string.format(
"This article appeared on Wikipedia's Main Page as %s on %s, and on %s.",
todaysFA,
makeFeaturedLink(mainDateLong),
makeFeaturedLink(mainDate2Long)
)
elseif isCurrent(data.mainDate2Timestamp) then
return string.format(
"This article is currently on Wikipedia's Main Page as %s. It also appeared previously on %s.",
makeFeaturedLink(mainDate2Long, todaysFA),
makeFeaturedLink(mainDateLong)
)
else
return string.format(
"This article appeared on Wikipedia's Main Page as %s on %s, and will appear again on %s.",
todaysFA,
makeFeaturedLink(mainDateLong),
makeFeaturedLink(mainDate2Long)
)
end
elseif isCurrent(data.mainDateTimestamp) then
if isFuture(data.mainDate2Timestamp) then
return string.format(
"This article is currently on Wikipedia's Main Page as %s, and will appear again on %s.",
makeFeaturedLink(mainDateLong, todaysFA),
makeFeaturedLink(mainDate2Long)
)
else
return nil
end
else
if isFuture(data.mainDate2Timestamp) then
return string.format(
"This article will appear on Wikipedia's Main Page as %s on %s, and again on %s.",
todaysFA,
makeFeaturedLink(mainDateLong),
makeFeaturedLink(mainDate2Long)
)
else
return nil
end
end
else
if isPast(data.mainDateTimestamp) then
return string.format(
"This article appeared on Wikipedia's Main Page as %s on %s.",
makeFeaturedLink(mainDateLong, todaysFA),
mainDateLong
)
elseif isCurrent(data.mainDateTimestamp) then
return string.format(
"This article is currently on Wikipedia's Main Page as %s.",
makeFeaturedLink(mainDateLong, todaysFA),
mainDateLong
)
else
return string.format(
"This article will appear on Wikipedia's Main Page as %s on %s.",
makeFeaturedLink(mainDateLong, todaysFA),
mainDateLong
)
end
end
end,
categories = function (articleHistoryObj, noticeObj)
Line 944 ⟶ 1,032:
return nil
end
local status = articleHistoryObj:getStatusId()
local cats = {}
local pagetype = data.isList and 'lists' or 'articles'
if data.mainDate and data.mainDateTimestamp <= data.currentTimestamp then
cats[#cats + 1] = Category.new(string.format(
'Featured %s that have appeared on the main page',
pagetype
))
if data.mainDate2 and data.mainDate2Timestamp <= data.currentTimestamp then
cats[#cats + 1] = Category.new(string.format(
'Featured %s that have appeared on the main page twice',
pagetype
))
else
cats[#cats + 1] = Category.new(string.format(
'Featured %s that have appeared on the main page once',
pagetype
))
end
elseif status == 'FA' or status == 'FL' or data.mainDate then
cats[#cats + 1] = Category.new(string.format(
'Featured %s that have not appeared on the main page',
pagetype
))
end
Line 1,404 ⟶ 1,509:
aliases = {'_BLANK'}
}
},
categories = function (articleHistoryObj, actionObj)
local ret = {}
local result = actionObj.resultId
if result == 'copyedited' then
ret[1] = Category.new('Articles copy edited by the Guild of Copy Editors')
end
return ret
end
},
WAR = {
Line 1,484 ⟶ 1,597:
MFD = {
id = 'MFD',
name = '
results = {
kept = {
Line 1,671 ⟶ 1,784:
text = 'Overturned',
aliases = {'overturn'}
},
restored = {
id = 'restored',
text = 'Restored',
aliases = {'restore'}
},
['no consensus'] = {
Line 1,701 ⟶ 1,819:
-- iconSize: The icon size, including "px" suffix. The default is defined in
-- defaultIconSize.
-- text: The notice text. This may be a string or a function. If it is a
-- function, it takes an article history object as the first parameter, and
Line 1,728 ⟶ 1,844:
{
id = 'DYK',
icon = '
iconCaption = 'Did You Know',
noticeBarIcon = true,
isActive = function (articleHistoryObj)
Line 1,736 ⟶ 1,851:
end,
makeData = function (articleHistoryObj)
return makeDateData(articleHistoryObj, 'dyk', {'entry', 'nom', 'ignoreerror'})
end,
text = function (articleHistoryObj, collapsibleNoticeObj)
Line 1,743 ⟶ 1,858:
return nil
end
for _, t in ipairs(data) do
local raPage = 'Wikipedia:Recent additions/' .. getDate('Y/F#j F Y',
if not titleExists(raPage) then
raPage = 'Wikipedia:Recent additions'
end
t.link = raPage
end
local
local nomPage = data[1].nom or ('Template:Did you know nominations/' .. articleHistoryObj.currentTitle.text)
if titleExists(nomPage) then
end
local blurb = "A " .. fact .. " appeared on " ..
"Wikipedia's [[Main Page]] in the " ..
"''\"[[:Template:Did you know|Did you know?]]\"'' " ..
"column on $1."
return makeDateText(data, blurb, true)
end,
collapsibleText = function (articleHistoryObj, collapsibleNoticeObj)
Line 1,771 ⟶ 1,891:
local entries = {}
local lastEntryDate
for
entries[#entries + 1] = t.entry
lastEntryDate = t.date
Line 1,783 ⟶ 1,903:
ctext[#ctext + 1] = 'The text of the entries was:\n'
local list = mw.html.create('ul')
for
if t.entry then
list:tag('li'):wikitext(string.format(
Line 1,801 ⟶ 1,921:
end,
categories = function (articleHistoryObj, collapsibleNoticeObj)
local data = collapsibleNoticeObj:getData(articleHistoryObj)
if not data then
return nil
end
local cats = {}
do
local status = articleHistoryObj:getStatusId()
local statusCat
statusCat = 'Wikipedia Did you know articles that are featured articles' elseif status == 'FL' then
elseif status == 'GA' or status == 'FFA/GA' then
else
end
cats[#cats + 1] = Category.new(statusCat)
end
for _, t in ipairs(data) do
if not t.ignoreerror then
if t.entry then
local mCheckDYKEntry = require('Module:Check DYK hook')
if not mCheckDYKEntry._isValidHook(t.entry) then
cats[#cats + 1] = Category.new('Pages with a malformed DYK entry')
end
else
cats[#cats + 1] = Category.new('Pages with a missing DYK entry')
end
end
end
return cats
end
Line 1,836 ⟶ 1,974:
return nil
end
local dates = {}
for _, t in ipairs(data) do
date.link = t.link
elseif t.ymdDate >= 20110701 then
date.link = string.format(
'Wikipedia:In the news/Candidates/%s %d',
t.month,
t.
)
elseif t.ymdDate >= 20090101 then
date.link = string.format(
'Wikipedia:ITN archives/%d/%s',
)
elseif t.ymdDate >= 20050101 then
date.link = string.format(
'Portal:Current events/%d %s %d',
t.year,
t.month,
t.day
)
end
date.date = t.date
dates[#dates + 1] = date
end
local intro
Line 1,863 ⟶ 2,011:
" featured on Wikipedia's [[Main Page]] in the " ..
"''\"[[Template:In the news|In the news]]\"'' column on $1."
return makeDateText(
end,
categories = function (articleHistoryObj, collapsibleNoticeObj)
Line 1,891 ⟶ 2,039:
return nil
end
local dates = {}
for _, t in ipairs(data) do
local date = {}
date.date = t.date
date.link = t.link
if t.oldid then
-- TODO: Move this inside the main module
local oldid = tonumber(t.oldid)
if oldid and
math.floor(oldid) == oldid and
oldid > 0 and
Line 1,902 ⟶ 2,054:
-- If the oldid is valid, it takes precedence over
-- explicit links.
else
collapsibleNoticeObj:addWarning(
Line 1,915 ⟶ 2,067:
end
end
dates[#dates + 1] = date
end
local intro
Line 1,926 ⟶ 2,079:
"''\"[[Wikipedia:Selected anniversaries|On this day...]]\"'' " ..
"column on $1."
return makeDateText(
end,
categories = function (articleHistoryObj, collapsibleNoticeObj)
Line 1,933 ⟶ 2,086:
local data = collapsibleNoticeObj:getData(articleHistoryObj)
if data then
for
if t.link then
cats[#cats + 1] = Category.new(
Line 2,036 ⟶ 2,189:
elseif articleHistoryObj:getStatusId() == 'FA' then
local isDYK = false
for
if obj.id == 'DYK' then
isDYK = true
Line 2,043 ⟶ 2,196:
end
if isDYK then
for
if obj.id == 'GAN' and obj.resultId == 'listed' then
ret[#ret + 1] = Category.new('Possible Wikipedia four award articles')
Line 2,086 ⟶ 2,239:
end
end
end
return ret
Line 2,131 ⟶ 2,275:
-- The default size for icons. The default is 30px.
defaultIconSize = '30px',
-- The default size for status icons. The default is 50px.
defaultStatusIconSize = '50px',
-- The default size for status icons for
-- The default size for notice bar icons. The default is 15px.
Line 2,146 ⟶ 2,287:
-- The default size for collapsible status icons. The default is 50px.
defaultCollapsibleNoticeIconSize = '20px',
-------------------------------------------------------------------------------
|