Module:Redirect hatnote: Difference between revisions

Content deleted Content added
m 1 revision imported
m 1 revision imported
 
(One intermediate revision by one other user not shown)
Line 68:
-- Functionality for adding categories
local categoryTable = {}
local function addCategory(cat)
if cat and cat ~= '' then
-- Add by index to avoid duplicates
Line 76:
--Generate tracking categories
local mhOptions = {}
local redirTitle
for k,v in pairs(redirect) do
-- We don't need a tracking category if the template invocation has been
Line 82 ⟶ 83:
and currentTitle.namespace == 0 or currentTitle.namespace == 14
then
redirectTitleredirTitle = redirectTitle or getTitle(v)
if not redirectTitleredirTitle or not redirectTitleredirTitle.exists then
addCategory('Missing redirects')
elseif not redirectTitleredirTitle.isRedirect then
if string.find(redirTitle:getContent(), '#invoke:RfD') then
addCategory('Articles with redirect hatnotes needing review')
addCategory('Articles with redirect hatnotes impacted by RfD')
else
addCategory('Articles with redirect hatnotes needing review')
end
else
local mRedirecttarget = require('Module:Redirect')targetTitle or redirTitle.redirectTarget
localif target and target ~= mRedirect.getTarget(redirectTitle)currentTitle then
targetTitle = targetTitle or target and getTitle(target)
if targetTitle and targetTitle ~= currentTitle then
addCategory('Articles with redirect hatnotes needing review')
end
Line 99 ⟶ 102:
-- Generate the options to pass to [[Module:Hatnote]].
if currentTitle.namespace == 0 and not mhOptions.selfref
and redirectTitleredirTitle and redirectTitleredirTitle.namespace ~= 0
then
-- We are on a mainspace page, and the hatnote starts with something