Skip to content

Commit d6274d6

Browse files
committed
Include license etc. as misc pages, based on main page
1 parent bdec41f commit d6274d6

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lib/docs/filters/click/entries.rb

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
module Docs
22
class Click
33
class EntriesFilter < Docs::EntriesFilter
4-
5-
def initialize(*)
4+
TYPE_BY_SLUG = {}
5+
6+
def call
7+
if root_page?
8+
css('section').each do |node|
9+
next if ['documentation', 'api-reference'].include?(node['id'])
10+
type = node.at_css('h2').content.strip
11+
node.css('li > a').each do |toclink|
12+
slug = toclink['href'].split('/')[-2]
13+
TYPE_BY_SLUG[slug] = type
14+
end
15+
end
16+
end
617
super
718
end
819

@@ -11,15 +22,15 @@ def get_name
1122
end
1223

1324
def get_type
14-
return at_css('h1').content.strip
25+
TYPE_BY_SLUG[slug.split('/').first] || at_css('h1').content.strip
1526
end
1627

1728
def include_default_entry?
18-
false
29+
TYPE_BY_SLUG.include?(slug.split('/').first)
1930
end
2031

2132
def additional_entries
22-
return [] if root_page?
33+
return [] if root_page? || TYPE_BY_SLUG.include?(slug.split('/').first)
2334

2435
if slug == 'api/'
2536
entries = []

0 commit comments

Comments
 (0)