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