Module:Article history/config: Difference between revisions

Content deleted Content added
remove deprecated parameter code for dykdate2, otddate2, etc.
per talk page
 
(46 intermediate revisions by 16 users not shown)
Line 56:
-- calculations.
local function getYmdDate(date)
returndate = tonumber(getDate('Ymd', date))
if date then
return tonumber(date)
else
return nil
end
end
 
Line 76 ⟶ 81:
local args = articleHistoryObj.args
local prefixArgs = articleHistoryObj.prefixArgs
return args[prefix .. 'date'] or args[prefix .. 'date2'] or prefixArgs[prefix]
end
 
Line 125 ⟶ 130:
 
-- Organise the input
local function addData(sep)
if args[prefix .. 'date'] then
local t = {}
local argPrefix = prefix .. sep
do
local key = prefixargPrefix .. 'date'
t.date = validateDate(key, args[key], articleHistoryObj)
t.month, t.day, t.year = t.date:match('(%a+) (%d+), (%d+)')
t.day = tonumber(t.day)
t.year = tonumber(t.year)
t.ymdDate = getYmdDate(t.date)
end
for _, suffix in ipairs(suffixes) do
local key = prefixargPrefix .. suffix
t[suffix] = args[key]
end
t.argPrefix = argPrefix
data[#data + 1] = t
end
if args[prefix .. 'date'] then
addData('')
end
if prefixArgs[prefix] then
for _, prefixData in ipairs(prefixArgs[prefix]) do
addData(tostring(prefixData[1]))
local t = {}
do
local key = prefix .. tostring(prefixData[1]) .. 'date'
t.date = validateDate(key, args[key], articleHistoryObj)
end
for i, suffix in ipairs(suffixes) do
local key = prefix .. tostring(prefixData[1]) .. suffix
t[suffix] = args[key]
end
data[#data + 1] = t
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 datesbold = {}wantBold and "'''" or ""
local dates, doneLinks = {}, {}
for i, t in ipairs(dateData) do
local date
if t.link then
if t.link and not doneLinks[t.link] then
dates[i] = string.format('on [[%s|%s]]', t.link, t.date)
date = string.format('[[%s|%s]]', t.link, t.date)
doneLinks[t.link] = true
else
dates[i]date = string.format('on %s', t.date)
end
dates[i] = bold .. date .. bold
end
local dateList = mw.text.listToText(dates, ', ', ', and ')
Line 178 ⟶ 187:
 
return {
 
-------------------------------------------------------------------------------
-- CONFIG TABLE START
Line 198 ⟶ 207:
-- iconSize: The icon size, including "px" suffix. The default is defined in
-- defaultStatusIconSize.
-- iconSmallSize: The icon size if we are outputting a small template. The
-- default is defined in defaultSmallStatusIconSize.
-- iconMultiSize: The icon size if we are outputting multiple status rows. The
-- default is defaultSmallStatusIconSizedefaultMultiStatusIconSize.
-- 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 242 ⟶ 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 '''''[[%s|identified]]''''' " ..
"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 267 ⟶ 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 failedwas archived. For older candidates, please check the " ..
"[[Wikipedia:Featured article candidates/Archived nominations/Index|archive]]."
},
Line 288 ⟶ 295:
link = link or 'Wikipedia:Featured list candidates/' .. articlePage
local text = "'''%s''' is a [[Wikipedia:Featured lists|featured list]], " ..
"which means it has been '''''[[%s|identified]]''''' as one of the best " ..
"[[Wikipedia:ListsStand-alone lists|lists]] produced by the [[Wikipedia:Wikipedians|Wikipedia community]]. " ..
"If you can update or improve it, [[Wikipedia:Be bold|please do so]]."
return string.format(text, articlePage, link)
Line 304 ⟶ 311:
"[[Wikipedia:Featured list criteria|featured list standard]], you may " ..
"[[Wikipedia:Featured list candidates|renominate]] the article to " ..
"become a [[Wikipedia:Featured listlists|featured list]]."
},
FFLC = {
Line 312 ⟶ 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 failedwas archived. " ..
"Once the objections have been addressed you may " ..
"[[Wikipedia:Featured list candidates#Resubmitting nominations|resubmit]] " ..
Line 323 ⟶ 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 345 ⟶ 358:
if title.namespace == 1 then
ret[#ret + 1] = Category.new('Wikipedia good articles')
ret[#ret + 1] = Category.new('Wikipedia CD Selection-GAs')
ret[#ret + 1] = Category.new('GA-Class Good articles')
local topic = getGoodArticleTopic(articleHistoryObj.args.topic)
if topic then
Line 360 ⟶ 371:
end
end
 
-- GA categories
local gacat = articleHistoryObj.args.gacat
if gacat then
local cdSelectionCat = 'Wikipedia CD Selection - People'
if gacat == 'actors' then
ret[#ret + 1] = Category.new('Wikipedia good articles on actors, models and celebrities')
ret[#ret + 1] = Category.new(cdSelectionCat)
elseif gacat == 'bands' then
ret[#ret + 1] = Category.new('Wikipedia good articles on performers and composers')
elseif gacat == 'hist figures' then
ret[#ret + 1] = Category.new('Wikipedia good articles on historical figures')
ret[#ret + 1] = Category.new(cdSelectionCat)
elseif gacat == 'musicians' then
ret[#ret + 1] = Category.new('Wikipedia good articles on performers and composers')
ret[#ret + 1] = Category.new(cdSelectionCat)
elseif gacat == 'politicians' then
ret[#ret + 1] = Category.new('Wikipedia good articles on politicians')
ret[#ret + 1] = Category.new(cdSelectionCat)
elseif gacat == 'royalty' then
ret[#ret + 1] = Category.new('Wikipedia good articles on royalty')
ret[#ret + 1] = Category.new(cdSelectionCat)
elseif gacat == 'writers' then
ret[#ret + 1] = Category.new('Wikipedia good articles on writers and critics')
ret[#ret + 1] = Category.new(cdSelectionCat)
else
articleHistoryObj:addWarning(
string.format(
"invalid value '%s' detected in the 'gacat' parameter",
tostring(gacat)
),
"Template:Article history#Invalid value in 'gacat'"
)
end
end
 
return ret
end
Line 403 ⟶ 378:
name = 'Former good article nominee',
aliases = {'FAILEDGA'},
icon = 'Symbol unsupportoppose vote.svg',
text = function (articleHistoryObj)
local articlePage = articleHistoryObj.currentTitle.subjectPageTitle.prefixedText
Line 409 ⟶ 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 aremay be suggestions below for improving the article. " ..
"Once these issues have been addressed, the article can be " ..
"[[Wikipedia:Good article nominations|renominated]]. " ..
Line 458 ⟶ 433:
"[[Wikipedia:Featured topic candidates|featured topic candidate]]. " ..
"Please view the links under Article milestones below to see why " ..
"the nomination failedwas archived."
},
FPO = {
id = 'FPO',
name = 'Featured portal',
icon = 'Cscr-formerfeatured.svg',
text = "The '''$2 Portal''' is a [[Wikipedia:Featured portals|featured portal]], " ..
"which means it has been " ..
"'''''[[Wikipedia:Featured portal candidates/Portal:$2|identified]]''''' " ..
"as one of the best portals on [[Wikipedia]]. " ..
"If you see a way this portal can be updated or improved without " ..
Line 498 ⟶ 473:
"[[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.",
categories = function (articleHistoryObj)
return {Category.new(
'Wikipedia featured portal candidates (contested)',
articleHistoryObj.currentTitle.text
)}
end
},
PR = {
Line 568 ⟶ 537:
-- 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 statuses = articleHistoryObj.cfg.statuses
local statusCode = articleHistoryObj.args[articleHistoryObj.cfg.currentStatusParam]
local statusId = articleHistoryObj:getStatusIdForCode(statusCode)
Line 596 ⟶ 564:
elseif statusId == 'GA' then
statusId = 'FFA/GA'
elseif statusId == 'DGA' then
statusId = 'FFA'
else
articleHistoryObj:raiseError(
Line 632 ⟶ 602:
-- iconSize: The icon size, including "px" suffix. The default is defined in
-- defaultIconSize.
-- iconSmallSize: The icon size if we are outputting a small template. The
-- default is defined in defaultSmallIconSize.
-- 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 696 ⟶ 664:
data[#data + 1] = makeTopicData(args.ftname, args.ftmain)
if prefixArgs.ft then
for i_, t in ipairs(prefixArgs.ft) do
if t[1] > 1 then -- we use args.ftname instead of args.ft1name
data[#data + 1] = makeTopicData(t.name, t.main, t[1])
Line 748 ⟶ 716:
end,
iconSize = '48px',
iconSmallSize = '30px',
text = function (articleHistoryObj, noticeObj)
local data = noticeObj:getData(articleHistoryObj)
Line 775 ⟶ 742:
local hasGoodLink = false
local text = {}
 
-- First topic
do
Line 855 ⟶ 822:
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 863 ⟶ 830:
-- Topic-specific status categories
local function addTopicCats(catFormat)
for i_, topic in ipairs(data) do
addCat(string.format(catFormat, topic.name))
end
Line 877 ⟶ 844:
-- Importance categories
local hasTop, hasHigh, hasMid, hasLow -- These check for dupes
for i_, topic in ipairs(data) do
local cat, sort
if topic.status == 'FT' then
Line 919 ⟶ 886:
local status = articleHistoryObj:getStatusId()
local data = {}
data.mainDate = args.maindate
 
local function validateMainDate(argName, dataName, dataTimestampName)
if not data.mainDate then
data[dataName] = args[argName]
if status == 'FA' then
if data[dataName] then
data.categoryOnly = 'Featured articles that have not appeared on the main page'
data[dataTimestampName] = getYmdDate(data[dataName])
elseif status == 'FL' then
if not data[dataTimestampName] then
data.categoryOnly = 'Featured lists that have not appeared on the main page'
articleHistoryObj:raiseError(
string.format(
"invalid date '%s' detected in parameter '%s'",
data[dataName],
argName
),
'Template:Article history#Invalid date'
)
end
end
return data
end
 
validateMainDate('maindate', 'mainDate', 'mainDateTimestamp')
data.mainDateTimestamp = getYmdDate(data.mainDate)
if data.currentTimestamp =mainDate getYmdDate()then
validateMainDate('maindate2', 'mainDate2', 'mainDate2Timestamp')
if not data.mainDateTimestamp then
if data.mainDate2 and data.mainDateTimestamp >= data.mainDate2Timestamp then
articleHistoryObj:raiseError(
articleHistoryObj:raiseError(
string.format(
"invalidthe date in the '%smaindate' detectedparameter must be earlier than the date in parameterthe 'maindatemaindate2' parameter",
'Template:Article history#Main Page date order'
data.mainDate
),
end
'Template:Article history#Invalid date'
)
end
 
-- The first Today's Featured List was on 13 June 2011.
data.currentTimestamp = getYmdDate()
data.isList = (status == 'FL' or status == 'FFL') and data.mainDateTimestamp >= 20110613
 
 
-- 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 950 ⟶ 930:
text = function (articleHistoryObj, noticeObj)
local data = noticeObj:getData(articleHistoryObj)
if not data or not data.categoryOnlymainDate then
return nil
end
 
-- Build the blurb for all the possible combinations of past,
local blurb = "This article %s on Wikipedia's [[Main Page]] as " ..
-- present and future appearances of maindate and maindate2.
"[[Wikipedia:Today's featured %s/%s|Today's featured %s]]%s."
local longDate = getLongDate(data.mainDate)
local pagetype = data.isList and 'list' or 'article'
local mainDateLong = getLongDate(data.mainDate)
local tenseBlurb, dateBlurb
local mainDate2Long = data.mainDate2 and getLongDate(data.mainDate2)
if data.mainDateTimestamp < data.currentTimestamp then
local todaysFA = "Today's featured " .. pagetype
tenseBlurb = 'appeared'
 
dateBlurb = ' on ' .. longDate
local function makeFeaturedLink(date, display)
elseif data.mainDateTimestamp == data.currentTimestamp then
return string.format(
tenseBlurb = 'is currently on'
"[[Wikipedia:Today's featured %s/%s|%s]]",
dateBlurb = ''
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
tenseBlurb = 'will appear'
return string.format(
dateBlurb = ' on ' .. longDate
"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
return string.format(
blurb, tenseBlurb, pagetype, longDate, pagetype, dateBlurb
)
end,
categories = function (articleHistoryObj, noticeObj)
Line 978 ⟶ 1,034:
return nil
end
local status = articleHistoryObj:getStatusId()
local cats = {}
 
if data.categoryOnly then
local pagetype = data.isList and 'lists' or 'articles'
cats[1] = Category.new(data.categoryOnly)
if data.mainDate and data.mainDateTimestamp <= data.currentTimestamp then
else
cats[#cats + 1] = Category.new(string.format(
'Featured %s that have appeared on the main page',
pagetype
data.isList and 'lists' or 'articles'
))
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,438 ⟶ 1,511:
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,513 ⟶ 1,594:
text = 'Renamed',
aliases = {'rename', 'move', 'moved'}
},
}
},
MFD = {
id = 'MFD',
name = 'MiscellaneaMiscellany for deletion',
results = {
kept = {
Line 1,558 ⟶ 1,639:
text = 'Renamed',
aliases = {'rename', 'move', 'moved'}
},
}
},
Line 1,599 ⟶ 1,680:
},
renamed = {
id = 'renamed',
text = 'Renamed',
aliases = {'rename', 'move', 'moved'}
},
}
},
Line 1,616 ⟶ 1,698:
id = 'deleted',
text = 'Deleted',
aliases = {'delete', 'speedily deleted', 'speedy delete'}
},
merged = {
id = 'merged',
text = 'Merged',
aliases = {'merge'}
},
['no consensus'] = {
id = 'no consensus',
text = 'No consensus'
},
['speedily kept'] = {
Line 1,631 ⟶ 1,704:
text = 'Speedily kept',
aliases = {'speedy keep'}
},
['speedily deleted'] = {
id = 'speedily deleted',
text = 'Speedily deleted',
aliases = {'speedy delete'}
},
redirected = {
Line 1,641 ⟶ 1,709:
text = 'Redirected',
aliases = {'redirect'}
},
prod = {
id = 'prod',
text = 'Converted to [[WP:PROD|proposed deletion]]',
aliases = {'prodded'}
},
afd = {
id = 'afd',
text = 'Sent to [[WP:AFD|articles for deletion]]',
aliases = {'afded'}
},
renamed = {
Line 1,646 ⟶ 1,724:
text = 'Renamed',
aliases = {'rename', 'move', 'moved'}
},
}
},
Line 1,662 ⟶ 1,740:
text = 'Deleted',
aliases = {'delete'}
},
merged = {
id = 'merged',
text = 'Merged',
aliases = {'merge'}
},
['no consensus'] = {
id = 'no consensus',
text = 'No consensus'
},
['speedily kept'] = {
id = 'nospeedily consensuskept',
text = 'Speedily kept',
aliases = {'speedy keep'}
Line 1,686 ⟶ 1,755:
text = 'Redirected',
aliases = {'redirect'}
},
afd = {
id = 'afd',
text = 'Sent to [[WP:AFD|articles for deletion]]',
aliases = {'afded'}
},
renamed = {
Line 1,691 ⟶ 1,765:
text = 'Renamed',
aliases = {'rename', 'move', 'moved'}
},
}
},
Line 1,712 ⟶ 1,786:
text = 'Overturned',
aliases = {'overturn'}
},
restored = {
id = 'restored',
text = 'Restored',
aliases = {'restore'}
},
['no consensus'] = {
Line 1,742 ⟶ 1,821:
-- iconSize: The icon size, including "px" suffix. The default is defined in
-- defaultIconSize.
-- iconSmallSize: The icon size if we are outputting a small template. The
-- default is defined in defaultSmallIconSize.
-- 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,769 ⟶ 1,846:
{
id = 'DYK',
icon = 'DYKSymbol questionmark iconquestion.svg',
iconCaption = 'Did You Know',
iconSmallSize = '15px',
noticeBarIcon = true,
isActive = function (articleHistoryObj)
Line 1,777 ⟶ 1,853:
end,
makeData = function (articleHistoryObj)
return makeDateData(articleHistoryObj, 'dyk', {'entry', 'nom', 'ignoreerror'})
end,
text = function (articleHistoryObj, collapsibleNoticeObj)
Line 1,784 ⟶ 1,860:
return nil
end
for _, t in ipairs(data) do
local raPage = 'Wikipedia:Recent additions/' ..
getDate('Y/F#j F Y', data[1]t.date)
if not titleExists(raPage) then
raPage = 'Wikipedia:Recent additions'
end
t.link = raPage
end
local blurbfact = string.format('fact from this article'
local nomPage = data[1].nom or ('Template:Did you know nominations/' .. articleHistoryObj.currentTitle.text)
"A [[%s|'''fact from this article''']] appeared on " ..
if titleExists(nomPage) then
"Wikipedia's [[Main Page]] in the " ..
"'fact = '\"[[:Template:Did' you.. know|DidnomPage you.. know?]]\"'|' ".. fact .. ']]'
end
"column $1.",
local blurb = "A " .. fact .. " appeared on " ..
raPage
"Wikipedia's [[Main Page]] in the " ..
)
"''\"[[:Template:Did you know|Did you know?]]\"'' " ..
return makeDateText(data, blurb)
"column on $1."
return makeDateText(data, blurb, true)
end,
collapsibleText = function (articleHistoryObj, collapsibleNoticeObj)
Line 1,812 ⟶ 1,893:
local entries = {}
local lastEntryDate
for i_, t in ipairs(data) do
entries[#entries + 1] = t.entry
lastEntryDate = t.date
Line 1,824 ⟶ 1,905:
ctext[#ctext + 1] = 'The text of the entries was:\n'
local list = mw.html.create('ul')
for i_, t in ipairs(data) do
if t.entry then
list:tag('li'):wikitext(string.format(
Line 1,842 ⟶ 1,923:
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 status = articleHistoryObj:getStatusId()
local cat
local statusCat
if status == 'FA' then
catif status == 'FA' then
statusCat = 'Wikipedia Did you know articles that are featured articles'
elseif status == 'FL' then
cat statusCat = 'Wikipedia Did you know articles that are featured lists'
elseif status == 'GA' or status == 'FFA/GA' then
cat statusCat = 'Wikipedia Did you know articles that are good articles'
else
cat statusCat = 'Wikipedia Did you know articles'
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
cats[1] = Category.new(cat)
return cats
end
Line 1,876 ⟶ 1,975:
if not data then
return nil
end
local dates = {}
for _, t in ipairs(data) do
local date = {}
if t.link then
date.link = t.link
elseif t.ymdDate >= 20110701 then
date.link = string.format(
'Wikipedia:In the news/Candidates/%s %d',
t.month,
t.year
)
elseif t.ymdDate >= 20090101 then
date.link = string.format(
'Wikipedia:ITN archives/%d/%s',
t.year,
t.month
)
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,885 ⟶ 2,012:
local blurb = intro ..
" featured on Wikipedia's [[Main Page]] in the " ..
"''\"[[Template:In the news|In the news]]\"'' column on $1."
return makeDateText(datadates, blurb)
end,
categories = function (articleHistoryObj, collapsibleNoticeObj)
Line 1,902 ⟶ 2,029:
end,
makeData = function (articleHistoryObj)
return makeDateData(articleHistoryObj, 'otd', {'link', 'oldid'})
-- TODO: remove 'link' after it is no longer needed for tracking
end,
icon = 'Nuvola apps date.svg',
Line 1,912 ⟶ 2,040:
if not data then
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
oldid < math.huge
then
-- If the oldid is valid, it takes precedence over
-- explicit links.
date.link = 'Special:PermaLink/' .. t.oldid
else
collapsibleNoticeObj:addWarning(
string.format(
"invalid oldid '%s' detected in parameter '%s'; " ..
"if an oldid is specified it must be a positive integer",
t.oldid,
t.argPrefix .. 'oldid'
),
'Template:Article history#Invalid oldid'
)
end
end
dates[#dates + 1] = date
end
local intro
Line 1,922 ⟶ 2,080:
" featured on Wikipedia's [[Main Page]] in the " ..
"''\"[[Wikipedia:Selected anniversaries|On this day...]]\"'' " ..
"column on $1."
return makeDateText(datadates, blurb)
end,
categories = function (articleHistoryObj, collapsibleNoticeObj)
local cats = {}
cats[1] = Category.new('Selected anniversaries articles')
local data = collapsibleNoticeObj:getData(articleHistoryObj)
if data then
for _, t in ipairs(data) do
if t.link then
cats[#cats + 1] = Category.new(
'Article history templates with linked otd dates'
)
break
end
end
end
return cats
end
Line 2,021 ⟶ 2,190:
ret[#ret + 1] = Category.new('Wikipedia articles rejected for Four awards')
elseif articleHistoryObj:getStatusId() == 'FA' then
local isPossibleFour, isDYK = false, false
for i_, obj in ipairs(articleHistoryObj:getCollapsibleNoticeObjects()) do
if obj.id == 'DYK' then
isDYK = true
Line 2,029 ⟶ 2,198:
end
if isDYK then
for i_, obj in ipairs(articleHistoryObj:getActionObjects()) do
if obj.id == 'GAN' and obj:getResult().resultId == 'successfullisted' then
ret[#ret + 1] = Category.new('Possible Wikipedia four award articles')
isPossibleFour = true
break
end
end
end
end
if isPossibleFour then
return ret
ret[#ret + 1] = Category.new('Possible Wikipedia four award articles')
end,
 
-- Deletion to Quality award
function (articleHistoryObj)
local ret = {}
local status = articleHistoryObj:getStatusId()
if status == 'FA' or status == 'FL' or status == 'GA' then
local iAfd = 0
local hasAfd = false
local actionObjects = articleHistoryObj:getActionObjects()
for i, obj in ipairs(actionObjects) do
if obj.id == 'AFD' then
iAfd = i
hasAfd = true
break
end
end
if hasAfd then
local function hasNomination(id, result)
for i = iAfd + 1, #actionObjects do
local obj = actionObjects[i]
if obj.id == id and obj.resultId == result then
return true
end
end
return false
end
if status == 'GA' and hasNomination('GAN', 'listed') or
status == 'FL' and hasNomination('FLC', 'promoted') or
status == 'FA' and hasNomination('FAC', 'promoted')
then
ret[#ret + 1] = Category.new('Deletion to Quality Award candidates')
end
end
end
return ret
end,
},
 
Line 2,075 ⟶ 2,277:
-- The default size for icons. The default is 30px.
defaultIconSize = '30px',
 
-- The default size for icons for small templates. The default is 15px.
defaultSmallIconSize = '15px',
 
-- The default size for status icons. The default is 50px.
defaultStatusIconSize = '50px',
 
-- The default size for status icons for smallmulti status templates. The default is 30px.
defaultSmallStatusIconSizedefaultMultiStatusIconSize = '30px',
 
-- The default size for notice bar icons. The default is 15px.
Line 2,090 ⟶ 2,289:
-- The default size for collapsible status icons. The default is 50px.
defaultCollapsibleNoticeIconSize = '20px',
 
-- The default size for collapsible status icons for small templates. The
-- default is 30px.
defaultSmallCollapsibleNoticeIconSize = '20px',
 
-------------------------------------------------------------------------------