Unified · Split
| @@ -232,7 +232,7 @@ credits = [ · 231 unmodified lines | ||
| 232 | 232 | 'https://api.drupal.org/api/drupal/LICENSE.txt' |
| 233 | 233 | ], [ |
| 234 | 234 | 'Electron', |
| 235 | − '2013-2017 GitHub Inc.', | |
| 235 | + '2013-2018 GitHub Inc.', | |
| 236 | 236 | 'MIT', |
| 237 | 237 | 'https://raw.githubusercontent.com/electron/electron/master/LICENSE' |
| 238 | 238 | ], [ |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | ||
| 4 | 4 | def call |
| 5 | 5 | css('.header-link', 'hr + .text-center', 'hr').remove |
| 6 | 6 | |
| 7 | − css('.grid', '.row', '.col-ms-12', 'ul.docs-list > ul.docs-list').each do |node| | |
| 7 | + css('.grid', '.row', '.col-ms-12', 'ul.docs-list > ul.docs-list', '.sub-section').each do |node| | |
| 8 | 8 | node.before(node.children).remove |
| 9 | 9 | end |
| 10 | 10 | |
| @@ -16,18 +16,26 @@ module Docs · 5 unmodified lines | ||
| 16 | 16 | end |
| 17 | 17 | end |
| 18 | 18 | |
| 19 | − at_css('h2').name = 'h1' unless at_css('h1') | |
| 19 | + at_css('h2').name = 'h1' if !at_css('h1') && at_css('h2') | |
| 20 | 20 | |
| 21 | 21 | css('h3', 'h4', 'h5').each do |node| |
| 22 | 22 | node.name = node.name.sub(/\d/) { |i| i.to_i - 1 } unless node.name == 'h3' && node.at_css('code') |
| 23 | 23 | end if !at_css('h2') && at_css('h4') |
| 24 | 24 | |
| 25 | + css('h1 > a', 'h2 > a', 'h3 > a', 'h4 > a').each do |node| | |
| 26 | + node.before(node.children).remove | |
| 27 | + end | |
| 28 | + | |
| 25 | 29 | css('div.highlighter-rouge').each do |node| |
| 26 | 30 | node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class'] |
| 27 | 31 | node.content = node.content.strip |
| 28 | 32 | node.name = 'pre' |
| 29 | 33 | end |
| 30 | 34 | |
| 35 | + css('pre > code.hljs').each do |node| | |
| 36 | + node.parent['data-language'] = node['class'][/language-(\w+)/, 1] | |
| 37 | + end | |
| 38 | + | |
| 31 | 39 | css('.highlighter-rouge').remove_attr('class') |
| 32 | 40 | |
| 33 | 41 | css('pre').each do |node| |
| @@ -2,6 +2,8 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Electron |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | + return 'API' if subpath == '/api' | |
| 6 | + | |
| 5 | 7 | name = at_css('h1, h2').content |
| 6 | 8 | name.remove! 'Class: ' |
| 7 | 9 | name.remove! ' Object' |
| @@ -12,11 +14,13 @@ module Docs · 4 unmodified lines | ||
| 12 | 14 | end |
| 13 | 15 | |
| 14 | 16 | def get_type |
| 15 | − if subpath.start_with?('tutorial') || slug.in?(%w(glossary/ faq/)) | |
| 17 | + return 'API' if subpath == '/api' | |
| 18 | + | |
| 19 | + if subpath.start_with?('/tutorial') || subpath.in?(%w(/glossary /faq)) | |
| 16 | 20 | 'Guides' |
| 17 | − elsif subpath.start_with?('development') | |
| 21 | + elsif subpath.start_with?('/development') | |
| 18 | 22 | 'Guides: Development' |
| 19 | − elsif slug.in?(%w(api/synopsis/ api/chrome-command-line-switches/)) | |
| 23 | + elsif subpath.in?(%w(/api/synopsis /api/chrome-command-line-switches)) | |
| 20 | 24 | 'API' |
| 21 | 25 | elsif at_css('h1, h2').content.include?(' Object') |
| 22 | 26 | 'API: Objects' |
| @@ -26,7 +30,7 @@ module Docs · 3 unmodified lines | ||
| 26 | 30 | end |
| 27 | 31 | |
| 28 | 32 | def additional_entries |
| 29 | − return [] unless slug.start_with?('api/') | |
| 33 | + return [] unless subpath.start_with?('/api') | |
| 30 | 34 | |
| 31 | 35 | css('h3 > code', 'h4 > code').each_with_object [] do |node, entries| |
| 32 | 36 | next if node.previous.try(:content).present? || node.next.try(:content).present? |
| @@ -37,10 +41,6 @@ module Docs · 4 unmodified lines | ||
| 37 | 41 | entries << [name, node.parent['id']] unless name == self.name |
| 38 | 42 | end |
| 39 | 43 | end |
| 40 | − | |
| 41 | − def include_default_entry? | |
| 42 | − slug != 'api/' | |
| 43 | − end | |
| 44 | 44 | end |
| 45 | 45 | end |
| 46 | 46 | end |
| @@ -1,25 +1,25 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Electron < UrlScraper |
| 3 | 3 | self.type = 'electron' |
| 4 | − self.base_url = 'https://electron.atom.io/docs/' | |
| 5 | − self.release = '1.7.9' | |
| 4 | + self.base_url = 'https://electronjs.org/docs' | |
| 5 | + self.release = '1.8.2' | |
| 6 | 6 | self.links = { |
| 7 | − home: 'https://electron.atom.io/', | |
| 7 | + home: 'https://electronjs.org/', | |
| 8 | 8 | code: 'https://github.com/electron/electron' |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | html_filters.push 'electron/clean_html', 'electron/entries' |
| 12 | 12 | |
| 13 | − options[:trailing_slash] = true | |
| 13 | + options[:trailing_slash] = false | |
| 14 | 14 | options[:container] = '.page-section > .container, .page-section > .container-narrow' |
| 15 | − options[:skip] = %w(guides/ development/ tutorial/ versions/ all/) | |
| 15 | + options[:skip] = %w(guides development tutorial versions all) | |
| 16 | + options[:skip_patterns] = [/\/history\z/] | |
| 16 | 17 | options[:replace_paths] = { |
| 17 | − 'api/web-view-tag/' => 'api/webview-tag/', | |
| 18 | − 'api/web-view-tag' => 'api/webview-tag/' | |
| 18 | + 'api/web-view-tag' => 'api/webview-tag' | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | options[:attribution] = <<-HTML |
| 22 | − © 2013–2017 GitHub Inc.<br> | |
| 22 | + © 2013–2018 GitHub Inc.<br> | |
| 23 | 23 | Licensed under the MIT license. |
| 24 | 24 | HTML |
| 25 | 25 | end |