Jump to content

Module:Navbar: Difference between revisions

184 bytes added ,  11 years ago
handle expensive parser function limit without killing the box
m>Dragons flight
m (Changed protection level of Module:Navbar: Highly visible template or Lua module ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite)))
m>Dragons flight
(handle expensive parser function limit without killing the box)
Line 17: Line 17:


     return tostring(span)
     return tostring(span)
end
function getTitle( pageName )
    pageName = trim( pageName );
    if mw.ustring.sub(pageName, 1, 1) == ':' then
        return mw.title.new( mw.ustring.sub(pageName, 2) );
    else
        return mw.title.new( pageName, 'Template' );
    end   
end
end


Line 24: Line 33:
     end
     end
   
   
     local title;
     local good, title;
     local pageName = trim(args[1])
     good, title = pcall( getTitle, args[1] );
     if mw.ustring.sub(pageName, 1, 1) == ':' then
     if not good then
         title = mw.title.new( mw.ustring.sub(pageName, 2) );
         return error('Expensive parser function limit exceeded');
    else
     end  
        title = mw.title.new( pageName, 'Template' );
 
     end  
     if not title then
     if not title then
         return error('Page does not exist')
         return error('Page does not exist')
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.