d.rb 970 B

1234567891011121314151617181920212223242526272829303132333435
  1. module Docs
  2. class D < UrlScraper
  3. include MultipleBaseUrls
  4. self.release = '2.095.1'
  5. self.type = 'd'
  6. self.base_urls = ['https://dlang.org/phobos/', 'https://dlang.org/spec/']
  7. self.root_path = 'index.html'
  8. self.links = {
  9. home: 'https://dlang.org/',
  10. code: 'https://github.com/dlang/phobos'
  11. }
  12. html_filters.push 'd/entries', 'd/clean_html'
  13. options[:skip] = %w(spec.html)
  14. options[:container] = '.container'
  15. options[:root_title] = 'D Programming Language'
  16. options[:title] = false
  17. options[:attribution] = <<-HTML
  18. &copy; 1999&ndash;2021 The D Language Foundation<br>
  19. Licensed under the Boost License 1.0.
  20. HTML
  21. def initial_urls
  22. %w(https://dlang.org/phobos/index.html https://dlang.org/spec/intro.html)
  23. end
  24. def get_latest_version(opts)
  25. doc = fetch_doc('https://dlang.org/changelog/', opts)
  26. doc.at_css('#content > ul > li:nth-child(2) > a')['id']
  27. end
  28. end
  29. end