mirror of https://github.com/freeCodeCamp/devdocs
The individual doc pages do not have any category hints in either their url or on the page, so get_type() has a fixed mapping of slug->type.pull/704/merge
parent
d1ad60e067
commit
b399a0ca6f
@ -0,0 +1,11 @@
|
|||||||
|
module Docs
|
||||||
|
class Bluebird
|
||||||
|
class CleanHtmlFilter < Filter
|
||||||
|
def call
|
||||||
|
css('.post-content > p:first').remove
|
||||||
|
css('pre').attr('data-language', 'javascript')
|
||||||
|
doc
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,66 @@
|
|||||||
|
module Docs
|
||||||
|
class Bluebird
|
||||||
|
class EntriesFilter < Docs::EntriesFilter
|
||||||
|
TYPE_MAP = {
|
||||||
|
Core: %w(new-promise then spread catch error finally bind promise.join
|
||||||
|
promise.try promise.method promise.resolve promise.reject core
|
||||||
|
promise.bind),
|
||||||
|
'Synchronous inspection': %w(promiseinspection isfulfilled isrejected
|
||||||
|
ispending iscancelled value reason),
|
||||||
|
Collections: %w(promise.all promise.props promise.any promise.some
|
||||||
|
promise.map promise.reduce promise.filter promise.each
|
||||||
|
promise.mapseries promise.race all props any some map reduce filter
|
||||||
|
each mapseries),
|
||||||
|
'Resource management': %w(promise.using disposer),
|
||||||
|
Promisification: %w(promise.promisify promise.promisifyall
|
||||||
|
promise.fromcallback ascallback),
|
||||||
|
Timers: %w(delay timeout promise.delay),
|
||||||
|
Cancellation: %w(cancel),
|
||||||
|
Generators: %w(promise.coroutine promise.coroutine.addyieldhandler),
|
||||||
|
Utility: %w(tap tapcatch call get return throw catchreturn catchthrow
|
||||||
|
reflect promise.getnewlibrarycopy promise.noconflict
|
||||||
|
promise.setscheduler),
|
||||||
|
'Built-in error types': %w(operationalerror timeouterror
|
||||||
|
cancellationerror aggregateerror),
|
||||||
|
Configuration: %w(global-rejection-events local-rejection-events
|
||||||
|
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
|
||||||
|
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
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
type.to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,21 @@
|
|||||||
|
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.links = {
|
||||||
|
home: 'http://bluebirdjs.com/',
|
||||||
|
code: 'https://github.com/petkaantonov/bluebird/'
|
||||||
|
}
|
||||||
|
|
||||||
|
html_filters.push 'bluebird/clean_html', 'bluebird/entries'
|
||||||
|
|
||||||
|
options[:container] = 'body .post'
|
||||||
|
|
||||||
|
options[:attribution] = <<-HTML
|
||||||
|
© Petka Antonov<br/>
|
||||||
|
Licensed under the MIT License.
|
||||||
|
HTML
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1 @@
|
|||||||
|
https://github.com/petkaantonov/bluebird/blob/master/docs/img/libbblog_v3.png
|
Loading…
Reference in new issue