Content deleted Content added
new format for the DYK object |
convert featured topics code to use separate functions for each list field to return |
||
Line 400:
notices = {
{▼
id = 'FT',
function (articleHistoryObj)▼
local
local
end,▼
▲ if not args.ftname and not prefixArgs.ft then
▲ end
local getTopicStatus = require('Module:FeaturedTopicSum').status
local yesno = require('Module:Yesno')
local function makeTopicData(name, isMain, paramNum)
if name then
Line 438 ⟶ 434:
end
end
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
end
end
end
end▼
-- Check for rogue ft.. parameters
if #
articleHistoryObj:raiseError(
"a parameter starting with 'ft' was detected, but no " ..
"featured topic names were specified; " ..
"please check the parameter names",
'Template:Article history#Errors'
)
end
--
▲ local isFeatured = false
▲ for _, topic in ipairs(topics) do
if topic.status == 'FT' then
break
end
end
data.isInFeaturedTopic = isInFeaturedTopic
ret.icon = 'Cscr-featuredtopic.svg'▼
ret.iconCaption = 'Featured topic star'▼
▲ end,
icon = function (articleHistoryObj, noticeObj)
local data = noticeObj:getData()
if data.isInFeaturedTopic then
else
ret.iconCaption = 'Good topic star'▼
end
end,▼
ret.iconSize = '48px'▼
iconCaption = function (articleHistoryObj, noticeObj)
ret.iconSmallSize = '30px'▼
local data = noticeObj:getData()
▲ end
if data.isInFeaturedTopic then
else
end,
text = function (articleHistoryObj, noticeObj)
local data = noticeObj:getData()
local article = articleHistoryObj.currentTitle.subjectPageTitle.prefixedText
local firstBlurb = "'''%s''' is %s the '''[[Wikipedia:Featured topics/%s|%s]] series''', %s."
local otherBlurb = "It is also %s the '''[[Wikipedia:Featured topics/%s|%s]] series''', %s."
Line 504 ⟶ 509:
-- First topic
do
local topic =
local link
if topic.status == 'FT' then
Line 524 ⟶ 529:
-- Other topics
for i = 2, #
local topic =
local link
if topic.status == 'FT' then
Line 553 ⟶ 558:
-- Final blurb
do
local isPlural = #
text[#text + 1] = string.format(
finalBlurb,
Line 561 ⟶ 566:
end
end,
categories = function (articleHistoryObj, noticeObj)
local data = noticeObj:getData()
local status = articleHistoryObj:getStatusId()▼
local cats = {}
▲ local status = articleHistoryObj:getStatusId()
local function addCat(cat, sort)
Line 586 ⟶ 590:
-- Topic-specific status categories
local function addTopicCats(catFormat)
for i, topic in ipairs(
addCat(string.format(catFormat, topic.name))
end
Line 600 ⟶ 604:
-- Importance categories
local hasTop, hasHigh, hasMid, hasLow -- These check for dupes
for i, topic in ipairs(
local cat, sort
if topic.status == 'FT' then
Line 626 ⟶ 630:
end
end
},
▲ return ret
▲ end,
-- Main page date
function (articleHistoryObj)
|