Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding influxdb documentation #348

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/docs/filters/influxdb/clean_html.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module Docs
class Influxdb
class CleanHtmlFilter < Filter
def call
doc = @doc.at_css('#page-content')

# Re-position the page header
header = at_css('.page--body h1')
doc.children.first.add_next_sibling header

# Remove the contribution
at_css('.page--contribute').remove

doc
end
end
end
end
19 changes: 19 additions & 0 deletions lib/docs/filters/influxdb/entries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Docs
class Influxdb
class EntriesFilter < Docs::EntriesFilter

def get_name
at_css('#page-title h1').content
end

def get_type
# This is kinda hacky, we are fetching the current type from
# the url, we are asumming that the url pattern is
# category/page or category
path = current_url.relative_path_from(base_url)
"InfluxDB: #{path.split('/').first.titleize}"
end

end
end
end
15 changes: 15 additions & 0 deletions lib/docs/scrapers/influxdb.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Docs
class Influxdb < UrlScraper
self.name = 'InfluxDB'
self.type = 'influxdb'
self.release = '0.10'
self.base_url = 'https://docs.influxdata.com/influxdb/v0.10/'

html_filters.push 'influxdb/entries', 'influxdb/clean_html'

options[:attribution] = <<-HTML
&copy; 2010&ndash;2015 InfluxData<br>
Licensed under the MIT license.
HTML
end
end