History

use single base URL for working crosslinks

Gergely Gombos committed 1 year ago

Commit 33aba061 parent fefde4e2 files · +5 −8Browse files

Unified · Split

2 files
  1. lib/docs/filters/react/entries_react_dev.rb +1 −1
  2. lib/docs/scrapers/react.rb +4 −7
lib/docs/filters/react/entries_react_dev.rb+1−1
@@ -10,7 +10,7 @@ module Docs · 9 unmodified lines
10 def get_type10 def get_type
11 breadcrumb_nodes = css('a.tracking-wide')11 breadcrumb_nodes = css('a.tracking-wide')
12 category = breadcrumb_nodes.last.content12 category = breadcrumb_nodes.last.content
13 is_learn_page = base_url.to_s.end_with?('learn')13 is_learn_page = path.start_with?('learn/')
14 prefix = is_learn_page ? 'Learn: ' : ''14 prefix = is_learn_page ? 'Learn: ' : ''
15 return prefix + (category || 'Miscellaneous')15 return prefix + (category || 'Miscellaneous')
16 end16 end
lib/docs/scrapers/react.rb+4−7
@@ -1,6 +1,5 @@
1module Docs1module Docs
2 class React < UrlScraper2 class React < UrlScraper
3 include MultipleBaseUrls
4 3
5 self.name = 'React'4 self.name = 'React'
6 self.type = 'simple'5 self.type = 'simple'
@@ -11,15 +10,13 @@ module Docs · 4 unmodified lines
11 10
12 version do11 version do
13 self.release = '18.3.1'12 self.release = '18.3.1'
14 host = 'https://react.dev'13 self.base_url = 'https://react.dev'
15 self.base_urls = [14 self.initial_paths = %w(/reference/react /learn)
16 "#{host}/reference",
17 "#{host}/learn",
18 ]
19 self.initial_paths = %w(/react)
20 15
21 html_filters.push 'react/entries_react_dev', 'react/clean_html_react_dev'16 html_filters.push 'react/entries_react_dev', 'react/clean_html_react_dev'
22 17
18 options[:only_patterns] = [/\A\/learn/, /\A\/reference/]
19
23 options[:attribution] = <<-HTML20 options[:attribution] = <<-HTML
24 &copy; 2013&ndash;present Facebook Inc.<br>21 &copy; 2013&ndash;present Facebook Inc.<br>
25 Licensed under the Creative Commons Attribution 4.0 International Public License.22 Licensed under the Creative Commons Attribution 4.0 International Public License.