diff --git a/assets/images/icons.png b/assets/images/icons.png index 93afb499..7bca5a0b 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index a04f5b71..2dce0637 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 391bed88..83840abb 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,5 +1,8 @@ [ [ + "2015-08-09", + "New documentation: React Native" + ], [ "2015-08-03", "Added an icon in the sidebar to constrain the width of the UI (visible when applicable)." ], [ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 0af71918..de0d9a24 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -310,7 +310,7 @@ credits = [ 'MIT', 'https://raw.githubusercontent.com/kriskowal/q/v1/LICENSE' ], [ - 'React', + 'React, React Native', '2013-2015 Facebook Inc.', 'CC BY', 'https://raw.githubusercontent.com/facebook/react/master/LICENSE-docs' diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index e18c6dd3..f1cf5289 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -4,7 +4,7 @@ width: 1rem; height: 1rem; background-image: image-url('icons.png'); - background-size: 10rem 9rem; + background-size: 10rem 10rem; } @media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) { @@ -111,3 +111,4 @@ %icon-contract { background-position: -7rem -8rem; } %icon-expand-white { background-position: -8rem -8rem; } %icon-contract-white { background-position: -9rem -8rem; } +._icon-react_native:before { background-position: 0 -9rem; } diff --git a/assets/stylesheets/pages/_react.scss b/assets/stylesheets/pages/_react.scss index dbed0046..026f25d2 100644 --- a/assets/stylesheets/pages/_react.scss +++ b/assets/stylesheets/pages/_react.scss @@ -1,7 +1,7 @@ ._react { > h2 { @extend %block-heading; } > h3 { @extend %block-label, %label-blue; } - > h4 { font-size: 1em; } + > h4 { @extend %block-label; } code { @extend %label; } blockquote { @extend %note; } diff --git a/lib/docs/filters/react/clean_html.rb b/lib/docs/filters/react/clean_html.rb index a9a7d829..25b3b8bb 100644 --- a/lib/docs/filters/react/clean_html.rb +++ b/lib/docs/filters/react/clean_html.rb @@ -5,10 +5,10 @@ module Docs @doc = at_css('.inner-content') if root_page? - at_css('h1').content = 'React Documentation' + at_css('h1').content = context[:root_title] end - css('.docs-prevnext', '.hash-link', '.edit-page-link').remove + css('.docs-prevnext', '.hash-link', '.edit-page-link', '.edit-github').remove css('a.anchor').each do |node| node.parent['id'] = node['name'] @@ -20,10 +20,23 @@ module Docs node.content = node.content end + css('.prism').each do |node| + node.name = 'pre' + node['data-lang'] = node['class'][/(?<=language\-)(\w+)/] + node.content = node.content + end + css('blockquote > p:first-child').each do |node| node.remove if node.content.strip == 'Note:' end + css('h3#props', 'h3#methods').each { |node| node.name = 'h2' } + css('h4.propTitle').each { |node| node.name = 'h3' } + + css('> div > div', '> div', 'div > span', '.props', '.prop').each do |node| + node.before(node.children).remove + end + doc end end diff --git a/lib/docs/filters/react/entries.rb b/lib/docs/filters/react/entries.rb index 07ff0b69..f233c26d 100644 --- a/lib/docs/filters/react/entries.rb +++ b/lib/docs/filters/react/entries.rb @@ -7,6 +7,12 @@ module Docs docs/component-specs ) + REPLACE_TYPES = { + 'Quick Start' => 'Guides', + 'apis' => 'APIs', + 'components' => 'Components' + } + def get_name at_css('h1').child.content end @@ -14,7 +20,8 @@ module Docs def get_type link = at_css('.nav-docs-section .active') section = link.ancestors('.nav-docs-section').first - section.at_css('h3').content + type = section.at_css('h3').content.strip + REPLACE_TYPES[type] || type end def additional_entries diff --git a/lib/docs/scrapers/react.rb b/lib/docs/scrapers/react.rb index 11888d2c..20d434f3 100644 --- a/lib/docs/scrapers/react.rb +++ b/lib/docs/scrapers/react.rb @@ -12,6 +12,7 @@ module Docs html_filters.push 'react/entries', 'react/clean_html' + options[:root_title] = 'React Documentation' options[:container] = '.documentationContent' options[:only_patterns] = [/\Adocs\//, /\Atips\//] options[:skip] = %w( diff --git a/lib/docs/scrapers/react_native.rb b/lib/docs/scrapers/react_native.rb new file mode 100644 index 00000000..d52015fa --- /dev/null +++ b/lib/docs/scrapers/react_native.rb @@ -0,0 +1,26 @@ +module Docs + class ReactNative < React + self.name = 'React Native' + self.slug = 'react_native' + self.type = 'react' + self.version = '0.8.0' + self.base_url = 'https://facebook.github.io/react-native/docs/' + self.root_path = 'getting-started.html' + self.links = { + home: 'https://facebook.github.io/react-native/', + code: 'https://github.com/facebook/react-native' + } + + options[:root_title] = 'React Native Documentation' + options[:only_patterns] = nil + options[:skip] = %w( + videos.html + transforms.html + troubleshooting.html) + + options[:attribution] = <<-HTML + © 2015 Facebook Inc.
+ Licensed under the Creative Commons Attribution 4.0 International Public License. + HTML + end +end diff --git a/public/icons/docs/react_native/16.png b/public/icons/docs/react_native/16.png new file mode 100644 index 00000000..01011842 Binary files /dev/null and b/public/icons/docs/react_native/16.png differ diff --git a/public/icons/docs/react_native/16@2x.png b/public/icons/docs/react_native/16@2x.png new file mode 100644 index 00000000..aae4d0dc Binary files /dev/null and b/public/icons/docs/react_native/16@2x.png differ diff --git a/public/icons/docs/react_native/SOURCE b/public/icons/docs/react_native/SOURCE new file mode 100644 index 00000000..c1d5f7fb --- /dev/null +++ b/public/icons/docs/react_native/SOURCE @@ -0,0 +1 @@ +https://github.com/facebook/react-native/blob/gh-pages/img/favicon.png