Finish OpenTSDB scraper

pull/241/head
Thibaut 10 years ago
parent f6df847e86
commit 955ef5de95

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 81 KiB

@ -1,5 +1,8 @@
[ [
[ [
"2015-08-02",
"New documentation: <a href=\"/opentsdb/\">OpenTSDB</a>"
], [
"2015-07-26", "2015-07-26",
"Added search abbreviations (e.g. <code class=\"_label\">$</code> is an alias for <code class=\"_label\">jQuery</code>).\n<a href=\"/help#abbreviations\">Click here</a> to see the full list. Feel free to suggest more on <a href=\"https://github.com/Thibaut/devdocs/issues/new\" target=\"_blank\">GitHub</a>.", "Added search abbreviations (e.g. <code class=\"_label\">$</code> is an alias for <code class=\"_label\">jQuery</code>).\n<a href=\"/help#abbreviations\">Click here</a> to see the full list. Feel free to suggest more on <a href=\"https://github.com/Thibaut/devdocs/issues/new\" target=\"_blank\">GitHub</a>.",
"Added <code class=\"_label\">shift + &darr;/&uarr;</code> shortcut for scrolling (same as <code class=\"_label\">alt + &darr;/&uarr;</code>)." "Added <code class=\"_label\">shift + &darr;/&uarr;</code> shortcut for scrolling (same as <code class=\"_label\">alt + &darr;/&uarr;</code>)."

@ -274,6 +274,11 @@ credits = [
'npm, Inc. and Contributors<br>npm is a trademark of npm, Inc.', 'npm, Inc. and Contributors<br>npm is a trademark of npm, Inc.',
'npm', 'npm',
'https://raw.githubusercontent.com/npm/npm/master/LICENSE' 'https://raw.githubusercontent.com/npm/npm/master/LICENSE'
], [
'OpenTSDB',
'2010-2015 The OpenTSDB Authors',
'LGPLv2.1',
'https://raw.githubusercontent.com/OpenTSDB/opentsdb.net/gh-pages/COPYING.LESSER'
], [ ], [
'Phaser', 'Phaser',
'2015 Richard Davey, Photon Storm Ltd.', '2015 Richard Davey, Photon Storm Ltd.',

@ -105,3 +105,4 @@
._icon-webpack:before { background-position: -1rem -8rem; @extend %darkIconFix !optional; } ._icon-webpack:before { background-position: -1rem -8rem; @extend %darkIconFix !optional; }
._icon-phaser:before { background-position: -2rem -8rem; } ._icon-phaser:before { background-position: -2rem -8rem; }
._icon-vue:before { background-position: -3rem -8rem; } ._icon-vue:before { background-position: -3rem -8rem; }
._icon-opentsdb:before { background-position: -4rem -8rem; }

@ -1,7 +1,10 @@
._opentsdb .section { ._opentsdb {
> h2 { @extend %block-heading; } @extend %simple;
> h3 { @extend %block-label, %label-blue; }
> h4 { font-size: 1em; }
.admonition { @extend %note; }
.admonition.warning { @extend %note-orange; }
.admonition-title {
margin: 0 0 .25rem;
font-weight: bold;
}
} }

@ -2,12 +2,23 @@ module Docs
class Opentsdb class Opentsdb
class CleanHtmlFilter < Filter class CleanHtmlFilter < Filter
def call def call
# Reset the page scope to the body, @doc = at_css('.documentwrapper > .bodywrapper > .body > .section')
# we needed the rest of the page for the entries filter.
@doc = at_css(".documentwrapper > .bodywrapper > .body > .section")
# Remove table borders css('> .section').each do |node|
css('table').each { |table| table.delete 'border' } node.before(node.children).remove
end
css('tt.literal').each do |node|
node.name = 'code'
node.content = node.content
end
css('div[class*=highlight] .highlight pre').each do |node|
node.parent.parent.before(node)
node.content = node.content.gsub(' ', ' ')
end
css('table').remove_attr('border')
doc doc
end end

@ -1,34 +1,24 @@
module Docs module Docs
class Opentsdb class Opentsdb
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
header = css(".section > h1").first at_css('.section > h1').content
return header.content.strip unless header.nil?
end end
def get_type def get_type
return nil if breadcrumbs.length < 2 if subpath.start_with?('api_http')
'HTTP API'
# This is time for a little bit of cheating elsif slug.end_with?('/index')
return breadcrumbs[1] if breadcrumbs.include? "HTTP API" [breadcrumbs[1], name].compact.join(': ')
elsif breadcrumbs.length < 2
breadcrumbs.last 'Miscellaneous'
end else
breadcrumbs[1..2].join(': ')
def additional_entries end
[]
end end
def breadcrumbs def breadcrumbs
nav_links = css(".related").first.css("li") @breakcrumbs ||= at_css('.related').css('li:not(.right) a').map(&:content).reject(&:blank?)
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
end end

@ -2,18 +2,21 @@ module Docs
class Opentsdb < UrlScraper class Opentsdb < UrlScraper
self.name = 'OpenTSDB' self.name = 'OpenTSDB'
self.type = 'opentsdb' self.type = 'opentsdb'
self.version = '2.1' self.version = '2.1.0'
self.base_url = 'http://opentsdb.net/docs/build/html/' self.base_url = 'http://opentsdb.net/docs/build/html/'
self.root_path = 'index.html' self.root_path = 'index.html'
self.links = {
home: 'http://opentsdb.net/',
code: 'https://github.com/OpenTSDB/opentsdb'
}
html_filters.push 'opentsdb/entries', 'opentsdb/clean_html' html_filters.push 'opentsdb/entries', 'opentsdb/clean_html'
options[:skip] = %w(genindex.html search.html) options[:skip] = %w(genindex.html search.html)
options[:attribution] = <<-HTML options[:attribution] = <<-HTML
&copy; 2015 OpenTSDB &copy; 2010&ndash;2015 The OpenTSDB Authors<br>
Licensed under the GNU LGPLv2.1+ and GPLv3+ licenses.
HTML HTML
end end
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 923 B

After

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Loading…
Cancel
Save