Astro
Astro is a website build tool for the modern web — powerful developer experience meets lightweight output.
diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index b951eabd..1dbc759f 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,4 +1,8 @@
[
+ [
+ "2022-10-10",
+ "New documentation: Astro"
+ ],
[
"2022-10-09",
"New documentations: FastAPI, Vitest"
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee
index 087e7e3d..387a8f52 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -101,6 +101,11 @@ credits = [
'2018 The Apache Software Foundation
Apache and the Apache feather logo are trademarks of The Apache Software Foundation.',
'Apache',
'https://www.apache.org/licenses/LICENSE-2.0'
+ ], [
+ 'Astro',
+ '2022 withastro',
+ 'MIT',
+ 'https://github.com/withastro/docs/blob/main/LICENSE'
], [
'Async',
'2010-2018 Caolan McMahon',
diff --git a/lib/docs/filters/astro/clean_html.rb b/lib/docs/filters/astro/clean_html.rb
new file mode 100644
index 00000000..245bf8b8
--- /dev/null
+++ b/lib/docs/filters/astro/clean_html.rb
@@ -0,0 +1,28 @@
+module Docs
+ class Astro
+ class CleanHtmlFilter < Filter
+ def call
+ @doc = at_css('article > section')
+
+ css('.anchor-link').remove
+
+ css('pre').each do |node|
+ node.content = node.css('.line').map(&:content).join("\n")
+ node['data-language'] = node.ancestors('figure').first['class'][/lang-(\w+)/, 1]
+ node.remove_attribute('style')
+ end
+
+ css('figcaption').each do |node|
+ node.name = 'div'
+ node['class'] = '_pre-heading'
+ end
+
+ css('figure').each do |node|
+ node.before(node.children).remove
+ end
+
+ doc
+ end
+ end
+ end
+end
diff --git a/lib/docs/filters/astro/entries.rb b/lib/docs/filters/astro/entries.rb
new file mode 100644
index 00000000..c451058c
--- /dev/null
+++ b/lib/docs/filters/astro/entries.rb
@@ -0,0 +1,25 @@
+module Docs
+ class Astro
+ class EntriesFilter < Docs::EntriesFilter
+ def get_name
+ name = at_css('h1').content
+ name.sub! %r{\s*#\s*}, ''
+ name
+ end
+
+ def get_type
+ aside = at_css('aside')
+ a = aside.at_css('a[aria-current="page"]', 'a[data-current-parent="true"]')
+ a.ancestors('details').at_css('summary').content
+ end
+
+ def additional_entries
+ at_css('article').css('h2, h3').each_with_object [] do |node, entries|
+ type = node.content.strip
+ type.sub! %r{\s*#\s*}, ''
+ entries << ["#{name}: #{type}", node['id']]
+ end
+ end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/astro.rb b/lib/docs/scrapers/astro.rb
new file mode 100644
index 00000000..1bf3e083
--- /dev/null
+++ b/lib/docs/scrapers/astro.rb
@@ -0,0 +1,38 @@
+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
+ Licensed under the MIT License.
+ HTML
+
+ self.release = '1.4.7'
+ self.base_url = 'https://docs.astro.build/en/'
+ self.initial_paths = %w(getting-started/)
+
+ 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{.*}, '
Astro is a website build tool for the modern web — powerful developer experience meets lightweight output.