mirror of https://github.com/freeCodeCamp/devdocs
parent
b9a038d665
commit
f6df847e86
@ -0,0 +1,7 @@
|
||||
._opentsdb .section {
|
||||
> h2 { @extend %block-heading; }
|
||||
> h3 { @extend %block-label, %label-blue; }
|
||||
> h4 { font-size: 1em; }
|
||||
|
||||
}
|
||||
|
@ -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
|
@ -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
|
@ -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
|
After Width: | Height: | Size: 923 B |
After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in new issue