diff --git a/lib/docs/filters/electron/clean_html.rb b/lib/docs/filters/electron/clean_html.rb
index 052d4af7..9e0d1908 100644
--- a/lib/docs/filters/electron/clean_html.rb
+++ b/lib/docs/filters/electron/clean_html.rb
@@ -2,51 +2,17 @@ module Docs
class Electron
class CleanHtmlFilter < Filter
def call
- css('.header-link', 'hr + .text-center', 'hr', '.docs__actions-bar').remove
+ @doc = at_css(".markdown")
- css('.announcement-banner-contrast').remove
+ css("header").before(at_css("h1"))
- css('.grid', '.row', '.col-ms-12', 'ul.docs-list > ul.docs-list', '.sub-section').each do |node|
- node.before(node.children).remove
- end
+ css(".theme-doc-toc-desktop").remove
- if root_page?
- doc.child.before('
Electron Documentation
')
+ css(".theme-doc-toc-mobile").remove
- css("div.subtron, div.py-6").remove
+ css(".clean-btn").remove
- css('h2 > a').each do |node|
- node.before(node.children).remove
- end
- else
- @doc = doc.at_css('div.docs > div.markdown-body')
- end
-
- 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|
- node.content = node.content
- end
+ css("footer").remove
doc
end
diff --git a/lib/docs/filters/electron/entries.rb b/lib/docs/filters/electron/entries.rb
index 575ef12b..ff16f690 100644
--- a/lib/docs/filters/electron/entries.rb
+++ b/lib/docs/filters/electron/entries.rb
@@ -3,7 +3,6 @@ module Docs
class EntriesFilter < Docs::EntriesFilter
def get_name
return 'API' if subpath == '/api'
- return 'Structures' if slug == 'api/structures'
name = at_css('h1, h2').content
name.remove! 'Class: '
@@ -15,7 +14,7 @@ module Docs
end
def get_type
- return 'API' if subpath == '/api' || slug == 'api/structures'
+ return 'API' if subpath == '/api'
if subpath.start_with?('/tutorial') || subpath.in?(%w(/glossary /faq))
'Guides'
@@ -34,7 +33,6 @@ module Docs
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?
name = node.content
name.sub! %r{\(.*\)}, '()'
name.remove! 'new '
diff --git a/lib/docs/scrapers/electron.rb b/lib/docs/scrapers/electron.rb
index 8b19e060..a53904b5 100644
--- a/lib/docs/scrapers/electron.rb
+++ b/lib/docs/scrapers/electron.rb
@@ -1,8 +1,8 @@
module Docs
class Electron < UrlScraper
self.type = 'simple'
- self.base_url = 'https://www.electronjs.org/docs'
- self.release = '14.0.0'
+ self.base_url = 'https://www.electronjs.org/docs/latest'
+ self.release = '15.3.0'
self.links = {
home: 'https://www.electronjs.org/',
code: 'https://github.com/electron/electron'
@@ -15,7 +15,6 @@ module Docs
options[:skip] = %w(guides development tutorial versions all)
options[:skip_patterns] = [
/\/history\z/,
- /\/latest/ # beta site
]
options[:replace_paths] = {
'api/web-view-tag' => 'api/webview-tag'
@@ -27,8 +26,8 @@ module Docs
HTML
def get_latest_version(opts)
- doc = fetch_doc('https://www.electronjs.org/docs', opts)
- doc.at_css('.docs-version').content
+ doc = fetch_doc('https://www.electronjs.org/releases/stable', opts)
+ doc.at_css(".tag").content.gsub!(/[a-zA-Z]/, '')
end
end
end