浏览代码

Merge pull request #1680 from ardiya/add_pcl

Add PointCloudLibrary to devdocs
Simon Legner 4 年之前
父节点
当前提交
6ca82ce196

+ 4 - 0
assets/javascripts/news.json

@@ -1,4 +1,8 @@
 [
+  [
+    "2021-12-29",
+    "New documentation: <a href=\"/point_cloud_library/\">PointCloudLibrary</a>"
+  ],
   [
     "2021-12-27",
     "New documentation: <a href=\"/zig/\">Zig</a>"

+ 5 - 0
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -657,6 +657,11 @@ credits = [
     '2005-2017 Sebastian Bergmann',
     'CC BY',
     'https://creativecommons.org/licenses/by/3.0/'
+  ], [
+    'PointCloudLibrary',
+    '2009–2012, Willow Garage, Inc.<br>&copy; 2012–, Open Perception, Inc.',
+    'BSD',
+    'https://raw.githubusercontent.com/PointCloudLibrary/pcl/master/LICENSE.txt'
   ], [
     'Pony',
     '2016-2020, The Pony Developers & 2014-2015, Causality Ltd.',

+ 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

+ 45 - 0
lib/docs/filters/point_cloud_library/entries.rb

@@ -0,0 +1,45 @@
+module Docs
+  class PointCloudLibrary
+    class EntriesFilter < Docs::EntriesFilter
+      def get_type
+        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
+        at_css('.title').content.gsub(/[<(].*/, '')
+      end
+
+      def additional_entries
+        # Only add additional_entries from PointCloudLibrary modules (group__*.html)
+        return [] if not slug.include?("group")
+        entries = []
+
+        css('table.memberdecls td.memItemRight').map do |node|
+          href = node.at_css("a").attr('href')
+          if href.index("#").nil? then
+            href += "#"
+          end
+
+          # 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
+
+          # 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
+
+          entries << [node.content, href]
+        end
+        entries
+      end
+    end
+  end
+end

+ 41 - 0
lib/docs/scrapers/point_cloud_library.rb

@@ -0,0 +1,41 @@
+module Docs
+  class PointCloudLibrary < UrlScraper
+    self.name = 'PointCloudLibrary'
+    self.type = 'point_cloud_library'
+    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.release = '1.12.1'
+
+    self.links = {
+      home: 'https://pointclouds.org/',
+      code: 'https://github.com/PointCloudLibrary/pcl'
+    }
+
+    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
+    # will be removed by clean_text
+    self.text_filters = FilterStack.new
+    text_filters.push 'images', 'inner_html', 'attribution'
+
+    def get_latest_version(opts)
+      get_latest_github_release('PointCloudLibrary', 'pcl', opts)[4..]
+    end
+
+    options[:attribution] = <<-HTML
+      &copy; 2009–2012, Willow Garage, Inc.<br>
+      &copy; 2012–, Open Perception, Inc.<br>
+      Licensed under the BSD License.
+    HTML
+
+    # Skip source code since it doesn't provide any useful docs
+    options[:skip_patterns] = [/_source/, /namespace/, /h\.html/, /structsvm/, /struct_/, /classopenni/, /class_/]
+
+  end
+end

二进制
public/icons/docs/point_cloud_library/16.png


二进制
public/icons/docs/point_cloud_library/16@2x.png


+ 1 - 0
public/icons/docs/point_cloud_library/SOURCE

@@ -0,0 +1 @@
+https://github.com/PointCloudLibrary/pcl/blob/master/pcl.png