Update Astro docs to 4.12.3
Unified · Split
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class Astro | 2 | class Astro |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | @doc = at_css('article > section') | 5 | @doc = at_css('main') |
| 6 | 6 | ||
| 7 | css('.anchor-link').remove | 7 | css('.anchor-link').remove |
| 8 | css('.avatar-list').remove | 8 | css('.avatar-list').remove |
| @@ -12,8 +12,7 @@ module Docs · 3 unmodified lines | |||
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | css('pre').each do |node| | 14 | css('pre').each do |node| |
| 15 | node.content = node.css('.line').map(&:content).join("\n") | 15 | node.content = node.css('.ec-line').map(&:content).join("\n") |
| 16 | node['data-language'] = node.ancestors('figure').first['class'][/lang-(\w+)/, 1] | ||
| 17 | node.remove_attribute('style') | 16 | node.remove_attribute('style') |
| 18 | end | 17 | end |
| 19 | 18 | ||
| @@ -2,25 +2,25 @@ module Docs · 1 unmodified line | |||
| 2 | class Astro | 2 | class Astro |
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | def get_name | 4 | def get_name |
| 5 | name = at_css('article h1').content | 5 | name = at_css('h1') ? at_css('h1').content : at_css('h2').content |
| 6 | name.sub! %r{\s*#\s*}, '' | 6 | name.sub!(/\s*#\s*/, '') |
| 7 | name | 7 | name |
| 8 | end | 8 | end |
| 9 | 9 | ||
| 10 | def get_type | 10 | def get_type |
| 11 | return 'Guides' if slug.start_with?('contribute/') | 11 | return 'Contribute' if slug.start_with?('contribute/') |
| 12 | return 'Guides' if slug.start_with?('guides/') | 12 | |
| 13 | aside = at_css('aside') | 13 | a = at_css('a[aria-current="page"]') |
| 14 | a = aside.at_css('a[aria-current="page"]', 'a[data-current-parent="true"]') | 14 | a ? a.content : 'Other' |
| 15 | a.ancestors('details').at_css('summary').content | ||
| 16 | end | 15 | end |
| 17 | 16 | ||
| 18 | def additional_entries | 17 | def additional_entries |
| 19 | return [] if slug.start_with?('guides/deploy') | 18 | return [] if slug.start_with?('guides/deploy') |
| 20 | return [] if slug.start_with?('guides/integrations-guide') | 19 | 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| | ||
| 22 | type = node.content.strip | 22 | type = node.content.strip |
| 23 | type.sub! %r{\s*#\s*}, '' | 23 | type.sub!(/\s*#\s*/, '') |
| 24 | entries << ["#{name}: #{type}", node['id']] | 24 | entries << ["#{name}: #{type}", node['id']] |
| 25 | end | 25 | end |
| 26 | end | 26 | end |
| @@ -10,15 +10,15 @@ module Docs · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | # https://github.com/withastro/astro/blob/main/LICENSE | 11 | # https://github.com/withastro/astro/blob/main/LICENSE |
| 12 | options[:attribution] = <<-HTML | 12 | options[:attribution] = <<-HTML |
| 13 | © 2021 Fred K. Schott<br> | 13 | Copyright (c) 2022 withastro<br> |
| 14 | Licensed under the MIT License. | 14 | Licensed under the MIT License. |
| 15 | HTML | 15 | HTML |
| 16 | 16 | ||
| 17 | options[:skip_patterns] = [/tutorial/] | 17 | options[:skip_patterns] = [/tutorial/] |
| 18 | 18 | ||
| 19 | self.release = '3.2.0' | 19 | self.release = '4.12.3' |
| 20 | self.base_url = 'https://docs.astro.build/en/' | 20 | self.base_url = 'https://docs.astro.build/en/' |
| 21 | self.initial_paths = %w(getting-started/) | 21 | self.initial_paths = %w(install-and-setup/) |
| 22 | 22 | ||
| 23 | html_filters.push 'astro/entries', 'astro/clean_html' | 23 | html_filters.push 'astro/entries', 'astro/clean_html' |
| 24 | 24 | ||