crystal.rb 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. module Docs
  2. class Crystal < UrlScraper
  3. self.type = 'crystal'
  4. self.release = '0.19.2'
  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[:replace_paths] = {
  15. "api/#{release}/" => "api/#{release}/index.html",
  16. 'docs/' => 'docs/index.html'
  17. }
  18. options[:attribution] = ->(filter) {
  19. if filter.slug.start_with?('docs')
  20. <<-HTML
  21. To the extent possible under law, the persons who contributed to this work
  22. have waived<br>all copyright and related or neighboring rights to this work
  23. by associating CC0 with it.
  24. HTML
  25. else
  26. <<-HTML
  27. &copy; 2012&ndash;2016 Manas Technology Solutions.<br>
  28. Licensed under the Apache License, Version 2.0.
  29. HTML
  30. end
  31. }
  32. end
  33. end