History

Initial work for adding PointCloudLibrary

Aditya Ardiya committed 4 years ago

Commit f8b7cb71 parent 4ed22db2 files · +75 −0Browse files

Unified · Split

2 files
  1. lib/docs/filters/point_cloud_library/entries.rb +43 −0
  2. lib/docs/scrapers/point_cloud_library.rb +32 −0
lib/docs/filters/point_cloud_library/entries.rb+43−0
@@ -0,0 +1,43 @@
1module Docs
2 class PointCloudLibrary
3 class EntriesFilter < Docs::EntriesFilter
4 def get_type
5 if slug.start_with?("group")
6 'Group'
7 else
8 'Others'
9 end
10 end
11
12 def additional_entries
13 return [] if root_page?
14
15 css('table.memberdecls td.memItemRight').map do |node|
16 # Get the type of the entry from Doxygen table heading
17 type = node.parent.parent.css("tr.heading").text.strip
18 if type == 'Additional Inherited Members' then
19 return []
20 end
21
22 # Retrieve HREF link
23 first_link = node.css("a").first
24 if first_link.nil? then
25 return []
26 end
27 href = first_link['href']
28 if href.index("#").nil? then
29 # If it doesn't have #, it means it's linking to other page.
30 # So append # at the end to make it work
31 href += "#"
32 end
33
34 [node.content, href, type]
35 end
36 end
37
38 def include_default_entry?
39 !at_css('.obsolete')
40 end
41 end
42 end
43end
lib/docs/scrapers/point_cloud_library.rb+32−0
@@ -0,0 +1,32 @@
1module Docs
2 class PointCloudLibrary < UrlScraper
3 self.name = 'PointCloudLibrary'
4 self.type = 'point_cloud_library'
5 self.slug = 'point_cloud_library'
6 self.base_url = 'https://pointclouds.org/documentation/'
7 self.root_path = 'modules.html'
8
9 self.links = {
10 home: 'https://pointclouds.org/',
11 code: 'https://github.com/PointCloudLibrary/pcl'
12 }
13
14 html_filters.push 'point_cloud_library/entries'
15
16 # Remove the `clean_text` because Doxygen are actually creating empty
17 # anchor such as <a id="asd"></a> to do anchor link.. and that anchor
18 # will be removed by clean_text
19 self.text_filters = FilterStack.new
20 text_filters.push 'images', 'inner_html'
21
22 def get_latest_version(opts)
23 get_latest_github_release('PointCloudLibrary', 'pcl', opts)
24 end
25
26 options[:container] = '.contents'
27
28 # Skip source code since it doesn't provide any useful docs
29 options[:skip_patterns] = [/_source/]
30
31 end
32end