Add React Native documentation

This commit is contained in:
Thibaut 2015-08-08 12:49:18 -04:00
parent ec9e755102
commit eabcb6179a
13 changed files with 58 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View file

@ -1,5 +1,8 @@
[
[
"2015-08-09",
"New documentation: <a href=\"/react_native/\">React Native</a>"
], [
"2015-08-03",
"Added an icon in the sidebar to constrain the width of the UI (visible when applicable)."
], [

View file

@ -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'

View file

@ -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; }

View file

@ -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; }

View file

@ -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

View file

@ -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

View file

@ -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(

View file

@ -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
&copy; 2015 Facebook Inc.<br>
Licensed under the Creative Commons Attribution 4.0 International Public License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

View file

@ -0,0 +1 @@
https://github.com/facebook/react-native/blob/gh-pages/img/favicon.png