diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index b2942d3a..dd9de3d5 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -54,6 +54,7 @@ 'pages/nginx', 'pages/node', 'pages/npm', + 'pages/opentsdb', 'pages/phaser', 'pages/php', 'pages/phpunit', @@ -68,6 +69,5 @@ 'pages/socketio', 'pages/sphinx', 'pages/underscore', - 'pages/vue', 'pages/yard', 'pages/yii'; diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 18ffdc81..1045542e 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -54,6 +54,7 @@ 'pages/nginx', 'pages/node', 'pages/npm', + 'pages/opentsdb', 'pages/phaser', 'pages/php', 'pages/phpunit', @@ -68,6 +69,5 @@ 'pages/socketio', 'pages/sphinx', 'pages/underscore', - 'pages/vue', 'pages/yard', 'pages/yii'; diff --git a/assets/stylesheets/pages/_opentsdb.scss b/assets/stylesheets/pages/_opentsdb.scss new file mode 100644 index 00000000..7abe9351 --- /dev/null +++ b/assets/stylesheets/pages/_opentsdb.scss @@ -0,0 +1,7 @@ +._opentsdb .section { + > h2 { @extend %block-heading; } + > h3 { @extend %block-label, %label-blue; } + > h4 { font-size: 1em; } + +} + diff --git a/lib/docs/filters/opentsdb/clean_html.rb b/lib/docs/filters/opentsdb/clean_html.rb new file mode 100644 index 00000000..dd3c351d --- /dev/null +++ b/lib/docs/filters/opentsdb/clean_html.rb @@ -0,0 +1,16 @@ +module Docs + class Opentsdb + class CleanHtmlFilter < Filter + def call + # Reset the page scope to the body, + # we needed the rest of the page for the entries filter. + @doc = at_css(".documentwrapper > .bodywrapper > .body > .section") + + # Remove table borders + css('table').each { |table| table.delete 'border' } + + doc + end + end + end +end diff --git a/lib/docs/filters/opentsdb/entries.rb b/lib/docs/filters/opentsdb/entries.rb new file mode 100644 index 00000000..adb5a3c5 --- /dev/null +++ b/lib/docs/filters/opentsdb/entries.rb @@ -0,0 +1,35 @@ +module Docs + class Opentsdb + class EntriesFilter < Docs::EntriesFilter + + def get_name + header = css(".section > h1").first + return header.content.strip unless header.nil? + end + + def get_type + return nil if breadcrumbs.length < 2 + + # This is time for a little bit of cheating + return breadcrumbs[1] if breadcrumbs.include? "HTTP API" + + breadcrumbs.last + end + + def additional_entries + [] + end + + + def breadcrumbs + nav_links = css(".related").first.css("li") + breadcrumbs = nav_links.reject do |node| + node['class'] == "right" + end + + breadcrumbs.map { |node| node.at_css("a").content } + .reject { |link| link.empty? } + end + end + end +end diff --git a/lib/docs/scrapers/opentsdb.rb b/lib/docs/scrapers/opentsdb.rb new file mode 100644 index 00000000..0c27cf35 --- /dev/null +++ b/lib/docs/scrapers/opentsdb.rb @@ -0,0 +1,19 @@ +module Docs + class Opentsdb < UrlScraper + self.name = 'OpenTSDB' + self.type = 'opentsdb' + self.version = '2.1' + self.base_url = 'http://opentsdb.net/docs/build/html/' + self.root_path = 'index.html' + + html_filters.push 'opentsdb/entries', 'opentsdb/clean_html' + + + options[:skip] = %w(genindex.html search.html) + + + options[:attribution] = <<-HTML + © 2015 OpenTSDB + HTML + end +end diff --git a/public/icons/docs/opentsdb/16.png b/public/icons/docs/opentsdb/16.png new file mode 100644 index 00000000..4a7066cc Binary files /dev/null and b/public/icons/docs/opentsdb/16.png differ diff --git a/public/icons/docs/opentsdb/16@2x.png b/public/icons/docs/opentsdb/16@2x.png new file mode 100644 index 00000000..25ecb052 Binary files /dev/null and b/public/icons/docs/opentsdb/16@2x.png differ