You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
devdocs/lib/docs/scrapers/electron.rb

33 lines
970 B

module Docs
class Electron < UrlScraper
self.type = 'simple'
self.base_url = 'https://electronjs.org/docs'
self.release = '2.0.2'
self.links = {
home: 'https://electronjs.org/',
code: 'https://github.com/electron/electron'
}
html_filters.push 'electron/clean_html', 'electron/entries'
options[:trailing_slash] = false
options[:container] = '.page-section > .container, .page-section > .container-narrow'
options[:skip] = %w(guides development tutorial versions all)
options[:skip_patterns] = [/\/history\z/]
options[:replace_paths] = {
'api/web-view-tag' => 'api/webview-tag'
}
options[:attribution] = <<-HTML
&copy; 2013&ndash;2018 GitHub Inc.<br>
Licensed under the MIT license.
HTML
def get_latest_version(options, &block)
fetch_doc('https://electronjs.org/docs', options) do |doc|
block.call doc.at_css('.docs-version').content
end
end
end
end