Skip to content

Commit 38ce1af

Browse files
authored
Merge pull request #2304 from Lippiece/main
Update Astro docs to 4.12.3
2 parents a49e13d + 837c6e6 commit 38ce1af

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

lib/docs/filters/astro/clean_html.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Docs
22
class Astro
33
class CleanHtmlFilter < Filter
44
def call
5-
@doc = at_css('article > section')
5+
@doc = at_css('main')
66

77
css('.anchor-link').remove
88
css('.avatar-list').remove
@@ -12,8 +12,7 @@ def call
1212
end
1313

1414
css('pre').each do |node|
15-
node.content = node.css('.line').map(&:content).join("\n")
16-
node['data-language'] = node.ancestors('figure').first['class'][/lang-(\w+)/, 1]
15+
node.content = node.css('.ec-line').map(&:content).join("\n")
1716
node.remove_attribute('style')
1817
end
1918

lib/docs/filters/astro/entries.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ module Docs
22
class Astro
33
class EntriesFilter < Docs::EntriesFilter
44
def get_name
5-
name = at_css('article h1').content
6-
name.sub! %r{\s*#\s*}, ''
5+
name = at_css('h1') ? at_css('h1').content : at_css('h2').content
6+
name.sub!(/\s*#\s*/, '')
77
name
88
end
99

1010
def get_type
11-
return 'Guides' if slug.start_with?('contribute/')
12-
return 'Guides' if slug.start_with?('guides/')
13-
aside = at_css('aside')
14-
a = aside.at_css('a[aria-current="page"]', 'a[data-current-parent="true"]')
15-
a.ancestors('details').at_css('summary').content
11+
return 'Contribute' if slug.start_with?('contribute/')
12+
13+
a = at_css('a[aria-current="page"]')
14+
a ? a.content : 'Other'
1615
end
1716

1817
def additional_entries
1918
return [] if slug.start_with?('guides/deploy')
2019
return [] if slug.start_with?('guides/integrations-guide')
21-
at_css('article').css('h2[id], h3[id]').each_with_object [] do |node, entries|
20+
21+
at_css('main').css('h2[id], h3[id]').each_with_object [] do |node, entries|
2222
type = node.content.strip
23-
type.sub! %r{\s*#\s*}, ''
23+
type.sub!(/\s*#\s*/, '')
2424
entries << ["#{name}: #{type}", node['id']]
2525
end
2626
end

lib/docs/scrapers/astro.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ class Astro < UrlScraper
1010

1111
# https://github.com/withastro/astro/blob/main/LICENSE
1212
options[:attribution] = <<-HTML
13-
&copy; 2021 Fred K. Schott<br>
13+
Copyright (c) 2022 withastro<br>
1414
Licensed under the MIT License.
1515
HTML
1616

1717
options[:skip_patterns] = [/tutorial/]
1818

19-
self.release = '3.2.0'
19+
self.release = '4.12.3'
2020
self.base_url = 'https://docs.astro.build/en/'
21-
self.initial_paths = %w(getting-started/)
21+
self.initial_paths = %w(install-and-setup/)
2222

2323
html_filters.push 'astro/entries', 'astro/clean_html'
2424

0 commit comments

Comments
 (0)