Update Electron documentation (1.8.2)

pull/775/head
Thibaut Courouble 7 years ago
parent 2b210a306f
commit c382eaf3cb

@ -232,7 +232,7 @@ credits = [
'https://api.drupal.org/api/drupal/LICENSE.txt'
], [
'Electron',
'2013-2017 GitHub Inc.',
'2013-2018 GitHub Inc.',
'MIT',
'https://raw.githubusercontent.com/electron/electron/master/LICENSE'
], [

@ -4,7 +4,7 @@ module Docs
def call
css('.header-link', 'hr + .text-center', 'hr').remove
css('.grid', '.row', '.col-ms-12', 'ul.docs-list > ul.docs-list').each do |node|
css('.grid', '.row', '.col-ms-12', 'ul.docs-list > ul.docs-list', '.sub-section').each do |node|
node.before(node.children).remove
end
@ -16,18 +16,26 @@ module Docs
end
end
at_css('h2').name = 'h1' unless at_css('h1')
at_css('h2').name = 'h1' if !at_css('h1') && at_css('h2')
css('h3', 'h4', 'h5').each do |node|
node.name = node.name.sub(/\d/) { |i| i.to_i - 1 } unless node.name == 'h3' && node.at_css('code')
end if !at_css('h2') && at_css('h4')
css('h1 > a', 'h2 > a', 'h3 > a', 'h4 > a').each do |node|
node.before(node.children).remove
end
css('div.highlighter-rouge').each do |node|
node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class']
node.content = node.content.strip
node.name = 'pre'
end
css('pre > code.hljs').each do |node|
node.parent['data-language'] = node['class'][/language-(\w+)/, 1]
end
css('.highlighter-rouge').remove_attr('class')
css('pre').each do |node|

@ -2,6 +2,8 @@ module Docs
class Electron
class EntriesFilter < Docs::EntriesFilter
def get_name
return 'API' if subpath == '/api'
name = at_css('h1, h2').content
name.remove! 'Class: '
name.remove! ' Object'
@ -12,11 +14,13 @@ module Docs
end
def get_type
if subpath.start_with?('tutorial') || slug.in?(%w(glossary/ faq/))
return 'API' if subpath == '/api'
if subpath.start_with?('/tutorial') || subpath.in?(%w(/glossary /faq))
'Guides'
elsif subpath.start_with?('development')
elsif subpath.start_with?('/development')
'Guides: Development'
elsif slug.in?(%w(api/synopsis/ api/chrome-command-line-switches/))
elsif subpath.in?(%w(/api/synopsis /api/chrome-command-line-switches))
'API'
elsif at_css('h1, h2').content.include?(' Object')
'API: Objects'
@ -26,7 +30,7 @@ module Docs
end
def additional_entries
return [] unless slug.start_with?('api/')
return [] unless subpath.start_with?('/api')
css('h3 > code', 'h4 > code').each_with_object [] do |node, entries|
next if node.previous.try(:content).present? || node.next.try(:content).present?
@ -37,10 +41,6 @@ module Docs
entries << [name, node.parent['id']] unless name == self.name
end
end
def include_default_entry?
slug != 'api/'
end
end
end
end

@ -1,25 +1,25 @@
module Docs
class Electron < UrlScraper
self.type = 'electron'
self.base_url = 'https://electron.atom.io/docs/'
self.release = '1.7.9'
self.base_url = 'https://electronjs.org/docs'
self.release = '1.8.2'
self.links = {
home: 'https://electron.atom.io/',
home: 'https://electronjs.org/',
code: 'https://github.com/electron/electron'
}
html_filters.push 'electron/clean_html', 'electron/entries'
options[:trailing_slash] = true
options[:trailing_slash] = false
options[:container] = '.page-section > .container, .page-section > .container-narrow'
options[:skip] = %w(guides/ development/ tutorial/ versions/ all/)
options[:skip] = %w(guides development tutorial versions all)
options[:skip_patterns] = [/\/history\z/]
options[:replace_paths] = {
'api/web-view-tag/' => 'api/webview-tag/',
'api/web-view-tag' => 'api/webview-tag/'
'api/web-view-tag' => 'api/webview-tag'
}
options[:attribution] = <<-HTML
&copy; 2013&ndash;2017 GitHub Inc.<br>
&copy; 2013&ndash;2018 GitHub Inc.<br>
Licensed under the MIT license.
HTML
end

Loading…
Cancel
Save