Unified · Split
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class ReactNative | 2 | class ReactNative |
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | @doc = at_css('.inner-content, article.withtoc') | 5 | @doc = at_css('.post') |
| 6 | 6 | ||
| 7 | if root_page? | 7 | if root_page? |
| 8 | at_css('h1').content = 'React Native Documentation' | 8 | at_css('h1').content = 'React Native Documentation' |
| @@ -12,9 +12,9 @@ module Docs · 11 unmodified lines | |||
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | def get_type | 14 | def get_type |
| 15 | link = at_css('.nav-docs-section .active, .toc .active') | 15 | link = at_css('.navItemActive') |
| 16 | return 'Miscellaneous' unless link | 16 | return 'Miscellaneous' unless link |
| 17 | section = link.ancestors('.nav-docs-section, section').first | 17 | section = link.ancestors('.navGroup').first |
| 18 | type = section.at_css('h3').content.strip | 18 | type = section.at_css('h3').content.strip |
| 19 | type = REPLACE_TYPES[type] || type | 19 | type = REPLACE_TYPES[type] || type |
| 20 | type += ": #{name}" if type == 'Components' | 20 | type += ": #{name}" if type == 'Components' |
| @@ -22,15 +22,13 @@ module Docs · 1 unmodified line | |||
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | def additional_entries | 24 | def additional_entries |
| 25 | css('.props > .prop > .propTitle', '.props > .prop > .methodTitle').each_with_object [] do |node, entries| | 25 | css('.mainContainer h3').each_with_object [] do |node, entries| |
| 26 | name = node.children.find(&:text?).try(:content) | 26 | subname = node.text |
| 27 | next if name.blank? | 27 | next if subname.blank? || node.css('code').empty? |
| 28 | sep = node.content.include?('static') ? '.' : '#' | 28 | sep = subname.include?('()') ? '.' : '#' |
| 29 | name.prepend(self.name + sep) | 29 | subname.prepend(name + sep) |
| 30 | name << '()' if node['class'].include?('methodTitle') | 30 | id = node.at_css('.anchor')['id'] |
| 31 | name.remove! %r{\??\:\s*\z} | 31 | entries << [subname, id] |
| 32 | id = node.at_css('.anchor')['name'] | ||
| 33 | entries << [name, id] | ||
| 34 | end | 32 | end |
| 35 | end | 33 | end |
| 36 | end | 34 | end |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | |||
| 2 | class ReactNative < UrlScraper | 2 | class ReactNative < UrlScraper |
| 3 | self.slug = 'react_native' | 3 | self.slug = 'react_native' |
| 4 | self.type = 'react_native' | 4 | self.type = 'react_native' |
| 5 | self.release = '0.49' | 5 | self.release = '0.55' |
| 6 | self.base_url = 'https://facebook.github.io/react-native/docs/' | 6 | self.base_url = 'https://facebook.github.io/react-native/docs/' |
| 7 | self.root_path = 'getting-started.html' | 7 | self.root_path = 'getting-started.html' |
| 8 | self.links = { | 8 | self.links = { |
| @@ -12,7 +12,7 @@ module Docs · 3 unmodified lines | |||
| 12 | 12 | ||
| 13 | html_filters.push 'react_native/entries', 'react_native/clean_html' | 13 | html_filters.push 'react_native/entries', 'react_native/clean_html' |
| 14 | 14 | ||
| 15 | options[:container] = '.documentationContent' | 15 | options[:container] = '.docMainWrapper' |
| 16 | options[:skip_patterns] = [/\Asample\-/] | 16 | options[:skip_patterns] = [/\Asample\-/] |
| 17 | options[:skip] = %w( | 17 | options[:skip] = %w( |
| 18 | videos.html | 18 | videos.html |
| @@ -27,7 +27,7 @@ module Docs · 8 unmodified lines | |||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | options[:attribution] = <<-HTML | 29 | options[:attribution] = <<-HTML |
| 30 | © 2015–2017 Facebook Inc.<br> | 30 | © 2015–2018 Facebook Inc.<br> |
| 31 | Licensed under the Creative Commons Attribution 4.0 International Public License. | 31 | Licensed under the Creative Commons Attribution 4.0 International Public License. |
| 32 | HTML | 32 | HTML |
| 33 | end | 33 | end |