[devdocsgjs/main: 222/239] Clear errors.
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 222/239] Clear errors.
- Date: Fri, 8 Apr 2022 07:47:43 +0000 (UTC)
commit c31d71150fa821a165106634fec0c4540d911e1a
Author: xjkdev <xjk2008 gmail com>
Date: Fri Mar 11 02:53:20 2022 +0800
Clear errors.
Filter empty pages in `process_response?`.
lib/docs/filters/eigen3/entries.rb | 8 +-------
lib/docs/scrapers/eigen3.rb | 9 ++++++++-
2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/lib/docs/filters/eigen3/entries.rb b/lib/docs/filters/eigen3/entries.rb
index 3f2a585d..48d37caf 100644
--- a/lib/docs/filters/eigen3/entries.rb
+++ b/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')
diff --git a/lib/docs/scrapers/eigen3.rb b/lib/docs/scrapers/eigen3.rb
index 30722b2e..e30fe54c 100644
--- a/lib/docs/scrapers/eigen3.rb
+++ b/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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]