trio.rb 820 B

12345678910111213141516171819202122232425262728293031
  1. module Docs
  2. class Trio < UrlScraper
  3. self.type = 'simple'
  4. self.release = '0.12.1'
  5. self.base_url = 'https://trio.readthedocs.io/en/v0.12.1/'
  6. self.root_path = 'index.html'
  7. self.links = {
  8. home: 'https://trio.readthedocs.io/',
  9. code: 'https://github.com/python-trio/trio'
  10. }
  11. html_filters.push 'trio/entries', 'trio/clean_html'
  12. options[:only_patterns] = [
  13. /reference-core/,
  14. /reference-io/,
  15. /reference-testing/,
  16. /reference-hazmat/,
  17. ]
  18. options[:attribution] = <<-HTML
  19. &copy; 2017 Nathaniel J. Smith<br>
  20. Licensed under the MIT License.
  21. HTML
  22. def get_latest_version(opts)
  23. doc = fetch_doc('https://trio.readthedocs.io/en/stable/', opts)
  24. doc.at_css('.rst-other-versions a[href^="/en/v"]').content[1..-1]
  25. end
  26. end
  27. end