1
0
Эх сурвалжийг харах

Clear errors.

Filter empty pages in `process_response?`.
xjkdev 3 жил өмнө
parent
commit
c31d71150f

+ 1 - 7
lib/docs/filters/eigen3/entries.rb

@@ -8,12 +8,6 @@ module Docs
         downtitle = title.downcase
         name = get_name
 
-        # Remove Empty pages.
-        if content.include?('TODO: write this dox page!') ||
-            content.blank? || content.empty?
-          return nil
-        end
-
         if slug.include?('unsupported')
           return 'Unsupported'
         elsif slug.start_with?('Topic') || downtitle.end_with?("topics")
@@ -90,7 +84,7 @@ module Docs
 
             href = node.at_css("a").attr('href')
 
-            if not href.include?("#") and (name == 'Eigen' || type = "Classes") then
+            if not href.include?("#") and (name == 'Eigen' || type == "Classes") then
               next
             end
             if slug.include?('unsupported')

+ 8 - 1
lib/docs/scrapers/eigen3.rb

@@ -36,7 +36,7 @@ module Docs
     HTML
 
     # Skip source code since it doesn't provide any useful docs
-    options[:skip_patterns] = [/_source/, /-members/, /__Reference\.html/, /_chapter\.html/,]
+    options[:skip_patterns] = [/_source/, /-members/, /__Reference\.html/, /_chapter\.html/, /\.txt/, /\.tgz/]
 
     # TODO: replace cppreference
     # options[:replace_urls] = { 'http://en.cppreference.com/w/cpp/' => 'cpp/' }
@@ -65,5 +65,12 @@ module Docs
       response.body.gsub! '<div class="fragment">', '<pre class="fragment" data-language="cpp">'
       super
     end
+
+    def process_response?(response)
+      return false unless super
+      # Remove Empty pages.
+      response.body.index(/<div class="contents">[\r\n\s]*<\/div>/m).nil? and \
+        response.body.index(/<p>TODO: write this dox page!<\/p>/).nil?
+    end
   end
 end