Module:Redirect: Difference between revisions

extend the pattern to match a colon after the "REDIRECT" text
(Suppress errors on non-existent pages - was causing an error to appear on MediaWiki:Protectedpagetext in some cases. Also use pcall for mw.title.new, and a few other tweaks.)
(extend the pattern to match a colon after the "REDIRECT" text)
Line 46: Line 46:
     end
     end


     local redirect = mw.ustring.match(rpage:getContent() or "", "^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*%[%[([^%[%]]-)%]%]" )
     local redirect = mw.ustring.match(rpage:getContent() or "", "^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]]-)%]%]" )
     if redirect then
     if redirect then
         -- Decode html entities and percent encodings.
         -- Decode html entities and percent encodings.