Browse Source

Update Relay documentation (0.10.0)

Thibaut Courouble 9 năm trước cách đây
mục cha
commit
f18e92df47
2 tập tin đã thay đổi với 17 bổ sung2 xóa
  1. 16 1
      lib/docs/filters/react/entries.rb
  2. 1 1
      lib/docs/scrapers/relay.rb

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

@@ -14,7 +14,9 @@ module Docs
       end
 
       def additional_entries
-        css('.inner-content h3 code, .inner-content h4 code').each_with_object([]) do |node, entries|
+        entries = []
+
+        css('.inner-content h3 code, .inner-content h4 code').each do |node|
           name = node.content
           name.remove! %r{[#\(\)]}
           name.remove! %r{\w+\:}
@@ -30,6 +32,19 @@ module Docs
           end
           entries << [name, id, type]
         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

+ 1 - 1
lib/docs/scrapers/relay.rb

@@ -1,7 +1,7 @@
 module Docs
   class Relay < React
     self.type = 'react'
-    self.release = '0.9.3'
+    self.release = '0.10.0'
     self.base_url = 'https://facebook.github.io/relay/docs/'
     self.root_path = 'getting-started.html'
     self.links = {