astro.rb 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. self.release = '1.4.7'
  16. self.base_url = 'https://docs.astro.build/en/'
  17. self.initial_paths = %w(getting-started/)
  18. html_filters.push 'astro/entries', 'astro/clean_html'
  19. def get_latest_version(opts)
  20. get_npm_version('astro', opts)
  21. end
  22. private
  23. def parse(response)
  24. if response.url == self.base_url
  25. # root_page is a redirect
  26. 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>'
  27. end
  28. super
  29. end
  30. end
  31. end