Add Flow documentation

This commit is contained in:
Thibaut 2015-11-22 13:33:13 -05:00
parent 6939865137
commit 2bf94f5491
11 changed files with 34 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View file

@ -1,7 +1,7 @@
[
[
"2015-11-22",
"New documentation: <a href=\"/dojo/\">Dojo</a>"
"New documentations: <a href=\"/dojo/\">Dojo</a> and <a href=\"/flow/\">Flow</a>"
], [
"2015-11-08",
"New documentations: <a href=\"/elixir/\">Elixir</a> and <a href=\"/vagrant/\">Vagrant</a>"

View file

@ -325,7 +325,7 @@ credits = [
'MIT',
'https://raw.githubusercontent.com/kriskowal/q/v1/LICENSE'
], [
'React, React Native',
'React, React Native, Flow',
'2013-2015 Facebook Inc.',
'CC BY',
'https://raw.githubusercontent.com/facebook/react/master/LICENSE-docs'

View file

@ -119,3 +119,4 @@
._icon-elixir:before { background-position: -4rem -9rem; @extend %darkIconFix !optional; }
._icon-vagrant:before { background-position: -5rem -9rem; }
._icon-dojo:before { background-position: -6rem -9rem; }
._icon-flow:before { background-position: -7rem -9rem; }

View file

@ -3,7 +3,7 @@
> h3 { @extend %block-label, %label-blue; }
> h4 { @extend %block-label; }
code { @extend %label; }
p code { @extend %label; }
blockquote { @extend %note; }
span.platform { float: right; }

View file

@ -2,7 +2,7 @@ module Docs
class React
class CleanHtmlFilter < Filter
def call
@doc = at_css('.inner-content')
@doc = at_css('.inner-content, article.withtoc')
if root_page?
at_css('h1').content = context[:root_title]
@ -16,10 +16,14 @@ module Docs
css('.highlight').each do |node|
node.name = 'pre'
node['data-lang'] = node.at_css('[data-lang]')['data-lang']
node['data-lang'] = node.at_css('[data-lang]').try(:[], 'data-lang') || 'js'
node.content = node.content
end
css('table.highlighttable').each do |node|
node.replace(node.at_css('pre.highlight'))
end
css('.prism').each do |node|
node.name = 'pre'
node['data-lang'] = node['class'][/(?<=language\-)(\w+)/]

View file

@ -18,8 +18,8 @@ module Docs
end
def get_type
link = at_css('.nav-docs-section .active')
section = link.ancestors('.nav-docs-section').first
link = at_css('.nav-docs-section .active, .toc .active')
section = link.ancestors('.nav-docs-section, section').first
type = section.at_css('h3').content.strip
type = REPLACE_TYPES[type] || type
type += ": #{name}" if type == 'Components'

22
lib/docs/scrapers/flow.rb Normal file
View file

@ -0,0 +1,22 @@
module Docs
class Flow < React
self.type = 'react'
self.version = '0.18'
self.base_url = 'http://flowtype.org/docs/'
self.root_path = 'about-flow.html'
self.links = {
home: 'http://flowtype.org/',
code: 'https://github.com/facebook/flow'
}
options[:container] = '.content'
options[:root_title] = 'Flow Documentation'
options[:only_patterns] = nil
options[:skip] = %w(coming-soon.html)
options[:attribution] = <<-HTML
&copy; 2013&ndash;2015 Facebook Inc.<br>
Licensed under the BSD License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B