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
2727 end
2828
2929 def additional_entries
30− # Only keep the first found entry with a unique name,
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
30+ entries = []
4331
44− else
45− css('a[id$=".summary"]').each_with_object({}) do |summary, entries|
46− next if summary['id'].include?('nested') || summary['id'].include?('constructor') ||
47− summary['id'].include?('field') || summary['id'].include?('constant')
48− summary.parent.css('.memberNameLink a').each do |node|
49− name = node.parent.parent.content.strip
50− name.sub! %r{\(.+?\)}m, '()'
51− id = node['href'].remove(%r{.*#})
52− entries[name] ||= ["#{self.name}.#{name}", id]
53− end
54− end.values
32+ css('.memberNameLink a').each do |node|
33+ next unless node['href'].match?(/[-(]/) # skip non-methods
34+
35+ if (version=='8' || version == '8 GUI' || version == '8 Web')
36+ id = node['href'].gsub(/.*#/, '')
37+ else
38+ id = slug.downcase + node['href']
39+ end
40+
41+ entries << [self.name + '.' + node.content + '()', id]
5542 end
5643
44+ entries
45+
5746 end
47+
5848 end
5949 end
6050 end
lib/docs/scrapers/openjdk.rb+3−0
@@ -59,6 +59,7 @@ module Docs · 58 unmodified lines
5959
6060 version '8' do
6161 self.release = '8'
62+ self.base_url = 'https://docs.oracle.com/javase/8/docs/api/'
6263
6364 html_filters.push OLDFILTERS
6465
@@ -90,6 +91,7 @@ module Docs · 25 unmodified lines
9091
9192 version '8 GUI' do
9293 self.release = '8'
94+ self.base_url = 'https://docs.oracle.com/javase/8/docs/api/'
9395
9496 html_filters.push OLDFILTERS
9597
@@ -102,6 +104,7 @@ module Docs · 6 unmodified lines
102104
103105 version '8 Web' do
104106 self.release = '8'
107+ self.base_url = 'https://docs.oracle.com/javase/8/docs/api/'
105108
106109 html_filters.push OLDFILTERS
107110