godot.rb 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. module Docs
  2. class Godot < UrlScraper
  3. self.type = 'sphinx_simple'
  4. self.links = {
  5. home: 'https://godotengine.org/',
  6. code: 'https://github.com/godotengine/godot'
  7. }
  8. html_filters.push 'godot/entries', 'godot/clean_html', 'sphinx/clean_html'
  9. options[:download_images] = false
  10. options[:container] = '.document .section'
  11. options[:only_patterns] = [/\Alearning\//, /\Aclasses\//]
  12. options[:skip] = %w(classes/class_@global\ scope.html)
  13. options[:attribution] = ->(filter) do
  14. if filter.subpath.start_with?('classes')
  15. <<-HTML
  16. &copy; 2014&ndash;2018 Juan Linietsky, Ariel Manzur, Godot Engine contributors<br>
  17. Licensed under the MIT License.
  18. HTML
  19. else
  20. <<-HTML
  21. &copy; 2014&ndash;2018 Juan Linietsky, Ariel Manzur and the Godot community<br>
  22. Licensed under the Creative Commons Attribution Unported License v3.0.
  23. HTML
  24. end
  25. end
  26. version '3.0' do
  27. self.release = '3.0.6'
  28. self.base_url = "http://docs.godotengine.org/en/#{self.version}/"
  29. end
  30. version '2.1' do
  31. self.release = '2.1'
  32. self.base_url = "http://docs.godotengine.org/en/#{self.version}/"
  33. end
  34. def get_latest_version(opts)
  35. doc = fetch_doc('https://docs.godotengine.org/', opts)
  36. doc.at_css('.version').content.strip
  37. end
  38. end
  39. end