History

Merge pull request #1482 from MasterEnoc/openjdk

Add overloaded methods to openjdk 11 & 8

Simon Legner committed 5 years ago

Commit 0f386fb2 parents 38e0724 ffd80232 files · +17 −24Browse files

Unified · Split

2 files
  1. lib/docs/filters/openjdk/entries.rb +14 −24
  2. lib/docs/scrapers/openjdk.rb +3 −0
lib/docs/filters/openjdk/entries.rb+14−24
@@ -27,34 +27,24 @@ module Docs · 26 unmodified lines
27 end27 end
28 28
29 def additional_entries29 def additional_entries
30 # Only keep the first found entry with a unique name,30 entries = []
31 # i.e. overloaded methods are skipped in index
32 if version == '8' || version == '8 Gui' || version == '8 Web'
33 css('a[name$=".summary"]').each_with_object({}) do |summary, entries|
34 next if summary['name'].include?('nested') || summary['name'].include?('constructor') ||
35 summary['name'].include?('field') || summary['name'].include?('constant')
36 summary.parent.css('.memberNameLink a').each do |node|
37 name = node.parent.parent.content.strip
38 name.sub! %r{\(.+?\)}m, '()'
39 id = node['href'].remove(%r{.*#})
40 entries[name] ||= ["#{self.name}.#{name}", id]
41 end
42 end.values
43 31
44 else32 css('.memberNameLink a').each do |node|
45 css('a[id$=".summary"]').each_with_object({}) do |summary, entries|33 next unless node['href'].match?(/[-(]/) # skip non-methods
46 next if summary['id'].include?('nested') || summary['id'].include?('constructor') ||34
47 summary['id'].include?('field') || summary['id'].include?('constant')35 if (version=='8' || version == '8 GUI' || version == '8 Web')
48 summary.parent.css('.memberNameLink a').each do |node|36 id = node['href'].gsub(/.*#/, '')
49 name = node.parent.parent.content.strip37 else
50 name.sub! %r{\(.+?\)}m, '()'38 id = slug.downcase + node['href']
51 id = node['href'].remove(%r{.*#})39 end
52 entries[name] ||= ["#{self.name}.#{name}", id]40
53 end41 entries << [self.name + '.' + node.content + '()', id]
54 end.values
55 end42 end
56 43
44 entries
45
57 end46 end
47
58 end48 end
59 end49 end
60end50end
lib/docs/scrapers/openjdk.rb+3−0
@@ -59,6 +59,7 @@ module Docs · 58 unmodified lines
59 59
60 version '8' do60 version '8' do
61 self.release = '8'61 self.release = '8'
62 self.base_url = 'https://docs.oracle.com/javase/8/docs/api/'
62 63
63 html_filters.push OLDFILTERS64 html_filters.push OLDFILTERS
64 65
@@ -90,6 +91,7 @@ module Docs · 25 unmodified lines
90 91
91 version '8 GUI' do92 version '8 GUI' do
92 self.release = '8'93 self.release = '8'
94 self.base_url = 'https://docs.oracle.com/javase/8/docs/api/'
93 95
94 html_filters.push OLDFILTERS96 html_filters.push OLDFILTERS
95 97
@@ -102,6 +104,7 @@ module Docs · 6 unmodified lines
102 104
103 version '8 Web' do105 version '8 Web' do
104 self.release = '8'106 self.release = '8'
107 self.base_url = 'https://docs.oracle.com/javase/8/docs/api/'
105 108
106 html_filters.push OLDFILTERS109 html_filters.push OLDFILTERS
107 110