Finish Bluebird scraper

pull/704/merge
Thibaut Courouble 7 years ago
parent b399a0ca6f
commit dac419289b

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 36 KiB

@ -1,5 +1,8 @@
[
[
"2017-11-26",
"New documentation: <a href=\"/bluebird/\">Bluebird</a>"
], [
"2017-11-18",
"Added print & PDF stylesheet.\nFeedback welcome on <a href=\"https://twitter.com/DevDocs\" target=\"_blank\" rel=\"noopener\">Twitter</a> and <a href=\"https://github.com/Thibaut/devdocs\" target=\"_blank\" rel=\"noopener\">GitHub</a>."
], [

@ -112,6 +112,11 @@ credits = [
'2010-2016 Jeremy Ashkenas, DocumentCloud',
'MIT',
'https://raw.githubusercontent.com/jashkenas/backbone/master/LICENSE'
], [
'Bluebird',
'2013-2017 Petka Antonov',
'MIT',
'https://raw.githubusercontent.com/petkaantonov/bluebird/master/LICENSE'
], [
'Bootstrap',
'2011-2017 Twitter, Inc.<br>2011-2017 The Bootstrap Authors',

@ -164,3 +164,4 @@
._icon-nim:before { background-position: -5rem -2rem; @extend %doc-icon-2; @extend %darkIconFix !optional; }
._icon-vulkan:before { background-position: -6rem -2rem; @extend %doc-icon-2; @extend %darkIconFix !optional; }
._icon-d:before { background-position: -7rem -2rem; @extend %doc-icon-2; }
._icon-bluebird:before { background-position: -8rem -2rem; @extend %doc-icon-2; }

@ -2,8 +2,33 @@ module Docs
class Bluebird
class CleanHtmlFilter < Filter
def call
css('.post-content > p:first').remove
css('pre').attr('data-language', 'javascript')
@doc = at_css('.post')
css('hr').remove
css('.api-code-section').each do |node|
node.previous_element.remove
end
css('.post-header', '.post-content', '.api-reference-menu', '.api-code-section', 'markdown', '.highlight', 'code code').each do |node|
node.before(node.children).remove
end
at_css('> h2:first-child').name = 'h1' unless at_css('h1')
css('.header-anchor[name]').each do |node|
node.parent['id'] = node['name']
end
css('pre').each do |node|
node.content = node.content
node['data-language'] = 'javascript'
end
css('.info-box').each do |node|
node.name = 'blockquote'
end
doc
end
end

@ -26,41 +26,23 @@ module Docs
done promise.config suppressunhandledrejections
promise.onpossiblyunhandledrejection promise.bind
promise.onunhandledrejectionhandled),
'Progression migration': %(),
'Deferred migration': %(),
'Environment variables': %(),
"Beginner's Guide": %w(),
'Error management configuration': %w(),
'Anti-patterns': %w(),
'Deprecated APIs': %w()
}
def get_name
name = at_css('h1.post-title')
if name.nil?
name = at_css('.post-content h2')
end
name.text
name = at_css('h1').content.strip
name << '()' if doc.to_html.include?("#{name}(")
name
end
def get_type
type = nil
TYPE_MAP.each do |k,v|
if k.to_s.casecmp(name.strip) == 0
type = k
break
else
slug_end = slug.sub(%r(^docs/api/), '')
if v.include?(slug_end.downcase)
type = k
break
end
if slug.start_with?('api')
TYPE_MAP.each do |key, value|
return key.to_s if value.include?(slug.remove('api/'))
end
else
'Guides'
end
type.to_s
end
end
end
end

@ -1,9 +1,10 @@
module Docs
class Bluebird < UrlScraper
self.type = 'bluebird'
self.base_url = 'http://bluebirdjs.com'
self.root_path = '/docs/api-reference.html'
self.release = '3.5.0'
self.type = 'simple'
self.release = '3.5.1'
self.base_url = 'http://bluebirdjs.com/docs/'
self.root_path = 'api-reference.html'
self.force_gzip = true
self.links = {
home: 'http://bluebirdjs.com/',
code: 'https://github.com/petkaantonov/bluebird/'
@ -11,10 +12,10 @@ module Docs
html_filters.push 'bluebird/clean_html', 'bluebird/entries'
options[:container] = 'body .post'
options[:skip] = %w(support.html download-api-reference.html contribute.html)
options[:attribution] = <<-HTML
&copy; Petka Antonov<br/>
&copy; 2013&ndash;2017 Petka Antonov<br>
Licensed under the MIT License.
HTML
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1018 B

Loading…
Cancel
Save