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
22 class PointCloudLibrary
33 class EntriesFilter < Docs::EntriesFilter
44 def get_type
5− if slug.start_with?("group")
6− 'Group'
5+ if slug.include?("group__") then
6+ tmp = slug.dup
7+ tmp.sub! "group__", ""
8+ tmp.sub! "__", " "
9+ tmp
710 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
921 end
1022 end
1123
1224 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 = []
1428
1529 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 []
30+ href = node.at_css("a").attr('href')
31+ if href.index("#").nil? then
32+ href += "#"
2033 end
2134
22− # Retrieve HREF link
23− first_link = node.css("a").first
24− if first_link.nil? then
25− return []
35+ # Skip page that's not crawled
36+ # TODO: Sync this with options[:skip_patterns] in point_cloud_library.rb
37+ if href.include?("namespace") || href.include?("structsvm") || href.include?("classopenni") then
38+ next
2639 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 += "#"
40+
41+ # Only add function and classes documentation
42+ doxygen_type = node.parent.parent.at_css("tr.heading").text.strip
43+ if not(doxygen_type == "Functions" || doxygen_type == "Classes") then
44+ next
3245 end
3346
34− [node.content, href, type]
47+ entries << [node.content, href]
3548 end
36− end
37−
38− def include_default_entry?
39− !at_css('.obsolete')
49+ entries
4050 end
4151 end
4252 end
lib/docs/scrapers/point_cloud_library.rb+5−1
@@ -5,6 +5,10 @@ module Docs · 4 unmodified lines
55 self.slug = 'point_cloud_library'
66 self.base_url = 'https://pointclouds.org/documentation/'
77 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+ ]
812
913 self.links = {
1014 home: 'https://pointclouds.org/',
@@ -26,7 +30,7 @@ module Docs · 15 unmodified lines
2630 options[:container] = '.contents'
2731
2832 # 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_/]
3034
3135 end
3236 end