Showing the changes to lib/docs (3 of 10 files). Show all
Unified · Split
| @@ -2,8 +2,33 @@ module Docs · 1 unmodified line | |||
| 2 | class Bluebird | 2 | class Bluebird |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | css('.post-content > p:first').remove | 5 | @doc = at_css('.post') |
| 6 | css('pre').attr('data-language', 'javascript') | 6 | |
| 7 | css('hr').remove | ||
| 8 | |||
| 9 | css('.api-code-section').each do |node| | ||
| 10 | node.previous_element.remove | ||
| 11 | end | ||
| 12 | |||
| 13 | css('.post-header', '.post-content', '.api-reference-menu', '.api-code-section', 'markdown', '.highlight', 'code code').each do |node| | ||
| 14 | node.before(node.children).remove | ||
| 15 | end | ||
| 16 | |||
| 17 | at_css('> h2:first-child').name = 'h1' unless at_css('h1') | ||
| 18 | |||
| 19 | css('.header-anchor[name]').each do |node| | ||
| 20 | node.parent['id'] = node['name'] | ||
| 21 | end | ||
| 22 | |||
| 23 | css('pre').each do |node| | ||
| 24 | node.content = node.content | ||
| 25 | node['data-language'] = 'javascript' | ||
| 26 | end | ||
| 27 | |||
| 28 | css('.info-box').each do |node| | ||
| 29 | node.name = 'blockquote' | ||
| 30 | end | ||
| 31 | |||
| 7 | doc | 32 | doc |
| 8 | end | 33 | end |
| 9 | end | 34 | end |
| @@ -26,41 +26,23 @@ module Docs · 25 unmodified lines | |||
| 26 | done promise.config suppressunhandledrejections | 26 | done promise.config suppressunhandledrejections |
| 27 | promise.onpossiblyunhandledrejection promise.bind | 27 | promise.onpossiblyunhandledrejection promise.bind |
| 28 | promise.onunhandledrejectionhandled), | 28 | promise.onunhandledrejectionhandled), |
| 29 | 'Progression migration': %(), | ||
| 30 | 'Deferred migration': %(), | ||
| 31 | 'Environment variables': %(), | ||
| 32 | "Beginner's Guide": %w(), | ||
| 33 | 'Error management configuration': %w(), | ||
| 34 | 'Anti-patterns': %w(), | ||
| 35 | 'Deprecated APIs': %w() | ||
| 36 | } | 29 | } |
| 37 | 30 | ||
| 38 | def get_name | 31 | def get_name |
| 39 | name = at_css('h1.post-title') | 32 | name = at_css('h1').content.strip |
| 40 | if name.nil? | 33 | name << '()' if doc.to_html.include?("#{name}(") |
| 41 | name = at_css('.post-content h2') | 34 | name |
| 42 | end | ||
| 43 | name.text | ||
| 44 | end | 35 | end |
| 45 | 36 | ||
| 46 | def get_type | 37 | def get_type |
| 47 | type = nil | 38 | if slug.start_with?('api') |
| 48 | TYPE_MAP.each do |k,v| | 39 | TYPE_MAP.each do |key, value| |
| 49 | if k.to_s.casecmp(name.strip) == 0 | 40 | return key.to_s if value.include?(slug.remove('api/')) |
| 50 | type = k | ||
| 51 | break | ||
| 52 | else | ||
| 53 | slug_end = slug.sub(%r(^docs/api/), '') | ||
| 54 | if v.include?(slug_end.downcase) | ||
| 55 | type = k | ||
| 56 | break | ||
| 57 | end | ||
| 58 | end | 41 | end |
| 42 | else | ||
| 43 | 'Guides' | ||
| 59 | end | 44 | end |
| 60 | |||
| 61 | type.to_s | ||
| 62 | end | 45 | end |
| 63 | |||
| 64 | end | 46 | end |
| 65 | end | 47 | end |
| 66 | end | 48 | end |
| @@ -1,9 +1,10 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Bluebird < UrlScraper | 2 | class Bluebird < UrlScraper |
| 3 | self.type = 'bluebird' | 3 | self.type = 'simple' |
| 4 | self.base_url = 'http://bluebirdjs.com' | 4 | self.release = '3.5.1' |
| 5 | self.root_path = '/docs/api-reference.html' | 5 | self.base_url = 'http://bluebirdjs.com/docs/' |
| 6 | self.release = '3.5.0' | 6 | self.root_path = 'api-reference.html' |
| 7 | self.force_gzip = true | ||
| 7 | self.links = { | 8 | self.links = { |
| 8 | home: 'http://bluebirdjs.com/', | 9 | home: 'http://bluebirdjs.com/', |
| 9 | code: 'https://github.com/petkaantonov/bluebird/' | 10 | code: 'https://github.com/petkaantonov/bluebird/' |
| @@ -11,10 +12,10 @@ module Docs · 1 unmodified line | |||
| 11 | 12 | ||
| 12 | html_filters.push 'bluebird/clean_html', 'bluebird/entries' | 13 | html_filters.push 'bluebird/clean_html', 'bluebird/entries' |
| 13 | 14 | ||
| 14 | options[:container] = 'body .post' | 15 | options[:skip] = %w(support.html download-api-reference.html contribute.html) |
| 15 | 16 | ||
| 16 | options[:attribution] = <<-HTML | 17 | options[:attribution] = <<-HTML |
| 17 | © Petka Antonov<br/> | 18 | © 2013–2017 Petka Antonov<br> |
| 18 | Licensed under the MIT License. | 19 | Licensed under the MIT License. |
| 19 | HTML | 20 | HTML |
| 20 | end | 21 | end |