Module:Redirect hatnote: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
m
Protected "Module:Redirect hatnote": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
(Updated from sandbox with fix for the other argument initialization bug :/)
m (Protected "Module:Redirect hatnote": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(5 intermediate revisions by 3 users not shown)
Line 13:
 
local p = {}
 
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
 
local function getTitle(...)
--Calls mw.title.new and returns either a title object, or nil on error
local success, titleObj = pcall(mw.title.new, ...)
ifreturn success thenand titleObj or nil
return titleObj
else
return nil
end
end
 
--------------------------------------------------------------------------------
-- Main functions
--------------------------------------------------------------------------------
 
function p.redirect(frame)
Line 59 ⟶ 64:
local formattedRedirect = {}
for k,v in pairs(redirect) do
formattedRedirect[k] = '"' mHatnote.. quote(v .. '"')
end
local text = {
Line 87 ⟶ 92:
addCategory('Missing redirects')
elseif not redirTitle.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
local target = mRedirect.getTarget(redirTitle)
target = targetTitle or target and getTitle(target)
if target and target ~= currentTitle then
addCategory('Articles with redirect hatnotes needing review')
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu