sqlite.rb 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. module Docs
  2. class Sqlite < FileScraper
  3. self.name = 'SQLite'
  4. self.type = 'sqlite'
  5. self.release = '3.25.2'
  6. self.base_url = 'https://sqlite.org/'
  7. self.root_path = 'docs.html'
  8. self.initial_paths = %w(keyword_index.html)
  9. self.links = {
  10. home: 'https://sqlite.org/',
  11. code: 'https://www.sqlite.org/src/'
  12. }
  13. html_filters.insert_before 'clean_html', 'sqlite/clean_js_tables'
  14. html_filters.push 'sqlite/entries', 'sqlite/clean_html'
  15. options[:only_patterns] = [/\.html\z/]
  16. options[:skip_patterns] = [/releaselog/, /consortium/]
  17. options[:skip] = %w(
  18. index.html
  19. about.html
  20. download.html
  21. copyright.html
  22. support.html
  23. prosupport.html
  24. hp1.html
  25. news.html
  26. oldnews.html
  27. doclist.html
  28. dev.html
  29. chronology.html
  30. not-found.html
  31. famous.html
  32. books.html
  33. crew.html
  34. mostdeployed.html
  35. requirements.html
  36. session/intro.html
  37. syntax.html
  38. )
  39. options[:attribution] = 'SQLite is in the Public Domain.'
  40. def get_latest_version(opts)
  41. doc = fetch_doc('https://sqlite.org/chronology.html', opts)
  42. doc.at_css('#chrontab > tbody > tr > td:last-child > a').content
  43. end
  44. private
  45. def parse(response)
  46. response.body.gsub! %r{(<h2[^>]*>[^<]+)</h1>}, '\1</h2>'
  47. super
  48. end
  49. end
  50. end