1
0

electron.rb 930 B

12345678910111213141516171819202122232425262728293031
  1. module Docs
  2. class Electron < UrlScraper
  3. self.type = 'simple'
  4. self.base_url = 'https://electronjs.org/docs'
  5. self.release = '2.0.2'
  6. self.links = {
  7. home: 'https://electronjs.org/',
  8. code: 'https://github.com/electron/electron'
  9. }
  10. html_filters.push 'electron/clean_html', 'electron/entries'
  11. options[:trailing_slash] = false
  12. options[:container] = '.page-section > .container, .page-section > .container-narrow'
  13. options[:skip] = %w(guides development tutorial versions all)
  14. options[:skip_patterns] = [/\/history\z/]
  15. options[:replace_paths] = {
  16. 'api/web-view-tag' => 'api/webview-tag'
  17. }
  18. options[:attribution] = <<-HTML
  19. &copy; 2013&ndash;2018 GitHub Inc.<br>
  20. Licensed under the MIT license.
  21. HTML
  22. def get_latest_version(opts)
  23. doc = fetch_doc('https://electronjs.org/docs', opts)
  24. doc.at_css('.docs-version').content
  25. end
  26. end
  27. end