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

point_cloud_library: clean_html, entries

Simon Legner 4 жил өмнө
parent
commit
300d2f8235

+ 12 - 0
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

+ 6 - 14
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

+ 1 - 2
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>