Browse Source

Add Flow documentation

Thibaut 10 years ago
parent
commit
2bf94f5491

BIN
assets/images/icons.png


BIN
assets/images/icons@2x.png


+ 1 - 1
assets/javascripts/news.json

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

+ 1 - 1
assets/javascripts/templates/pages/about_tmpl.coffee

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

+ 1 - 0
assets/stylesheets/global/_icons.scss

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

+ 1 - 1
assets/stylesheets/pages/_react.scss

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

+ 6 - 2
lib/docs/filters/react/clean_html.rb

@@ -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+)/]

+ 2 - 2
lib/docs/filters/react/entries.rb

@@ -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 - 0
lib/docs/scrapers/flow.rb

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

BIN
public/icons/docs/flow/16.png


BIN
public/icons/docs/flow/16@2x.png