Unified · Split
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | |||
| 3 | class CleanHtmlFilter < Filter | 3 | class CleanHtmlFilter < Filter |
| 4 | def call | 4 | def call |
| 5 | if root_page? | 5 | if root_page? |
| 6 | css('#unsupported + div + center', '#unsupported + div', '#unsupported', '.toggler', 'center > img').remove | 6 | css('h1 ~ *').remove |
| 7 | end | 7 | end |
| 8 | 8 | ||
| 9 | css('center > .button', 'p:contains("short survey")', 'iframe', '.embedded-simulator').remove | 9 | css('center > .button', 'p:contains("short survey")', 'iframe', '.embedded-simulator').remove |
| @@ -0,0 +1,53 @@ | |||
| 1 | module Docs | ||
| 2 | class ReactNative | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | |||
| 5 | REPLACE_TYPES = { | ||
| 6 | 'The Basics' => 'Getting Started', | ||
| 7 | 'apis' => 'APIs', | ||
| 8 | 'components' => 'Components' | ||
| 9 | } | ||
| 10 | |||
| 11 | def get_name | ||
| 12 | at_css('h1').children.select(&:text?).map(&:content).join.strip | ||
| 13 | end | ||
| 14 | |||
| 15 | def get_type | ||
| 16 | link = at_css('.nav-docs-section .active, .toc .active') | ||
| 17 | return 'Miscellaneous' unless link | ||
| 18 | section = link.ancestors('.nav-docs-section, section').first | ||
| 19 | type = section.at_css('h3').content.strip | ||
| 20 | type = REPLACE_TYPES[type] || type | ||
| 21 | type += ": #{name}" if type == 'Components' | ||
| 22 | type | ||
| 23 | end | ||
| 24 | |||
| 25 | def additional_entries | ||
| 26 | entries = [] | ||
| 27 | |||
| 28 | css('.props > .prop > .propTitle', '.props > .prop > .methodTitle').each do |node| # react-native | ||
| 29 | name = node.children.find(&:text?).try(:content) | ||
| 30 | next if name.blank? | ||
| 31 | sep = node.content.include?('static') ? '.' : '#' | ||
| 32 | name.prepend(self.name + sep) | ||
| 33 | name << '()' if node['class'].include?('methodTitle') | ||
| 34 | id = node.at_css('.anchor')['name'] | ||
| 35 | entries << [name, id] | ||
| 36 | end | ||
| 37 | |||
| 38 | css('.apiIndex a pre').each do |node| # relay | ||
| 39 | next unless node.parent['href'].start_with?('#') | ||
| 40 | id = node.parent['href'].remove('#') | ||
| 41 | name = node.content.strip | ||
| 42 | sep = name.start_with?('static') ? '.' : '#' | ||
| 43 | name.remove! %r{(abstract|static) } | ||
| 44 | name.sub! %r{\(.*\)}, '()' | ||
| 45 | name.prepend(self.name + sep) | ||
| 46 | entries << [name, id] | ||
| 47 | end | ||
| 48 | |||
| 49 | entries | ||
| 50 | end | ||
| 51 | end | ||
| 52 | end | ||
| 53 | end | ||
| @@ -3,7 +3,7 @@ module Docs · 2 unmodified lines | |||
| 3 | self.name = 'React Native' | 3 | self.name = 'React Native' |
| 4 | self.slug = 'react_native' | 4 | self.slug = 'react_native' |
| 5 | self.type = 'react' | 5 | self.type = 'react' |
| 6 | self.release = '0.37' | 6 | self.release = '0.38' |
| 7 | self.base_url = 'https://facebook.github.io/react-native/docs/' | 7 | self.base_url = 'https://facebook.github.io/react-native/docs/' |
| 8 | self.root_path = 'getting-started.html' | 8 | self.root_path = 'getting-started.html' |
| 9 | self.links = { | 9 | self.links = { |
| @@ -11,10 +11,10 @@ module Docs · 1 unmodified line | |||
| 11 | code: 'https://github.com/facebook/react-native' | 11 | code: 'https://github.com/facebook/react-native' |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | html_filters.replace 'react/entries', 'react_native/entries' | ||
| 14 | html_filters.push 'react_native/clean_html' | 15 | html_filters.push 'react_native/clean_html' |
| 15 | 16 | ||
| 16 | options[:root_title] = 'React Native Documentation' | 17 | options[:root_title] = 'React Native Documentation' |
| 17 | options[:only_patterns] = nil | ||
| 18 | options[:skip_patterns] = [/\Asample\-/] | 18 | options[:skip_patterns] = [/\Asample\-/] |
| 19 | options[:skip] = %w( | 19 | options[:skip] = %w( |
| 20 | videos.html | 20 | videos.html |