Module:Redirect/sandbox: Difference between revisions

Content deleted Content added
Undid revision 608825255 by Jackmcbarn (talk) this part is handled by p._main, and it's more useful to other Lua functions if p.getTarget returns nil if there was a problem finding the target
split decoding into a separate function
Line 16:
return nil
end
end
 
local function decode(s)
-- DecodeDecodes html entities and percent encodings.
target s = mw.text.decode(targets, true)
target = return mw.uri.decode(targets, 'WIKI')
end
 
Line 43 ⟶ 49:
)
if target then
return decode(target)
-- Decode html entities and percent encodings.
target = mw.text.decode(target, true)
target = mw.uri.decode(target, 'WIKI')
return target
else
-- The page is a redirect, but matching failed. This indicates a bug in
Line 67 ⟶ 70:
return bracket:format(target)
else
rname = decode(rname)
return bracket:format(rname)
end