[devdocsgjs/main: 89/239] point_cloud_library: clean_html, entries




commit 300d2f823587aaff94084321bde7d373180b85a1
Author: Simon Legner <Simon Legner gmail com>
Date:   Wed Dec 29 20:10:09 2021 +0100

    point_cloud_library: clean_html, entries

 lib/docs/filters/point_cloud_library/clean_html.rb | 12 ++++++++++++
 lib/docs/filters/point_cloud_library/entries.rb    | 20 ++++++--------------
 lib/docs/scrapers/point_cloud_library.rb           |  3 +--
 3 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/lib/docs/filters/point_cloud_library/clean_html.rb 
b/lib/docs/filters/point_cloud_library/clean_html.rb
new file mode 100644
index 00000000..143345d6
--- /dev/null
+++ b/lib/docs/filters/point_cloud_library/clean_html.rb
@@ -0,0 +1,12 @@
+module Docs
+  class PointCloudLibrary
+    class CleanHtmlFilter < Filter
+      def call
+        @doc = at_css('.contents')
+        css('.dynheader.closed').remove
+        css('.permalink').remove
+        doc
+      end
+    end
+  end
+end
diff --git a/lib/docs/filters/point_cloud_library/entries.rb b/lib/docs/filters/point_cloud_library/entries.rb
index 2818d92c..29b22214 100644
--- a/lib/docs/filters/point_cloud_library/entries.rb
+++ b/lib/docs/filters/point_cloud_library/entries.rb
@@ -2,23 +2,15 @@ module Docs
   class PointCloudLibrary
     class EntriesFilter < Docs::EntriesFilter
       def get_type
-        if slug.include?("group__") then
-          tmp = slug.dup
-          tmp.sub! "group__", ""
-          tmp.sub! "__", " "
-          tmp
-        else
-          "‎"
-        end
+        group = at_css('.title .ingroups')
+        return group.content unless group.nil?
+        name = get_name
+        return 'pcl' unless name.match(/^pcl::.*::/)
+        name.gsub(/^pcl::/, '').gsub(/::.*/, '')
       end
 
       def get_name
-        type = get_type()
-        if type == "‎"
-          slug
-        else
-          "Module " + type
-        end
+        at_css('.title').content.gsub(/[<(].*/, '')
       end
 
       def additional_entries
diff --git a/lib/docs/scrapers/point_cloud_library.rb b/lib/docs/scrapers/point_cloud_library.rb
index a30d1d65..c2b04431 100644
--- a/lib/docs/scrapers/point_cloud_library.rb
+++ b/lib/docs/scrapers/point_cloud_library.rb
@@ -15,7 +15,7 @@ module Docs
       code: 'https://github.com/PointCloudLibrary/pcl'
     }
 
-    html_filters.push 'point_cloud_library/entries'
+    html_filters.push 'point_cloud_library/entries', 'point_cloud_library/clean_html'
 
     # Remove the `clean_text` because Doxygen are actually creating empty
     # anchor such as <a id="asd"></a> to do anchor link.. and that anchor
@@ -27,7 +27,6 @@ module Docs
       get_latest_github_release('PointCloudLibrary', 'pcl', opts)
     end
 
-    options[:container] = '.contents'
     options[:attribution] = <<-HTML
       &copy; 2009–2012, Willow Garage, Inc.<br>
       &copy; 2012–, Open Perception, Inc.<br>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]