godot.rb 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. options[:container] = '.document .section'
  9. options[:download_images] = false
  10. options[:only_patterns] = [/\Agetting_started\//, /\Aclasses\//]
  11. options[:attribution] = ->(filter) do
  12. if filter.subpath.start_with?('classes')
  13. <<-HTML
  14. &copy; 2014&ndash;2022 Juan Linietsky, Ariel Manzur, Godot Engine contributors<br>
  15. Licensed under the MIT License.
  16. HTML
  17. else
  18. <<-HTML
  19. &copy; 2014&ndash;2022 Juan Linietsky, Ariel Manzur and the Godot community<br>
  20. Licensed under the Creative Commons Attribution Unported License v3.0.
  21. HTML
  22. end
  23. end
  24. version '3.5' do
  25. self.release = '3.5.1'
  26. self.base_url = "https://docs.godotengine.org/en/#{self.version}/"
  27. options[:container] = '.document > [itemprop="articleBody"] > section[id]'
  28. html_filters.push 'godot/entries', 'godot/clean_html', 'sphinx/clean_html'
  29. end
  30. version '3.4' do
  31. self.release = '3.4.5'
  32. self.base_url = "https://docs.godotengine.org/en/#{self.version}/"
  33. options[:container] = '.document > [itemprop="articleBody"] > section[id]'
  34. html_filters.push 'godot/entries', 'godot/clean_html', 'sphinx/clean_html'
  35. end
  36. version '3.3' do
  37. self.release = '3.3.0'
  38. self.base_url = "https://docs.godotengine.org/en/#{self.version}/"
  39. html_filters.push 'godot/entries', 'godot/clean_html', 'sphinx/clean_html'
  40. end
  41. version '3.2' do
  42. self.release = '3.2.3'
  43. self.base_url = "https://docs.godotengine.org/en/#{self.version}/"
  44. html_filters.push 'godot/entries', 'godot/clean_html', 'sphinx/clean_html'
  45. end
  46. version '2.1' do
  47. self.release = '2.1.6'
  48. self.base_url = "https://docs.godotengine.org/en/#{self.version}/"
  49. options[:skip] = %w(classes/class_@global\ scope.html)
  50. options[:only_patterns] = [/\Alearning\//, /\Aclasses\//]
  51. html_filters.push 'godot/entries_v2', 'godot/clean_html_v2', 'sphinx/clean_html'
  52. end
  53. def get_latest_version(opts)
  54. get_latest_github_release('godotengine', 'godot', opts).split('-')[0]
  55. end
  56. end
  57. end