Content deleted Content added
convert featured topics code to use separate functions for each list field to return |
convert the main page date to the new scheme |
||
Line 635:
-- Main page date
{
function (articleHistoryObj)▼
id = 'MAINDATE',
local args = articleHistoryObj.args▼
local ret = {}▼
local
local status = articleHistoryObj:getStatusId()
return not args.maindate and status ~= 'FA' and status ~= 'FL'
end,▼
makeData = function (articleHistoryObj)
▲ local args = articleHistoryObj.args
if not
data.categoryOnly = 'Featured articles that have not appeared on the main page'
elseif status == 'FL' then
)}}▼
data.categoryOnly = 'Featured lists that have not appeared on the main page'▼
▲ elseif status == 'FL' then
end▼
▲ 'Featured lists that have not appeared on the main page'
else▼
data.mainDateTimestamp = getYmdDate(data.mainDate)
if not data.mainDateTimestamp then▼
articleHistoryObj:raiseError(▼
string.format(▼
"invalid date '%s' detected in parameter 'maindate'",▼
data.mainDate
),▼
'Template:Article history#Errors'▼
-- The first Today's Featured List was on 13 June 2011.
return data
text = function (articleHistoryObj, noticeObj)
local data = noticeObj:getData()
if data.categoryOnly then
return nil
end
▲ end
▲ local currentTimestamp = getYmdDate()
▲ if not mainDateTimestamp then
▲ articleHistoryObj:raiseError(
▲ string.format(
▲ "invalid date '%s' detected in parameter 'maindate'",
▲ args.maindate
▲ ),
▲ 'Template:Article history#Errors'
▲ )
▲ end
▲ local isList = (status == 'FL' or status == 'FFL') and mainDateTimestamp >= 20110613
▲ ret.icon = 'Wikipedia-logo-v2.svg'
▲ ret.iconCaption = 'Main Page trophy'
local blurb = "This article %s on Wikipedia's [[Main Page]] as " ..
"[[Wikipedia:Today's featured %s/%s|Today's featured %s]]%s."
local longDate = getLongDate(
local pagetype = data.isList and 'list' or 'article'
local tenseBlurb, dateBlurb
if data.mainDateTimestamp < data.currentTimestamp then
tenseBlurb = 'appeared'
dateBlurb = ' on ' .. longDate
elseif data.mainDateTimestamp == data.currentTimestamp then
tenseBlurb = 'is currently on'
dateBlurb = ''
Line 688 ⟶ 696:
dateBlurb = ' on ' .. longDate
end
blurb, tenseBlurb, pagetype, longDate, pagetype, dateBlurb
)
end,
categories = function (articleHistoryObj, noticeObj)
local data = noticeObj:getData()
local cats = {}
if data.categoryOnly then
cats[#cats + 1] = string.format(▼
cats[1] = Category.new(data.categoryOnly)
'Featured %s that have appeared on the main page',▼
▲ else
isList and 'lists' or 'articles'▼
)▼
▲ 'Featured %s that have appeared on the main page',
▲ data.isList and 'lists' or 'articles'
▲ ))
return cats
end
}
▲ return ret
▲ end
},
|