History

Adding influxdb documentation

Yosi Attias committed 10 years ago

Commit cd8590f1 parent 734c1ac3 files · +52 −0Browse files

Unified · Split

3 files
  1. lib/docs/filters/influxdb/clean_html.rb +18 −0
  2. lib/docs/filters/influxdb/entries.rb +19 −0
  3. lib/docs/scrapers/influxdb.rb +15 −0
lib/docs/filters/influxdb/clean_html.rb+18−0
@@ -0,0 +1,18 @@
1+module Docs
2+ class Influxdb
3+ class CleanHtmlFilter < Filter
4+ def call
5+ doc = @doc.at_css('#page-content')
6+
7+ # Re-position the page header
8+ header = at_css('.page--body h1')
9+ doc.children.first.add_next_sibling header
10+
11+ # Remove the contribution
12+ at_css('.page--contribute').remove
13+
14+ doc
15+ end
16+ end
17+ end
18+end
lib/docs/filters/influxdb/entries.rb+19−0
@@ -0,0 +1,19 @@
1+module Docs
2+ class Influxdb
3+ class EntriesFilter < Docs::EntriesFilter
4+
5+ def get_name
6+ at_css('#page-title h1').content
7+ end
8+
9+ def get_type
10+ # This is kinda hacky, we are fetching the current type from
11+ # the url, we are asumming that the url pattern is
12+ # category/page or category
13+ path = current_url.relative_path_from(base_url)
14+ "InfluxDB: #{path.split('/').first.titleize}"
15+ end
16+
17+ end
18+ end
19+end
lib/docs/scrapers/influxdb.rb+15−0
@@ -0,0 +1,15 @@
1+module Docs
2+ class Influxdb < UrlScraper
3+ self.name = 'InfluxDB'
4+ self.type = 'influxdb'
5+ self.release = '0.10'
6+ self.base_url = 'https://docs.influxdata.com/influxdb/v0.10/'
7+
8+ html_filters.push 'influxdb/entries', 'influxdb/clean_html'
9+
10+ options[:attribution] = <<-HTML
11+ &copy; 2010&ndash;2015 InfluxData<br>
12+ Licensed under the MIT license.
13+ HTML
14+ end
15+end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t