Unified · Split
| @@ -25,6 +25,7 @@ app.views.DrupalPage = · 24 unmodified lines | ||
| 25 | 25 | app.views.ElixirPage = |
| 26 | 26 | app.views.EmberPage = |
| 27 | 27 | app.views.ExpressPage = |
| 28 | +app.views.FlowPage = | |
| 28 | 29 | app.views.GoPage = |
| 29 | 30 | app.views.ImmutablePage = |
| 30 | 31 | app.views.InfluxdataPage = |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | ._codeceptjs, |
| 24 | 24 | ._docker, |
| 25 | 25 | ._fish, |
| 26 | +._flow, | |
| 26 | 27 | ._gnu, |
| 27 | 28 | ._grunt, |
| 28 | 29 | ._haxe, |
| @@ -0,0 +1,69 @@ | ||
| 1 | +module Docs | |
| 2 | + class Flow | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + root_page? ? root : other | |
| 6 | + doc | |
| 7 | + end | |
| 8 | + | |
| 9 | + def root | |
| 10 | + @doc = at_css('.bg-faded + .container') | |
| 11 | + | |
| 12 | + css('.row', '.col-lg-4', '.card-block').each do |node| | |
| 13 | + node.before(node.children).remove | |
| 14 | + end | |
| 15 | + | |
| 16 | + css('a.card').each do |node| | |
| 17 | + node.at_css('.text-primary').replace %(<br><a href="#{node['href']}">Read more</a>) | |
| 18 | + node.before(node.children).remove | |
| 19 | + end | |
| 20 | + end | |
| 21 | + | |
| 22 | + def other | |
| 23 | + @doc = at_css('.article') | |
| 24 | + | |
| 25 | + css('.nav-tabs', '#select-platform', '.guide-controls + .list-group', '.guide-controls', 'hr').remove | |
| 26 | + | |
| 27 | + css('.guide-content', '.tabs', '.tab-content').each do |node| | |
| 28 | + node.before(node.children).remove | |
| 29 | + end | |
| 30 | + | |
| 31 | + css('a[id].toc').each do |node| | |
| 32 | + node.parent['id'] = node['id'] | |
| 33 | + node.remove | |
| 34 | + end | |
| 35 | + | |
| 36 | + unless at_css('h2') | |
| 37 | + css('h3', 'h4', 'h5').each do |node| | |
| 38 | + node.name = node.name.sub(/\d/) { |i| i.to_i - 1 } | |
| 39 | + end | |
| 40 | + end | |
| 41 | + | |
| 42 | + unless at_css('h3') | |
| 43 | + css('h4', 'h5').each do |node| | |
| 44 | + node.name = node.name.sub(/\d/) { |i| i.to_i - 1 } | |
| 45 | + end | |
| 46 | + end | |
| 47 | + | |
| 48 | + css('.__cf_email__').each do |node| | |
| 49 | + node.replace(decode_cloudflare_email(node['data-cfemail'])) | |
| 50 | + end | |
| 51 | + | |
| 52 | + css('.editor').each do |node| | |
| 53 | + pre = node.at_css('.editor-code > pre') | |
| 54 | + pre['data-language'] = 'javascript' | |
| 55 | + pre.content = pre.content | |
| 56 | + node.replace(pre) | |
| 57 | + end | |
| 58 | + | |
| 59 | + css('div.highlighter-rouge').each do |node| | |
| 60 | + node['data-language'] = node['class'][/language-(\w+)/, 1] if node['class'] | |
| 61 | + node.content = node.content.strip | |
| 62 | + node.name = 'pre' | |
| 63 | + end | |
| 64 | + | |
| 65 | + css('.highlighter-rouge').remove_attr('class') | |
| 66 | + end | |
| 67 | + end | |
| 68 | + end | |
| 69 | +end | |
| @@ -0,0 +1,15 @@ | ||
| 1 | +module Docs | |
| 2 | + class Flow | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + def get_name | |
| 5 | + at_css('h1').content | |
| 6 | + end | |
| 7 | + | |
| 8 | + def get_type | |
| 9 | + type = at_css('.guide-nav .nav-item').content.strip | |
| 10 | + type.remove! %r{ \(.*} | |
| 11 | + type | |
| 12 | + end | |
| 13 | + end | |
| 14 | + end | |
| 15 | +end | |
| @@ -1,17 +1,18 @@ | ||
| 1 | 1 | module Docs |
| 2 | − class Flow < React | |
| 3 | − self.type = 'react' | |
| 4 | − self.release = '0.42.0' | |
| 5 | − self.base_url = 'https://flowtype.org/docs/' | |
| 6 | − self.root_path = 'getting-started.html' | |
| 2 | + class Flow < UrlScraper | |
| 3 | + self.type = 'flow' | |
| 4 | + self.release = '0.46.0' | |
| 5 | + self.base_url = 'https://flow.org/en/docs/' | |
| 7 | 6 | self.links = { |
| 8 | 7 | home: 'https://flowtype.org/', |
| 9 | 8 | code: 'https://github.com/facebook/flow' |
| 10 | 9 | } |
| 11 | 10 | |
| 12 | − options[:container] = '.content' | |
| 13 | − options[:root_title] = 'Flow Documentation' | |
| 14 | − options[:only_patterns] = nil | |
| 11 | + html_filters.push 'flow/entries', 'flow/clean_html', 'title' | |
| 12 | + | |
| 13 | + options[:trailing_slash] = false | |
| 14 | + options[:root_title] = 'Flow' | |
| 15 | + options[:skip] = %w(libs install) | |
| 15 | 16 | |
| 16 | 17 | options[:attribution] = <<-HTML |
| 17 | 18 | © 2013–present Facebook Inc.<br> |