Add React documentation

pull/165/head
Thibaut 10 years ago
parent 444e67d233
commit 7b358f6f28

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 62 KiB

@ -1,6 +1,6 @@
[
[ "2014-12-20",
"New <a href=\"/rethinkdb/\">RethinkDB</a> documentation"
[ "2014-12-21",
"New <a href=\"/react/\">React</a> and <a href=\"/rethinkdb/\">RethinkDB</a> documentations"
], [
"2014-11-30",
"New <a href=\"/phpunit/\">PHPUnit</a> and <a href=\"/nokogiri/\">Nokogiri</a> documentations"

@ -253,6 +253,11 @@ credits = [
'1990-2014 Python Software Foundation<br>Python is a trademark of the Python Software Foundation.',
'PSFL',
'http://docs.python.org/3/license.html'
], [
'React',
'2013-2014 Facebook Inc.',
'CC BY',
'https://raw.githubusercontent.com/facebook/react/master/LICENSE-docs'
], [
'Redis',
'2009-2014 Salvatore Sanfilippo',

@ -0,0 +1,9 @@
#= require views/pages/base
class app.views.ReactPage extends app.views.BasePage
afterRender: ->
for el in @findAllByTag 'pre'
switch el.getAttribute('data-lang')
when 'html' then @highlightCode el, 'markup'
when 'javascript' then @highlightCode el, 'javascript'
return

@ -57,6 +57,7 @@
'pages/phpunit',
'pages/postgres',
'pages/rdoc',
'pages/react',
'pages/redis',
'pages/requirejs',
'pages/rethinkdb',

@ -15,6 +15,7 @@
iframe {
display: block;
margin-bottom: 1em;
padding: 1px;
border: 1px dotted $boxBorder;
border-radius: 3px;

@ -73,3 +73,4 @@
._icon-phpunit:before { background-position: -3rem -11rem; }
._icon-nokogiri:before { background-position: -4rem -11rem; }
._icon-rethinkdb:before { background-position: 0 -12rem; }
._icon-react:before { background-position: -1rem -12rem; }

@ -0,0 +1,8 @@
._react {
> h2 { @extend %block-heading; }
> h3 { @extend %block-label, %label-blue; }
> h4 { font-size: 1em; }
code { @extend %label; }
blockquote { @extend %note; }
}

@ -0,0 +1,31 @@
module Docs
class React
class CleanHtmlFilter < Filter
def call
@doc = at_css('.inner-content')
if root_page?
at_css('h1').content = 'React Documentation'
end
css('.docs-prevnext', '.hash-link', '.edit-page-link').remove
css('a.anchor').each do |node|
node.parent['id'] = node['name']
end
css('.highlight').each do |node|
node.name = 'pre'
node['data-lang'] = node.at_css('[data-lang]')['data-lang']
node.content = node.content
end
css('blockquote > p:first-child').each do |node|
node.remove if node.content.strip == 'Note:'
end
doc
end
end
end
end

@ -0,0 +1,34 @@
module Docs
class React
class EntriesFilter < Docs::EntriesFilter
API_SLUGS = %w(
top-level-api
component-api
component-specs
)
def get_name
at_css('h1').child.content
end
def get_type
link = at_css('.nav-docs-section .active')
section = link.ancestors('.nav-docs-section').first
section.at_css('h3').content
end
def additional_entries
return [] unless API_SLUGS.include?(slug)
css('.inner-content h3, .inner-content h4').map do |node|
name = node.content
name.remove! %r{[#\(\)]}
name.remove! %r{\w+\:}
id = node.at_css('.anchor')['name']
type = slug.include?('component') ? 'Component' : 'React'
[name, id, type]
end
end
end
end
end

@ -0,0 +1,23 @@
module Docs
class React < UrlScraper
self.name = 'React'
self.type = 'react'
self.version = '0.12.2'
self.base_url = 'http://facebook.github.io/react/docs/'
self.root_path = 'getting-started.html'
html_filters.push 'react/entries', 'react/clean_html'
options[:container] = '.documentationContent'
options[:skip] = %w(
videos.html
complementary-tools.html
examples.html)
options[:attribution] = <<-HTML
&copy; 2013&ndash;2014 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: 495 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

@ -0,0 +1 @@
https://github.com/facebook/react/blob/master/docs/img/logo.svg
Loading…
Cancel
Save