Prechádzať zdrojové kódy

Add Relay documentation

Thibaut 10 rokov pred
rodič
commit
44bb507254

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 documentations: <a href=\"/dojo/\">Dojo</a> and <a href=\"/flow/\">Flow</a>"
+    "New documentations: <a href=\"/dojo/\">Dojo</a>, <a href=\"/relay/\">Relay</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, Flow',
+    'React, React Native, Flow, Relay',
     '2013-2015 Facebook Inc.',
     'CC BY',
     'https://raw.githubusercontent.com/facebook/react/master/LICENSE-docs'

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

@@ -120,3 +120,4 @@
 ._icon-vagrant:before       { background-position: -5rem -9rem; }
 ._icon-dojo:before          { background-position: -6rem -9rem; }
 ._icon-flow:before          { background-position: -7rem -9rem; }
+._icon-relay:before         { background-position: -8rem -9rem; }

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

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

+ 8 - 0
lib/docs/filters/react/clean_html.rb

@@ -41,6 +41,14 @@ module Docs
           node.before(node.children).remove
         end
 
+        css('a pre').each do |node|
+          node.name = 'code'
+        end
+
+        css('a[target]').each do |node|
+          node.remove_attribute('target')
+        end
+
         doc
       end
     end

+ 16 - 1
lib/docs/filters/react/entries.rb

@@ -37,7 +37,9 @@ module Docs
             [name, id, type]
           end
         else
-          css('.props > .prop > .propTitle').each_with_object([]) do |node, entries|
+          entries = []
+
+          css('.props > .prop > .propTitle').each do |node| # react-native
             name = node.children.find(&:text?).try(:content)
             next if name.blank?
             sep = node.content.include?('static') ? '.' : '#'
@@ -46,6 +48,19 @@ module Docs
             id = node.at_css('.anchor')['name']
             entries << [name, id]
           end
+
+          css('.apiIndex a pre').each do |node| # relay
+            next unless node.parent['href'].start_with?('#')
+            id = node.parent['href'].remove('#')
+            name = node.content.strip
+            sep = name.start_with?('static') ? '.' : '#'
+            name.remove! %r{(abstract|static) }
+            name.sub! %r{\(.*\)}, '()'
+            name.prepend(self.name + sep)
+            entries << [name, id]
+          end
+
+          entries
         end
       end
     end

+ 21 - 0
lib/docs/scrapers/relay.rb

@@ -0,0 +1,21 @@
+module Docs
+  class Relay < React
+    self.type = 'react'
+    self.version = '0.5'
+    self.base_url = 'https://facebook.github.io/relay/docs/'
+    self.root_path = 'getting-started.html'
+    self.links = {
+      home: 'https://facebook.github.io/relay/',
+      code: 'https://github.com/facebook/relay'
+    }
+
+    options[:root_title] = 'Relay Documentation'
+    options[:only_patterns] = nil
+    options[:skip] = %w(videos.html graphql-further-reading.html)
+
+    options[:attribution] = <<-HTML
+      &copy; 2013&ndash;2015 Facebook Inc.<br>
+      Licensed under the BSD License.
+    HTML
+  end
+end

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


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