Module:Article history/config: Difference between revisions

Content deleted Content added
change invalid action oldids from an error to a warning
remove the error message from args.dykdate2 etc., and instead categorise them in Category:Article history templates with deprecated parameters
Line 117:
end
if args[prefix .. 'date2'] then
data.hasDeprecatedParams = true -- For adding a tracking category
local t, oldKeys, newKeys = {}, {}, {}
local t = {}
do
local oldKeykey = prefix .. 'date2'
t.date = validateDate(oldKeykey, args[oldKeykey], articleHistoryObj)
local newKey = prefix .. '2date'
t.date = validateDate(oldKey, args[oldKey], articleHistoryObj)
table.insert(oldKeys, "'" .. oldKey .. "'")
table.insert(newKeys, "'" .. newKey .. "'")
end
for i, suffix in ipairs(suffixes) do
local oldKeykey = prefix .. suffix .. '2'
t[suffix] = args[oldKeykey]
local newKey = prefix .. '2' .. suffix
table.insert(oldKeys, "'" .. oldKey .. "'")
table.insert(newKeys, "'" .. newKey .. "'")
t[suffix] = args[oldKey]
end
data[#data + 1] = t
articleHistoryObj:addWarning(
string.format(
"the %s parameters are deprecated; use %s instead",
mw.text.listToText(oldKeys),
mw.text.listToText(newKeys)
),
'Template:Article history#Parameters are deprecated'
)
end
if prefixArgs[prefix] then
Line 180 ⟶ 167:
local dateList = mw.text.listToText(dates, ', ', ', and ')
return mw.message.newRawMessage(blurb, dateList):plain()
end
 
local function makeDeprecatedParamsCategory(data)
if data and data.hasDeprecatedParams then
return Category.new('Article history templates with deprecated parameters')
end
end
 
Line 1,724 ⟶ 1,717:
end
cats[1] = Category.new(cat)
cats[2] = makeDeprecatedParamsCategory(collapsibleNoticeObj:getData())
return cats
end
Line 1,757 ⟶ 1,751:
return makeDateText(data, blurb)
end,
categories = {'Wikipediafunction In(articleHistoryObj, the news articles'}collapsibleNoticeObj)
local cats = {}
cats[1] = Category.new('Wikipedia In the news articles')
cats[2] = makeDeprecatedParamsCategory(collapsibleNoticeObj:getData())
return cats
end
},
 
Line 1,790 ⟶ 1,789:
return makeDateText(data, blurb)
end,
categories = {'Selectedfunction anniversaries(articleHistoryObj, articles'}collapsibleNoticeObj)
local cats = {}
cats[1] = Category.new('Selected anniversaries articles')
cats[2] = makeDeprecatedParamsCategory(collapsibleNoticeObj:getData())
return cats
end
},