1
0

astro.rb 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. module Docs
  2. class Astro < UrlScraper
  3. self.name = 'Astro'
  4. self.slug = 'astro'
  5. self.type = 'simple'
  6. self.links = {
  7. home: 'https://docs.astro.build/',
  8. code: 'https://github.com/withastro/astro'
  9. }
  10. # https://github.com/withastro/astro/blob/main/LICENSE
  11. options[:attribution] = <<-HTML
  12. &copy; 2021 Fred K. Schott<br>
  13. Licensed under the MIT License.
  14. HTML
  15. options[:skip_patterns] = [/tutorial/]
  16. self.release = '1.9.1'
  17. self.base_url = 'https://docs.astro.build/en/'
  18. self.initial_paths = %w(getting-started/)
  19. html_filters.push 'astro/entries', 'astro/clean_html'
  20. def get_latest_version(opts)
  21. get_npm_version('astro', opts)
  22. end
  23. private
  24. def parse(response)
  25. if response.url == self.base_url
  26. # root_page is a redirect
  27. response.body.gsub! %r{.*}, '<body><article><section><h1>Astro</h1><p> Astro is a website build tool for the modern web — powerful developer experience meets lightweight output.</p></section></article></body>'
  28. end
  29. super
  30. end
  31. end
  32. end