1
0

crystal.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. module Docs
  2. class Crystal < UrlScraper
  3. self.type = 'crystal'
  4. self.release = '0.20.3'
  5. self.base_url = 'https://crystal-lang.org/'
  6. self.root_path = "api/#{release}/index.html"
  7. self.initial_paths = %w(docs/index.html)
  8. self.links = {
  9. home: 'https://crystal-lang.org/',
  10. code: 'https://github.com/crystal-lang/crystal'
  11. }
  12. html_filters.push 'crystal/entries', 'crystal/clean_html'
  13. options[:only_patterns] = [/\Adocs\//, /\Aapi\/#{release}\//]
  14. options[:skip_patterns] = [/debug/i]
  15. options[:replace_paths] = {
  16. "api/#{release}/" => "api/#{release}/index.html",
  17. 'docs/' => 'docs/index.html'
  18. }
  19. options[:attribution] = ->(filter) {
  20. if filter.slug.start_with?('docs')
  21. <<-HTML
  22. To the extent possible under law, the persons who contributed to this work
  23. have waived<br>all copyright and related or neighboring rights to this work
  24. by associating CC0 with it.
  25. HTML
  26. else
  27. <<-HTML
  28. &copy; 2012&ndash;2016 Manas Technology Solutions.<br>
  29. Licensed under the Apache License, Version 2.0.
  30. HTML
  31. end
  32. }
  33. end
  34. end