diff --git a/assets/javascripts/views/pages/simple.coffee b/assets/javascripts/views/pages/simple.coffee
index 0c9beb24..bb480508 100644
--- a/assets/javascripts/views/pages/simple.coffee
+++ b/assets/javascripts/views/pages/simple.coffee
@@ -25,6 +25,7 @@ app.views.DrupalPage =
app.views.ElixirPage =
app.views.EmberPage =
app.views.ExpressPage =
+app.views.FlowPage =
app.views.GoPage =
app.views.ImmutablePage =
app.views.InfluxdataPage =
diff --git a/assets/stylesheets/pages/_simple.scss b/assets/stylesheets/pages/_simple.scss
index 05fe3199..4b2ef274 100644
--- a/assets/stylesheets/pages/_simple.scss
+++ b/assets/stylesheets/pages/_simple.scss
@@ -23,6 +23,7 @@
._codeceptjs,
._docker,
._fish,
+._flow,
._gnu,
._grunt,
._haxe,
diff --git a/lib/docs/filters/flow/clean_html.rb b/lib/docs/filters/flow/clean_html.rb
new file mode 100644
index 00000000..df7e6f26
--- /dev/null
+++ b/lib/docs/filters/flow/clean_html.rb
@@ -0,0 +1,69 @@
+module Docs
+ class Flow
+ class CleanHtmlFilter < Filter
+ def call
+ root_page? ? root : other
+ doc
+ end
+
+ def root
+ @doc = at_css('.bg-faded + .container')
+
+ css('.row', '.col-lg-4', '.card-block').each do |node|
+ node.before(node.children).remove
+ end
+
+ css('a.card').each do |node|
+ node.at_css('.text-primary').replace %(
Read more)
+ node.before(node.children).remove
+ end
+ end
+
+ def other
+ @doc = at_css('.article')
+
+ css('.nav-tabs', '#select-platform', '.guide-controls + .list-group', '.guide-controls', 'hr').remove
+
+ css('.guide-content', '.tabs', '.tab-content').each do |node|
+ node.before(node.children).remove
+ end
+
+ css('a[id].toc').each do |node|
+ node.parent['id'] = node['id']
+ node.remove
+ end
+
+ unless at_css('h2')
+ css('h3', 'h4', 'h5').each do |node|
+ node.name = node.name.sub(/\d/) { |i| i.to_i - 1 }
+ end
+ end
+
+ unless at_css('h3')
+ css('h4', 'h5').each do |node|
+ node.name = node.name.sub(/\d/) { |i| i.to_i - 1 }
+ end
+ end
+
+ css('.__cf_email__').each do |node|
+ node.replace(decode_cloudflare_email(node['data-cfemail']))
+ end
+
+ css('.editor').each do |node|
+ pre = node.at_css('.editor-code > pre')
+ pre['data-language'] = 'javascript'
+ pre.content = pre.content
+ node.replace(pre)
+ end
+
+ css('div.highlighter-rouge').each do |node|
+ node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class']
+ node.content = node.content.strip
+ node.name = 'pre'
+ end
+
+ css('.highlighter-rouge').remove_attr('class')
+ end
+ end
+ end
+end
diff --git a/lib/docs/filters/flow/entries.rb b/lib/docs/filters/flow/entries.rb
new file mode 100644
index 00000000..6cbdf0f4
--- /dev/null
+++ b/lib/docs/filters/flow/entries.rb
@@ -0,0 +1,15 @@
+module Docs
+ class Flow
+ class EntriesFilter < Docs::EntriesFilter
+ def get_name
+ at_css('h1').content
+ end
+
+ def get_type
+ type = at_css('.guide-nav .nav-item').content.strip
+ type.remove! %r{ \(.*}
+ type
+ end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/flow.rb b/lib/docs/scrapers/flow.rb
index e815cf02..521b6f79 100644
--- a/lib/docs/scrapers/flow.rb
+++ b/lib/docs/scrapers/flow.rb
@@ -1,17 +1,18 @@
module Docs
- class Flow < React
- self.type = 'react'
- self.release = '0.42.0'
- self.base_url = 'https://flowtype.org/docs/'
- self.root_path = 'getting-started.html'
+ class Flow < UrlScraper
+ self.type = 'flow'
+ self.release = '0.46.0'
+ self.base_url = 'https://flow.org/en/docs/'
self.links = {
home: 'https://flowtype.org/',
code: 'https://github.com/facebook/flow'
}
- options[:container] = '.content'
- options[:root_title] = 'Flow Documentation'
- options[:only_patterns] = nil
+ html_filters.push 'flow/entries', 'flow/clean_html', 'title'
+
+ options[:trailing_slash] = false
+ options[:root_title] = 'Flow'
+ options[:skip] = %w(libs install)
options[:attribution] = <<-HTML
© 2013–present Facebook Inc.