Jump to content

Module:Redirect: Difference between revisions

handle apostrophes and other characters escaped by {{TALKPAGENAME}}, per protected edit request by User:Jackmcbarn
(extend the pattern to match a colon after the "REDIRECT" text)
(handle apostrophes and other characters escaped by {{TALKPAGENAME}}, per protected edit request by User:Jackmcbarn)
Line 41: Line 41:
     -- in case we are over the expensive function count limit.
     -- in case we are over the expensive function count limit.
     local noError, rpage = pcall(mw.title.new, rname)
     local noError, rpage = pcall(mw.title.new, rname)
     if not noError or noError and not rpage or not rpage.isRedirect then
     if not noError or not rpage then
        -- mw.title.new failed, or the page is not a redirect, so use the passed page name.
    -- mw.title.new failed, so use the passed page name.
         return mw.ustring.format(bracket, rname)
    return mw.ustring.format(bracket, rname)
    elseif not rpage.isRedirect then
        -- the page is not a redirect, so use the normalized name of the page we
        -- were given.
         return mw.ustring.format(bracket, rpage.prefixedText)
     end
     end


Cookies help us deliver our services. By using our services, you agree to our use of cookies.