Module:Redirect-distinguish: Difference between revisions

m
15 revisions imported from wikipedia:Module:Redirect-distinguish: All aboard the import train again. Originally imported from English Wikipedia.
(Mostly-complete implementation of Template:Redirect-distinguish in Lua)
 
m (15 revisions imported from wikipedia:Module:Redirect-distinguish: All aboard the import train again. Originally imported from English Wikipedia.)
 
(14 intermediate revisions by 7 users not shown)
Line 19:
)
end
local redirectTitle = mw.title.new(args[1])
--TODO: Lua replacement of #ifexist checks of arg[1]
local currentTitle = currentTitle or mw.title.getCurrentTitle()
if
string.match(args[1], 'REDIRECT%d+') or
args[1] == 'TERM' or
currentTitle.namespace ~= 0
then
--do nothing
elseif not redirectTitle or not redirectTitle.exists then
args[1] = args[1] .. '[[Category:Missing redirects]]'
elseif not redirectTitle.isRedirect then
if string.find(redirectTitle:getContent(), '#invoke:RfD') then
args[1] = args[1] ..
'[[Category:Articles with redirect hatnotes impacted by RfD]]'
else
args[1] = args[1] ..
'[[Category:Articles with redirect hatnotes needing review]]'
end
end
if not args[2] then
return mHatnote.makeWikitextError(
Line 31 ⟶ 49:
local redirect = table.remove(args, 1)
local text = string.format(
'"%s" redirects here. It is notNot to be confused with %s.',
redirect,
mHatlist.orList(mHatnote.formatPages(unpack(args)), true)
)
return mHatnote._hatnote(text)