History

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

Aditya Ardiya committed 4 years ago

Commit 46d2fd21 parent f8b7cb72 files · +37 −23Browse files

Unified · Split

2 files
  1. lib/docs/filters/point_cloud_library/entries.rb +32 −22
  2. lib/docs/scrapers/point_cloud_library.rb +5 −1
lib/docs/filters/point_cloud_library/entries.rb+32−22
@@ -2,41 +2,51 @@ module Docs · 1 unmodified line
2 class PointCloudLibrary2 class PointCloudLibrary
3 class EntriesFilter < Docs::EntriesFilter3 class EntriesFilter < Docs::EntriesFilter
4 def get_type4 def get_type
5 if slug.start_with?("group")5 if slug.include?("group__") then
6 'Group'6 tmp = slug.dup
7 tmp.sub! "group__", ""
8 tmp.sub! "__", " "
9 tmp
7 else10 else
8 'Others'11 "‎"
12 end
13 end
14
15 def get_name
16 type = get_type()
17 if type == "‎"
18 slug
19 else
20 "Module " + type
9 end21 end
10 end22 end
11 23
12 def additional_entries24 def additional_entries
13 return [] if root_page?25 # Only add additional_entries from PointCloudLibrary modules (group__*.html)
26 return [] if not slug.include?("group")
27 entries = []
14 28
15 css('table.memberdecls td.memItemRight').map do |node|29 css('table.memberdecls td.memItemRight').map do |node|
16 # Get the type of the entry from Doxygen table heading30 href = node.at_css("a").attr('href')
17 type = node.parent.parent.css("tr.heading").text.strip31 if href.index("#").nil? then
18 if type == 'Additional Inherited Members' then32 href += "#"
19 return []
20 end33 end
21 34
22 # Retrieve HREF link35 # Skip page that's not crawled
23 first_link = node.css("a").first36 # TODO: Sync this with options[:skip_patterns] in point_cloud_library.rb
24 if first_link.nil? then37 if href.include?("namespace") || href.include?("structsvm") || href.include?("classopenni") then
25 return []38 next
26 end39 end
27 href = first_link['href']40
28 if href.index("#").nil? then41 # Only add function and classes documentation
29 # If it doesn't have #, it means it's linking to other page.42 doxygen_type = node.parent.parent.at_css("tr.heading").text.strip
30 # So append # at the end to make it work43 if not(doxygen_type == "Functions" || doxygen_type == "Classes") then
31 href += "#"44 next
32 end45 end
33 46
34 [node.content, href, type]47 entries << [node.content, href]
35 end48 end
36 end49 entries
37
38 def include_default_entry?
39 !at_css('.obsolete')
40 end50 end
41 end51 end
42 end52 end
lib/docs/scrapers/point_cloud_library.rb+5−1
@@ -5,6 +5,10 @@ module Docs · 4 unmodified lines
5 self.slug = 'point_cloud_library'5 self.slug = 'point_cloud_library'
6 self.base_url = 'https://pointclouds.org/documentation/'6 self.base_url = 'https://pointclouds.org/documentation/'
7 self.root_path = 'modules.html'7 self.root_path = 'modules.html'
8 # Add hierarchy.html to crawl all classes*.html that's not reachable from modules.html
9 self.initial_paths = [
10 "https://pointclouds.org/documentation/hierarchy.html"
11 ]
8 12
9 self.links = {13 self.links = {
10 home: 'https://pointclouds.org/',14 home: 'https://pointclouds.org/',
@@ -26,7 +30,7 @@ module Docs · 15 unmodified lines
26 options[:container] = '.contents'30 options[:container] = '.contents'
27 31
28 # Skip source code since it doesn't provide any useful docs32 # Skip source code since it doesn't provide any useful docs
29 options[:skip_patterns] = [/_source/]33 options[:skip_patterns] = [/_source/, /namespace/, /h\.html/, /structsvm/, /struct_/, /classopenni/, /class_/]
30 34
31 end35 end
32end36end