1
0

django.rb 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. module Docs
  2. class Django < FileScraper
  3. self.name = 'Django'
  4. self.type = 'sphinx'
  5. self.root_path = 'index.html'
  6. self.links = {
  7. home: 'https://www.djangoproject.com/',
  8. code: 'https://github.com/django/django'
  9. }
  10. html_filters.push 'django/entries', 'sphinx/clean_html', 'django/clean_html'
  11. text_filters.push 'django/fix_urls'
  12. options[:container] = '#bd'
  13. options[:skip] = %w(
  14. contents.html
  15. genindex.html
  16. py-modindex.html
  17. glossary.html
  18. search.html
  19. intro/whatsnext.html)
  20. options[:skip_patterns] = [
  21. /\Afaq\//,
  22. /\Ainternals\//,
  23. /\Amisc\//,
  24. /\Areleases\//,
  25. /\A_/,
  26. /flattened\-index\.html/]
  27. options[:attribution] = <<-HTML
  28. &copy; Django Software Foundation and individual contributors<br>
  29. Licensed under the BSD License.
  30. HTML
  31. version '3.0' do
  32. self.release = '3.0.3'
  33. self.base_url = 'https://docs.djangoproject.com/en/3.0/'
  34. end
  35. version '2.2' do
  36. self.release = '2.2.10'
  37. self.base_url = 'https://docs.djangoproject.com/en/2.2/'
  38. end
  39. version '2.1' do
  40. self.release = '2.1.15'
  41. self.base_url = 'https://docs.djangoproject.com/en/2.1/'
  42. end
  43. version '2.0' do
  44. self.release = '2.0.13'
  45. self.base_url = 'https://docs.djangoproject.com/en/2.0/'
  46. end
  47. version '1.11' do
  48. self.release = '1.11.28'
  49. self.base_url = 'https://docs.djangoproject.com/en/1.11/'
  50. end
  51. version '1.10' do
  52. self.release = '1.10.8'
  53. self.base_url = 'https://docs.djangoproject.com/en/1.10/'
  54. end
  55. version '1.9' do
  56. self.release = '1.9.13'
  57. self.base_url = 'https://docs.djangoproject.com/en/1.9/'
  58. end
  59. version '1.8' do
  60. self.release = '1.8.18'
  61. self.base_url = 'https://docs.djangoproject.com/en/1.8/'
  62. end
  63. def get_latest_version(opts)
  64. doc = fetch_doc('https://docs.djangoproject.com/', opts)
  65. doc.at_css('#doc-versions > li.current > span > strong').content
  66. end
  67. end
  68. end