Module:Redirect: Difference between revisions

No change in size ,  11 years ago
should have read my own error
No edit summary
(should have read my own error)
Line 11: Line 11:
   local rpage=mw.title.new("Module talk:ImportProtein/DefaultColors")
   local rpage=mw.title.new("Module talk:ImportProtein/DefaultColors")
   local err=""
   local err=""
--  if rpage then -- avoid possibly expensive FileExists if we don't have anything
  if rpage then -- avoid possibly expensive FileExists if we don't have anything
       if rpage.id ~= 0 then
       if rpage.id ~= 0 then
        if rpage.fileExists then
      --  if rpage.fileExists then
             if rpage.isRedirect then
             if rpage.isRedirect then
               return (mw.ustring.find(rpage.getContent,"REDIRECT(.-)%[%[(.-)%]%]") or [=[<span style="text-color:red;">[[Module:redirect]] error: failed to understand - [[]=] .. rname .. [=[]]</span]=])
               return (mw.ustring.find(rpage.getContent,"REDIRECT(.-)%[%[(.-)%]%]") or [=[<span style="text-color:red;">[[Module:redirect]] error: failed to understand - [[]=] .. rname .. [=[]]</span]=])
             else return rname -- not a redirect so leave the original text (for some general-purpose template use)
             else return rname -- not a redirect so leave the original text (for some general-purpose template use)
             end
             end
        else err="File does not exist: "
      --  else err="File does not exist: "
        end
      --  end
       else err="File not found (id=0): "
       else err="File not found (id=0): "
       end
       end
--  else err="File not found (mw.title.new failed)"
  else err="File not found (mw.title.new failed)"
--  end
  end
   return [=[<span style="text-color:red;">[[Module:redirect]] error: ]=] .. err .. [=[ - [[]=] .. rname .. [=[]]</span>]=]
   return [=[<span style="text-color:red;">[[Module:redirect]] error: ]=] .. err .. [=[ - [[]=] .. rname .. [=[]]</span>]=]
end
end


return p
return p
Anonymous user