[devdocsgjs/main: 86/239] Simplify entries to just from PointCloudLibrary modules (group__*.html)




commit 46d2fd2ba0d1a8e01affb7824d0f8742eae20ad7
Author: Aditya Ardiya <aditya ardiya gmail com>
Date:   Wed Dec 29 02:28:57 2021 +0900

    Simplify entries to just from PointCloudLibrary modules (group__*.html)

 lib/docs/filters/point_cloud_library/entries.rb | 54 +++++++++++++++----------
 lib/docs/scrapers/point_cloud_library.rb        |  6 ++-
 2 files changed, 37 insertions(+), 23 deletions(-)
---
diff --git a/lib/docs/filters/point_cloud_library/entries.rb b/lib/docs/filters/point_cloud_library/entries.rb
index 2942b01f..2818d92c 100644
--- a/lib/docs/filters/point_cloud_library/entries.rb
+++ b/lib/docs/filters/point_cloud_library/entries.rb
@@ -2,41 +2,51 @@ module Docs
   class PointCloudLibrary
     class EntriesFilter < Docs::EntriesFilter
       def get_type
-        if slug.start_with?("group")
-          'Group'
+        if slug.include?("group__") then
+          tmp = slug.dup
+          tmp.sub! "group__", ""
+          tmp.sub! "__", " "
+          tmp
         else
-          'Others'
+          "‎"
+        end
+      end
+
+      def get_name
+        type = get_type()
+        if type == "‎"
+          slug
+        else
+          "Module " + type
         end
       end
 
       def additional_entries
-        return [] if root_page?
+        # Only add additional_entries from PointCloudLibrary modules (group__*.html)
+        return [] if not slug.include?("group")
+        entries = []
 
         css('table.memberdecls td.memItemRight').map do |node|
-          # Get the type of the entry from Doxygen table heading
-          type = node.parent.parent.css("tr.heading").text.strip
-          if type == 'Additional Inherited Members' then
-            return []
+          href = node.at_css("a").attr('href')
+          if href.index("#").nil? then
+            href += "#"
           end
 
-          # Retrieve HREF link
-          first_link = node.css("a").first
-          if first_link.nil? then
-            return []
+          # Skip page that's not crawled
+          # TODO: Sync this with options[:skip_patterns] in point_cloud_library.rb
+          if href.include?("namespace") || href.include?("structsvm") || href.include?("classopenni") then
+            next
           end
-          href = first_link['href']
-          if href.index("#").nil? then
-            # If it doesn't have #, it means it's linking to other page.
-            # So append # at the end to make it work
-            href += "#"
+
+          # Only add function and classes documentation
+          doxygen_type = node.parent.parent.at_css("tr.heading").text.strip
+          if not(doxygen_type == "Functions" || doxygen_type == "Classes") then
+            next
           end
 
-          [node.content, href, type]
+          entries << [node.content, href]
         end
-      end
-
-      def include_default_entry?
-        !at_css('.obsolete')
+        entries
       end
     end
   end
diff --git a/lib/docs/scrapers/point_cloud_library.rb b/lib/docs/scrapers/point_cloud_library.rb
index b289795e..138c57a5 100644
--- a/lib/docs/scrapers/point_cloud_library.rb
+++ b/lib/docs/scrapers/point_cloud_library.rb
@@ -5,6 +5,10 @@ module Docs
     self.slug = 'point_cloud_library'
     self.base_url = 'https://pointclouds.org/documentation/'
     self.root_path = 'modules.html'
+    # Add hierarchy.html to crawl all classes*.html that's not reachable from modules.html
+    self.initial_paths = [
+      "https://pointclouds.org/documentation/hierarchy.html";
+    ]
 
     self.links = {
       home: 'https://pointclouds.org/',
@@ -26,7 +30,7 @@ module Docs
     options[:container] = '.contents'
 
     # Skip source code since it doesn't provide any useful docs
-    options[:skip_patterns] = [/_source/]
+    options[:skip_patterns] = [/_source/, /namespace/, /h\.html/, /structsvm/, /struct_/, /classopenni/, 
/class_/]
 
   end
 end


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