Skip to content

Commit 33aba06

Browse files
committed
use single base URL for working crosslinks
1 parent fefde4e commit 33aba06

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

lib/docs/filters/react/entries_react_dev.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def get_name
1010
def get_type
1111
breadcrumb_nodes = css('a.tracking-wide')
1212
category = breadcrumb_nodes.last.content
13-
is_learn_page = base_url.to_s.end_with?('learn')
13+
is_learn_page = path.start_with?('learn/')
1414
prefix = is_learn_page ? 'Learn: ' : ''
1515
return prefix + (category || 'Miscellaneous')
1616
end

lib/docs/scrapers/react.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module Docs
22
class React < UrlScraper
3-
include MultipleBaseUrls
43

54
self.name = 'React'
65
self.type = 'simple'
@@ -11,15 +10,13 @@ class React < UrlScraper
1110

1211
version do
1312
self.release = '18.3.1'
14-
host = 'https://react.dev'
15-
self.base_urls = [
16-
"#{host}/reference",
17-
"#{host}/learn",
18-
]
19-
self.initial_paths = %w(/react)
13+
self.base_url = 'https://react.dev'
14+
self.initial_paths = %w(/reference/react /learn)
2015

2116
html_filters.push 'react/entries_react_dev', 'react/clean_html_react_dev'
2217

18+
options[:only_patterns] = [/\A\/learn/, /\A\/reference/]
19+
2320
options[:attribution] = <<-HTML
2421
&copy; 2013&ndash;present Facebook Inc.<br>
2522
Licensed under the Creative Commons Attribution 4.0 International Public License.

0 commit comments

Comments
 (0)