forked from freeCodeCamp/devdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.rb
40 lines (32 loc) · 1.08 KB
/
astro.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module Docs
class Astro < UrlScraper
self.name = 'Astro'
self.slug = 'astro'
self.type = 'simple'
self.links = {
home: 'https://docs.astro.build/',
code: 'https://github.com/withastro/astro'
}
# https://github.com/withastro/astro/blob/main/LICENSE
options[:attribution] = <<-HTML
© 2021 Fred K. Schott<br>
Licensed under the MIT License.
HTML
options[:skip_patterns] = [/tutorial/, /getting-started/]
self.release = '4.14.2'
self.base_url = 'https://docs.astro.build/en/'
self.initial_paths = %w(install-and-setup/)
html_filters.push 'astro/entries', 'astro/clean_html'
def get_latest_version(opts)
get_npm_version('astro', opts)
end
private
def parse(response)
if response.url == self.base_url
# root_page is a redirect
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>'
end
super
end
end
end