浏览代码

Update Flow documentation (0.33)

Thibaut Courouble 9 年之前
父节点
当前提交
6765343d13
共有 3 个文件被更改,包括 9 次插入9 次删除
  1. 4 4
      lib/docs/filters/react/clean_html.rb
  2. 1 0
      lib/docs/filters/react/entries.rb
  3. 4 5
      lib/docs/scrapers/flow.rb

+ 4 - 4
lib/docs/filters/react/clean_html.rb

@@ -8,7 +8,7 @@ module Docs
           at_css('h1').content = context[:root_title]
         end
 
-        css('.docs-prevnext', '.hash-link', '.edit-page-link', '.edit-github').remove
+        css('.docs-prevnext', '.hash-link', '.edit-page-link', '.edit-github', 'a.hash', '.edit-page-block', 'a.show', 'a.hide').remove
 
         css('table h1', 'table h2', 'table h3').each do |node|
           table = node
@@ -16,15 +16,15 @@ module Docs
           table.replace(node)
         end
 
-        css('a.anchor').each do |node|
-          node.parent['id'] = node['name']
+        css('a.anchor', 'a.hashref').each do |node|
+          node.parent['id'] = node['name'] || node['id']
         end
 
         css('.highlight').each do |node|
           node.name = 'pre'
           node.css('.gutter').remove
           node['data-language'] = node.at_css('[data-lang]').try(:[], 'data-lang') || 'js'
-          node.content = node.content
+          node.content = node.content.strip
         end
 
         css('table.highlighttable').each do |node|

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

@@ -9,6 +9,7 @@ module Docs
 
       REPLACE_TYPES = {
         'Quick Start' => 'Guides',
+        'User Guide' => 'Guides',
         'The Basics' => 'Getting Started',
         'apis' => 'APIs',
         'components' => 'Components'

+ 4 - 5
lib/docs/scrapers/flow.rb

@@ -1,18 +1,17 @@
 module Docs
   class Flow < React
     self.type = 'react'
-    self.release = '0.22'
-    self.base_url = 'http://flowtype.org/docs/'
-    self.root_path = 'about-flow.html'
+    self.release = '0.33'
+    self.base_url = 'https://flowtype.org/docs/'
+    self.root_path = 'getting-started.html'
     self.links = {
-      home: 'http://flowtype.org/',
+      home: 'https://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;2016 Facebook Inc.<br>