Adding elasticsearch documentation support.

pull/220/head
Yosi Attias 10 years ago
parent d0d47e2891
commit 73d92a14c0

@ -67,4 +67,5 @@
'pages/sphinx',
'pages/underscore',
'pages/yard',
'pages/elasticsearch',
'pages/yii';

@ -0,0 +1,11 @@
._elasticsearch {
> h2 { @extend %block-heading; }
> h3 { @extend %block-label, %label-blue; }
> h4 { font-size: 1em; }
.note { @extend %note; }
}

@ -0,0 +1,59 @@
module Docs
class Elasticsearch
class CleanHtmlFilter < Filter
def call
root_page? ? root : other
page
doc
end
def root
# Remove the option block for allowing to change the version
css('#book_title').remove
# Remove annoying hr
css('.titlepage>hr').remove
end
def page
css('.navheader, .navfooter').remove
css('.breadcrumbs').remove
end
def other
css('a.edit_me').remove
@doc = at_css('.titlepage').parent
# Downgrade all headers.
headers = (2..6).map { |n| "h#{n}" }.join(',')
css(headers).each do |header|
level = header.name.last.to_i
header.name = "h#{level-1}"
end
# Move the h1 of the title to be underneath the document
at_css('.titlepage').replace at_css('.titlepage h1.title')
# Remove the note icon
css('.icon').each(&:remove)
# Remove table stylings
css('table').each do |table|
table.delete "cellpadding"
table.delete "border"
table.delete "cellpadding"
end
end
end
end
end

@ -0,0 +1,17 @@
module Docs
class Elasticsearch
class EntriesFilter < Docs::EntriesFilter
def get_name
css('.breadcrumbs span').last.content.strip
end
def get_type
# get the second breadcrumb for our type,
# the first is link to the main page (contents page)
at_css('.breadcrumbs span:nth-child(2)').content.strip
end
end
end
end

@ -0,0 +1,21 @@
module Docs
class Elasticsearch < UrlScraper
self.name = 'ElasticSearch'
self.slug = 'elasticsearch'
self.type = 'elasticsearch'
self.version = '1.6'
self.base_url = "https://www.elastic.co/guide/en/elasticsearch/reference/#{version}/"
self.root_path = 'index.html'
html_filters.push 'elasticsearch/entries', 'elasticsearch/clean_html'
options[:container] = '#guide'
options[:attribution] = <<-HTML
&copy; 2009&ndash;2015 Elasticsearch <br>
Licensed under the Apache License, Version 2.0.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 840 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Loading…
Cancel
Save