Unified · Split
| @@ -54,6 +54,7 @@ · 53 unmodified lines | |||
| 54 | 'pages/nginx', | 54 | 'pages/nginx', |
| 55 | 'pages/node', | 55 | 'pages/node', |
| 56 | 'pages/npm', | 56 | 'pages/npm', |
| 57 | 'pages/opentsdb', | ||
| 57 | 'pages/phaser', | 58 | 'pages/phaser', |
| 58 | 'pages/php', | 59 | 'pages/php', |
| 59 | 'pages/phpunit', | 60 | 'pages/phpunit', |
| @@ -68,6 +69,5 @@ · 8 unmodified lines | |||
| 68 | 'pages/socketio', | 69 | 'pages/socketio', |
| 69 | 'pages/sphinx', | 70 | 'pages/sphinx', |
| 70 | 'pages/underscore', | 71 | 'pages/underscore', |
| 71 | 'pages/vue', | ||
| 72 | 'pages/yard', | 72 | 'pages/yard', |
| 73 | 'pages/yii'; | 73 | 'pages/yii'; |
| @@ -54,6 +54,7 @@ · 53 unmodified lines | |||
| 54 | 'pages/nginx', | 54 | 'pages/nginx', |
| 55 | 'pages/node', | 55 | 'pages/node', |
| 56 | 'pages/npm', | 56 | 'pages/npm', |
| 57 | 'pages/opentsdb', | ||
| 57 | 'pages/phaser', | 58 | 'pages/phaser', |
| 58 | 'pages/php', | 59 | 'pages/php', |
| 59 | 'pages/phpunit', | 60 | 'pages/phpunit', |
| @@ -68,6 +69,5 @@ · 8 unmodified lines | |||
| 68 | 'pages/socketio', | 69 | 'pages/socketio', |
| 69 | 'pages/sphinx', | 70 | 'pages/sphinx', |
| 70 | 'pages/underscore', | 71 | 'pages/underscore', |
| 71 | 'pages/vue', | ||
| 72 | 'pages/yard', | 72 | 'pages/yard', |
| 73 | 'pages/yii'; | 73 | 'pages/yii'; |
| @@ -0,0 +1,7 @@ | |||
| 1 | ._opentsdb .section { | ||
| 2 | > h2 { @extend %block-heading; } | ||
| 3 | > h3 { @extend %block-label, %label-blue; } | ||
| 4 | > h4 { font-size: 1em; } | ||
| 5 | |||
| 6 | } | ||
| 7 | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | module Docs | ||
| 2 | class Opentsdb | ||
| 3 | class CleanHtmlFilter < Filter | ||
| 4 | def call | ||
| 5 | # Reset the page scope to the body, | ||
| 6 | # we needed the rest of the page for the entries filter. | ||
| 7 | @doc = at_css(".documentwrapper > .bodywrapper > .body > .section") | ||
| 8 | |||
| 9 | # Remove table borders | ||
| 10 | css('table').each { |table| table.delete 'border' } | ||
| 11 | |||
| 12 | doc | ||
| 13 | end | ||
| 14 | end | ||
| 15 | end | ||
| 16 | end | ||
| @@ -0,0 +1,35 @@ | |||
| 1 | module Docs | ||
| 2 | class Opentsdb | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | |||
| 5 | def get_name | ||
| 6 | header = css(".section > h1").first | ||
| 7 | return header.content.strip unless header.nil? | ||
| 8 | end | ||
| 9 | |||
| 10 | def get_type | ||
| 11 | return nil if breadcrumbs.length < 2 | ||
| 12 | |||
| 13 | # This is time for a little bit of cheating | ||
| 14 | return breadcrumbs[1] if breadcrumbs.include? "HTTP API" | ||
| 15 | |||
| 16 | breadcrumbs.last | ||
| 17 | end | ||
| 18 | |||
| 19 | def additional_entries | ||
| 20 | [] | ||
| 21 | end | ||
| 22 | |||
| 23 | |||
| 24 | def breadcrumbs | ||
| 25 | nav_links = css(".related").first.css("li") | ||
| 26 | breadcrumbs = nav_links.reject do |node| | ||
| 27 | node['class'] == "right" | ||
| 28 | end | ||
| 29 | |||
| 30 | breadcrumbs.map { |node| node.at_css("a").content } | ||
| 31 | .reject { |link| link.empty? } | ||
| 32 | end | ||
| 33 | end | ||
| 34 | end | ||
| 35 | end | ||
| @@ -0,0 +1,19 @@ | |||
| 1 | module Docs | ||
| 2 | class Opentsdb < UrlScraper | ||
| 3 | self.name = 'OpenTSDB' | ||
| 4 | self.type = 'opentsdb' | ||
| 5 | self.version = '2.1' | ||
| 6 | self.base_url = 'http://opentsdb.net/docs/build/html/' | ||
| 7 | self.root_path = 'index.html' | ||
| 8 | |||
| 9 | html_filters.push 'opentsdb/entries', 'opentsdb/clean_html' | ||
| 10 | |||
| 11 | |||
| 12 | options[:skip] = %w(genindex.html search.html) | ||
| 13 | |||
| 14 | |||
| 15 | options[:attribution] = <<-HTML | ||
| 16 | © 2015 OpenTSDB | ||
| 17 | HTML | ||
| 18 | end | ||
| 19 | end | ||
Binary file not shown.
Binary file not shown.