Merge pull request #2304 from Lippiece/main

Update Astro docs to 4.12.3
pull/2307/head
Simon Legner 5 months ago committed by GitHub
commit 38ce1af74e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2,7 +2,7 @@ module Docs
class Astro class Astro
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
@doc = at_css('article > section') @doc = at_css('main')
css('.anchor-link').remove css('.anchor-link').remove
css('.avatar-list').remove css('.avatar-list').remove
@ -12,8 +12,7 @@ module Docs
end end
css('pre').each do |node| css('pre').each do |node|
node.content = node.css('.line').map(&:content).join("\n") node.content = node.css('.ec-line').map(&:content).join("\n")
node['data-language'] = node.ancestors('figure').first['class'][/lang-(\w+)/, 1]
node.remove_attribute('style') node.remove_attribute('style')
end end

@ -2,25 +2,25 @@ module Docs
class Astro class Astro
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
name = at_css('article h1').content name = at_css('h1') ? at_css('h1').content : at_css('h2').content
name.sub! %r{\s*#\s*}, '' name.sub!(/\s*#\s*/, '')
name name
end end
def get_type def get_type
return 'Guides' if slug.start_with?('contribute/') return 'Contribute' if slug.start_with?('contribute/')
return 'Guides' if slug.start_with?('guides/')
aside = at_css('aside') a = at_css('a[aria-current="page"]')
a = aside.at_css('a[aria-current="page"]', 'a[data-current-parent="true"]') a ? a.content : 'Other'
a.ancestors('details').at_css('summary').content
end end
def additional_entries def additional_entries
return [] if slug.start_with?('guides/deploy') return [] if slug.start_with?('guides/deploy')
return [] if slug.start_with?('guides/integrations-guide') return [] if slug.start_with?('guides/integrations-guide')
at_css('article').css('h2[id], h3[id]').each_with_object [] do |node, entries|
at_css('main').css('h2[id], h3[id]').each_with_object [] do |node, entries|
type = node.content.strip type = node.content.strip
type.sub! %r{\s*#\s*}, '' type.sub!(/\s*#\s*/, '')
entries << ["#{name}: #{type}", node['id']] entries << ["#{name}: #{type}", node['id']]
end end
end end

@ -10,15 +10,15 @@ module Docs
# https://github.com/withastro/astro/blob/main/LICENSE # https://github.com/withastro/astro/blob/main/LICENSE
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2021 Fred K. Schott<br> Copyright (c) 2022 withastro<br>
Licensed under the MIT License. Licensed under the MIT License.
HTML HTML
options[:skip_patterns] = [/tutorial/] options[:skip_patterns] = [/tutorial/]
self.release = '3.2.0' self.release = '4.12.3'
self.base_url = 'https://docs.astro.build/en/' self.base_url = 'https://docs.astro.build/en/'
self.initial_paths = %w(getting-started/) self.initial_paths = %w(install-and-setup/)
html_filters.push 'astro/entries', 'astro/clean_html' html_filters.push 'astro/entries', 'astro/clean_html'

Loading…
Cancel
Save