Add Bottle Documentation

This commit is contained in:
Phil Scherer 2016-08-16 18:19:16 -04:00 committed by Thibaut Courouble
parent bdc15b1cdf
commit 45e68b0eab
3 changed files with 97 additions and 1 deletions

View file

@ -19,7 +19,7 @@
ul.simple { margin: 1em 0; }
h2 > a, h3 > a, dt[id] > a.external { float: right; }
h2 > a, h3 > a, dt[id] > a.external, dt[id] > a.internal { float: right; }
.admonition-title {
float: left;

View file

@ -0,0 +1,59 @@
module Docs
class Bottle
class EntriesFilter < Docs::EntriesFilter
TYPES = {
'routing' => 'Request Routing',
'stpl' => 'SimpleTemplate Engine',
'api' => 'API Reference',
'tutorial_app' => 'Tutorial',
'async' => 'Primer to Asynchronous Applications',
'faq' => 'Frequently Asked Questions'
}
def get_name
name = at_css('h1').content.strip
name.remove! "\u{00B6}"
name
end
def get_type
type = slug.split('/').first
if TYPES.key?(type)
type = TYPES[type]
else
type = type.capitalize
end
type
end
def additional_entries
entries = []
css('.class').each do |node|
class_name = node.at_css('dt > .descname').content
class_id = node.at_css('dt[id]')['id']
entries << [class_name, class_id]
node.css('.method').each do |n|
next unless n.at_css('dt[id]')
name = n.at_css('.descname').content
name = "#{class_name}::#{name}()"
id = n.at_css('dt[id]')['id']
entries << [name, id]
end
end
css('.function').each do |node|
name = "#{node.at_css('.descname').content}()"
id = node.at_css('dt[id]')['id']
entries << [name, id]
end
entries
end
end
end
end

View file

@ -0,0 +1,37 @@
module Docs
class Bottle < FileScraper
self.type = 'sphinx'
self.dir = ""
self.root_path = "index.html"
self.links = {
home: 'https://bottle.org/',
code: 'https://github.com/bottlepy/bottle'
}
html_filters.push 'bottle/entries', 'sphinx/clean_html'
options[:container] = '.body'
options[:skip] = %w(
changelog.html
development.html
plugindev.html
_modules/bottle.html
)
options[:attribution] = <<-HTML
&copy; 2009&ndash;2016, Marcel Hellkamp<br>
Licensed under the MIT License.<br>
HTML
version '0.12' do # http://bottlepy.org/docs/0.12/bottle-docs.zip
self.release = '0.12'
self.base_url = "http://bottlepy.org/docs/#{self.version}/"
end
version '0.11' do # http://bottlepy.org/docs/0.11/bottle-docs.zip
self.release = '0.11'
self.base_url = "http://bottlepy.org/docs/#{self.version}/"
end
end
end