Add Electron documentation

pull/574/merge
Thibaut Courouble 8 years ago
parent a70eaa9f5d
commit 61930288b8

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 29 KiB

@ -1,7 +1,7 @@
[
[
"2017-06-04",
"New documentation: <a href=\"/pug/\">Pug</a>"
"New documentations: <a href=\"/electron/\">Electron</a>, <a href=\"/pug/\">Pug</a>"
], [
"2017-05-14",
"New documentations: <a href=\"/jest/\">Jest</a>, <a href=\"/jasmine/\">Jasmine</a> and <a href=\"/liquid/\">Liquid</a>"

@ -219,15 +219,20 @@ credits = [
'GPLv2',
'https://api.drupal.org/api/drupal/LICENSE.txt'
], [
'Ember.js',
'2017 Yehuda Katz, Tom Dale and Ember.js contributors',
'Electron',
'2013-2017 GitHub Inc.',
'MIT',
'https://raw.githubusercontent.com/emberjs/ember.js/master/LICENSE'
'https://raw.githubusercontent.com/electron/electron/master/LICENSE'
], [
'Elixir',
'2012-2017 Plataformatec',
'Apache',
'https://raw.githubusercontent.com/elixir-lang/elixir/master/LICENSE'
], [
'Ember.js',
'2017 Yehuda Katz, Tom Dale and Ember.js contributors',
'MIT',
'https://raw.githubusercontent.com/emberjs/ember.js/master/LICENSE'
], [
'Erlang',
'2010-2017 Ericsson AB',

@ -22,6 +22,7 @@ app.views.CrystalPage =
app.views.D3Page =
app.views.DockerPage =
app.views.DrupalPage =
app.views.ElectronPage =
app.views.ElixirPage =
app.views.EmberPage =
app.views.ErlangPage =

@ -173,3 +173,4 @@
._icon-love:before { background-position: -9rem -1rem; @extend %doc-icon-2; }
._icon-jasmine:before { background-position: 0 -2rem; @extend %doc-icon-2; }
._icon-pug:before { background-position: -1rem -2rem; @extend %doc-icon-2; }
._icon-electron:before { background-position: -2rem -2rem; @extend %doc-icon-2; }

@ -22,6 +22,7 @@
._chai,
._codeceptjs,
._docker,
._electron,
._fish,
._flow,
._gnu,

@ -0,0 +1,37 @@
module Docs
class Electron
class CleanHtmlFilter < Filter
def call
css('.header-link', 'hr + .text-center', 'hr').remove
css('.grid', '.row', '.col-ms-12').each do |node|
node.before(node.children).remove
end
css('h2 > a').each do |node|
node.before(node.children).remove
end if root_page?
at_css('h2').name = 'h1' unless at_css('h1')
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('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('.highlighter-rouge').remove_attr('class')
css('pre').each do |node|
node.content = node.content
end
doc
end
end
end
end

@ -0,0 +1,46 @@
module Docs
class Electron
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('h1, h2').content
name.remove! 'Class: '
name.remove! ' Object'
name.remove! ' Function'
name.remove! ' Option'
name.remove! ' Tag'
name
end
def get_type
if subpath.start_with?('tutorial') || slug.in?(%w(glossary/ faq/))
'Guides'
elsif subpath.start_with?('development')
'Guides: Development'
elsif slug.in?(%w(api/synopsis/ api/chrome-command-line-switches/))
'API'
elsif at_css('h1, h2').content.include?(' Object')
'API: Objects'
else
name
end
end
def additional_entries
return [] unless slug.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?
name = node.content
name.sub! %r{\(.*\)}, '()'
name.remove! 'new '
name = "<webview #{name}>" if self.name == '<webview>' && !name.start_with?('<webview>')
entries << [name, node.parent['id']] unless name == self.name
end
end
def include_default_entry?
slug != 'api/'
end
end
end
end

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1 @@
https://github.com/electron/electron.atom.io/tree/gh-pages/images
Loading…
Cancel
Save