Unified · Split
| @@ -10,7 +10,7 @@ module Docs · 9 unmodified lines | |||
| 10 | def get_type | 10 | def get_type |
| 11 | breadcrumb_nodes = css('a.tracking-wide') | 11 | breadcrumb_nodes = css('a.tracking-wide') |
| 12 | category = breadcrumb_nodes.last.content | 12 | 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 | end | 16 | end |
| @@ -1,6 +1,5 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class React < UrlScraper | 2 | 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 do | 11 | 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] = <<-HTML | 20 | options[:attribution] = <<-HTML |
| 24 | © 2013–present Facebook Inc.<br> | 21 | © 2013–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. |