File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 6
6
7
7
# Remove breadcrumbs before h1
8
8
css ( 'h1' ) . each do |node |
9
- node . previous . remove
9
+ if ( node . previous )
10
+ node . previous . remove
11
+ end
10
12
end
11
13
12
14
remove_selectors = [
Original file line number Diff line number Diff line change @@ -4,12 +4,15 @@ class EntriesReactDevFilter < Docs::EntriesFilter
4
4
def get_name
5
5
canary_copy = '- This feature is available in the latest Canary'
6
6
name = at_css ( 'article h1' ) . content
7
- return name . sub ( canary_copy , ' (Experimental )' )
7
+ return name . sub ( canary_copy , ' (Canary )' )
8
8
end
9
9
10
10
def get_type
11
11
breadcrumb_nodes = css ( 'a.tracking-wide' )
12
- return breadcrumb_nodes . last . content || 'Miscellaneous'
12
+ category = breadcrumb_nodes . last . content
13
+ is_learn_page = base_url . to_s . end_with? ( 'learn' )
14
+ prefix = is_learn_page ? 'Learn: ' : ''
15
+ return prefix + ( category || 'Miscellaneous' )
13
16
end
14
17
end
15
18
end
Original file line number Diff line number Diff line change 1
1
module Docs
2
2
class React < UrlScraper
3
+ include MultipleBaseUrls
4
+
3
5
self . name = 'React'
4
6
self . type = 'simple'
5
7
self . links = {
@@ -9,8 +11,12 @@ class React < UrlScraper
9
11
10
12
version do
11
13
self . release = '18.3.1'
12
- # TODO add /learn
13
- self . base_url = 'https://react.dev/reference'
14
+ host = 'https://react.dev'
15
+ self . base_urls = [
16
+ "#{ host } /reference" ,
17
+ "#{ host } /learn" ,
18
+ ]
19
+ self . initial_paths = %w( /react )
14
20
15
21
html_filters . push 'react/entries_react_dev' , 'react/clean_html_react_dev'
16
22
You can’t perform that action at this time.
0 commit comments