Browse Source

Update InfluxData documentation (0.13)

Thibaut Courouble 9 years ago
parent
commit
1f3ee96056

+ 1 - 0
assets/javascripts/views/pages/simple.coffee

@@ -15,6 +15,7 @@ app.views.ElixirPage =
 app.views.EmberPage =
 app.views.ExpressPage =
 app.views.GoPage =
+app.views.InfluxdataPage =
 app.views.KotlinPage =
 app.views.LaravelPage =
 app.views.LodashPage =

+ 8 - 4
lib/docs/filters/influxdata/clean_html.rb

@@ -7,16 +7,20 @@ module Docs
           return doc
         end
 
-        doc = @doc.at_css('#page-content')
+        doc = @doc.at_css('article')
 
-        css('.page--contribute', 'hr').remove
+        css('.article-footer', 'hr').remove
 
-        css('.page--body', '.page--title', 'font').each do |node|
+        css('a.offset-anchor').each do |node|
+          node.parent['id'] = node['id']
+        end
+
+        css('.article-content', '.article-section', 'font').each do |node|
           node.before(node.children).remove
         end
 
         css('pre > code').each do |node|
-          node.parent['class'] = node['class']
+          node.parent['data-language'] = node['class'][/language-(\w+)/, 1] if node['class']
           node.before(node.children).remove
         end
 

+ 5 - 4
lib/docs/filters/influxdata/entries.rb

@@ -2,15 +2,16 @@ module Docs
   class Influxdata
     class EntriesFilter < Docs::EntriesFilter
       def get_name
-        at_css('#page-title h1').content
+        at_css('.article-heading h1').content
       end
 
       def get_type
-        product = at_css('.product-switcher--current').content.strip
+        product = at_css('.navbar--current-product').content.split(' ').first.capitalize.sub('db', 'DB')
         return product if %w(Chronograf Telegraf).include?(product)
 
-        node = at_css('#product-sidebar a[href="index"]')
-        node = node.parent.previous_element unless node.parent['class'] == 'product-sidebar--section-title'
+        node = at_css('a.sidebar--page[href="index"]')
+        node ||= at_css('.sidebar--section-title a[href="index"]').parent
+        node = node.previous_element until node['class'] == 'sidebar--section-title'
 
         type = node.content.strip
         type.remove! ' Reference'

+ 1 - 5
lib/docs/scrapers/influxdata.rb

@@ -2,7 +2,7 @@ module Docs
   class Influxdata < UrlScraper
     self.name = 'InfluxData'
     self.type = 'influxdata'
-    self.release = '0.10'
+    self.release = '0.13'
     self.base_url = 'https://docs.influxdata.com/'
 
     html_filters.push 'influxdata/entries', 'influxdata/clean_html', 'title'
@@ -20,10 +20,6 @@ module Docs
       "influxdb/v#{release}/about/"
     ]
 
-    options[:replace_paths] = {
-      "influxdb/v#{release}/guides/clustering/" => 'influxdb/v0.10/clustering/'
-    }
-
     options[:attribution] = <<-HTML
       &copy; 2015 InfluxData, Inc.<br>
       Licensed under the MIT license.