Module:Redirect hatnote: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content deleted Content added
Updated from sandbox to fix argument initialization bug
Updated from sandbox with fix for the other argument initialization bug :/
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
addCategory('Articles with redirect hatnotes needing review')
else
local mRedirect = require('Module:Redirect')
local target = mRedirect.getTarget(redirectTitleredirTitle)
target = targetTitle or target and getTitle(target)
if target and target ~= currentTitle then
Line 99 ⟶ 100:
-- 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