Module:Redirect/sandbox: Difference between revisions

Content deleted Content added
used in module:rfd..
Tag: Reverted
Jackmcbarn (talk | contribs)
sync
Line 43:
), 2)
end
if not titleObj or not titleObj.isRedirect then
return nil
end
targetTitle = titleObj.redirectTarget
-- Find the target by using string matching on the page content.
if targetTitle then
local target = p.getTargetFromText(titleObj:getContent() or "")
if fulltext then
if target then
return targetTitle.fullText
local targetTitle = getTitle(target)
if targetTitle then
if fulltext then
return targetTitle.fullText
else
return targetTitle.prefixedText
end
else
return targetTitle.prefixedTextnil
end
else
-- The page is a redirect, but matching failed. This indicates a bug in
return nil
-- the redirect matching pattern, so throw an error.
error(string.format(
'could not parse redirect on page "%s"',
fulltext and titleObj.fullText or titleObj.prefixedText
))
end
end