From 1f3ee96056112e712d6805ec8a91fe7c49681eed Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sat, 23 Jul 2016 18:09:41 -0400 Subject: [PATCH] Update InfluxData documentation (0.13) --- assets/javascripts/views/pages/simple.coffee | 1 + lib/docs/filters/influxdata/clean_html.rb | 12 ++++++++---- lib/docs/filters/influxdata/entries.rb | 9 +++++---- lib/docs/scrapers/influxdata.rb | 6 +----- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/assets/javascripts/views/pages/simple.coffee b/assets/javascripts/views/pages/simple.coffee index c9ea3fde..1d23da5a 100644 --- a/assets/javascripts/views/pages/simple.coffee +++ b/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 = diff --git a/lib/docs/filters/influxdata/clean_html.rb b/lib/docs/filters/influxdata/clean_html.rb index e86d5782..2ec12f0f 100644 --- a/lib/docs/filters/influxdata/clean_html.rb +++ b/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 diff --git a/lib/docs/filters/influxdata/entries.rb b/lib/docs/filters/influxdata/entries.rb index 9ddea11e..a230f83b 100644 --- a/lib/docs/filters/influxdata/entries.rb +++ b/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' diff --git a/lib/docs/scrapers/influxdata.rb b/lib/docs/scrapers/influxdata.rb index 45d1678f..b6cc9eda 100644 --- a/lib/docs/scrapers/influxdata.rb +++ b/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 © 2015 InfluxData, Inc.
Licensed under the MIT license.