diff --git a/lib/docs/filters/bluebird/clean_html.rb b/lib/docs/filters/bluebird/clean_html.rb new file mode 100644 index 00000000..92f10b41 --- /dev/null +++ b/lib/docs/filters/bluebird/clean_html.rb @@ -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 diff --git a/lib/docs/filters/bluebird/entries.rb b/lib/docs/filters/bluebird/entries.rb new file mode 100644 index 00000000..bebae289 --- /dev/null +++ b/lib/docs/filters/bluebird/entries.rb @@ -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 diff --git a/lib/docs/scrapers/bluebird.rb b/lib/docs/scrapers/bluebird.rb new file mode 100644 index 00000000..bfa96a03 --- /dev/null +++ b/lib/docs/scrapers/bluebird.rb @@ -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
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/bluebird/16.png b/public/icons/docs/bluebird/16.png new file mode 100644 index 00000000..5bbe4d72 Binary files /dev/null and b/public/icons/docs/bluebird/16.png differ diff --git a/public/icons/docs/bluebird/16@2x.png b/public/icons/docs/bluebird/16@2x.png new file mode 100644 index 00000000..cad3315b Binary files /dev/null and b/public/icons/docs/bluebird/16@2x.png differ diff --git a/public/icons/docs/bluebird/SOURCE b/public/icons/docs/bluebird/SOURCE new file mode 100644 index 00000000..ad36850c --- /dev/null +++ b/public/icons/docs/bluebird/SOURCE @@ -0,0 +1 @@ +https://github.com/petkaantonov/bluebird/blob/master/docs/img/libbblog_v3.png