graphviz.rb 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. module Docs
  2. class Graphviz < UrlScraper
  3. self.name = 'Graphviz'
  4. self.slug = 'graphviz'
  5. self.type = 'simple'
  6. self.links = {
  7. home: 'https://www.graphviz.org/',
  8. code: 'https://gitlab.com/graphviz/graphviz'
  9. }
  10. options[:container] = 'main'
  11. # These images are too large:
  12. # 980KB https://www.graphviz.org/doc/info/plugins.png
  13. # 650KB https://www.graphviz.org/Gallery/twopi/twopi2.svg
  14. # All other files are under 100KB
  15. options[:max_image_size] = 100_000
  16. # TODO: the UrlScraper is very unreliable on this website.
  17. # I often get several errors:
  18. # - SSL connect error
  19. # - Failure when receiving data from the peer
  20. # - was slow to process (30s)
  21. # Setting a :rate_limit doesn't help.
  22. # We have to figure out a more reliable solution.
  23. #options[:rate_limit] = 100
  24. options[:attribution] = <<-HTML
  25. &copy; 2025 The Graphviz Authors<br>
  26. Licensed under the Eclipse Public License 1.0.
  27. HTML
  28. html_filters.push 'graphviz/entries', 'graphviz/clean_html'
  29. self.release = '14.01'
  30. self.base_url = 'https://www.graphviz.org/'
  31. self.root_path = 'documentation/'
  32. options[:only_patterns] = [
  33. /^documentation\//,
  34. /^doc\//,
  35. /^docs\//,
  36. ]
  37. options[:replace_paths] = {
  38. # Redirections:
  39. 'docs/outputs/cmap/' => 'docs/outputs/imap/',
  40. 'doc/info/output.html' => 'docs/outputs/',
  41. }
  42. def get_latest_version(opts)
  43. tags = get_gitlab_tags('gitlab.com', 'graphviz', 'graphviz', opts)
  44. tags[0]['name']
  45. end
  46. end
  47. end