From b399a0ca6f3df771888247077ef517867de91469 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 15 Oct 2017 14:01:18 -0700 Subject: [PATCH] Add Bluebird documentation (3.5.0) 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. --- lib/docs/filters/bluebird/clean_html.rb | 11 ++++ lib/docs/filters/bluebird/entries.rb | 66 ++++++++++++++++++++++++ lib/docs/scrapers/bluebird.rb | 21 ++++++++ public/icons/docs/bluebird/16.png | Bin 0 -> 1133 bytes public/icons/docs/bluebird/16@2x.png | Bin 0 -> 1652 bytes public/icons/docs/bluebird/SOURCE | 1 + 6 files changed, 99 insertions(+) create mode 100644 lib/docs/filters/bluebird/clean_html.rb create mode 100644 lib/docs/filters/bluebird/entries.rb create mode 100644 lib/docs/scrapers/bluebird.rb create mode 100644 public/icons/docs/bluebird/16.png create mode 100644 public/icons/docs/bluebird/16@2x.png create mode 100644 public/icons/docs/bluebird/SOURCE 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 0000000000000000000000000000000000000000..5bbe4d72b24ebc5745b82be47884763c3d3e3133 GIT binary patch literal 1133 zcmZ`(drVtp6hDmimVrDJH)i+8%#tBE9&PFKUdm&m(2jwOXQ4xS`xFsMN=d`!3}eX3 zd(hH$ZCP~=L!z6`Y);9HiY!5yiDszT{AbST7GiKFkalFt_1uw|><_=3?>mq0ch33F zxhHq9s$U0nfiBpsl) zA7BGbz4rmS1pq600MZYT))|^Rln)TISaq;gg#eNEBye*}ZQ%loS81Li>B+pNL8Zx^ zZ*&(~eIz}hYM++W4T|es;s#e<^$=-LSNIRIZ<(OumBFFl7zPX%8Cl_GubGUj^+^7^Wz5Kw}S0hZ|1^YO6cm z5^C8{n@p&+O`fiIWq-T9V4zV%F%W9-h{4(19x{&353kpCZeQ^;!^lpG$F({79` z)4R*t`d6-|Y+Q(q`nc;M-X;dClQfSa3`@YaV0A+6=)$L2k@twmBoPS_l+i;P*p^~m zL0zAMb|a?E{zf#!jZ6@c0I~0N?ATPs!6SK1LzodeiIJtc{!-h!N{g?kH7IIyY3%1v zKvk%9l{?-qX%8#SUNn| z6z#+_w%(xLU*-NgQpjHLt}+iJ7-)VQs{#Ke!)#nU-GhS!9KOu^h+!V&KDm+3+*)Ip zZ+gy1P+ef6*Uul{4cs_bkF+JRlZlJ@g!hC;TL8Y#1UQ)lat_3se#AFHjG?@&#P?^% z&W}*p+No~r0^n|8cg)wX$!Rq59GVIh@3;8mB!1i#r^Jn>Ynqbc+8sBH`rg>mbj$X7 zDJOh<`h6{zPD|sjyg&Zyt0?9X$>-G@+-NvT`h$K!SsIh&h1k_eEh(*ID6l( zB?dl=_Ai{f>sh|EHgY}d)Zk6U=RFU(Z>z5DnMt|lnQEx5ulr^B=bvOn9DXpMYx?yT zbvtSGua#B0i1^~z0Uq@+NeEs&7{f%it@KTkQd+f1#Np8t2aH+C6+0q_Ewp~hx$IBB~X hoK9y>Ye!p`k?u6-*zDHeYCa!9pixzpT-c}Y`xiP@kv0GT literal 0 HcmV?d00001 diff --git a/public/icons/docs/bluebird/16@2x.png b/public/icons/docs/bluebird/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..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