Add Falcon documentation

pull/574/merge
Phil Scherer 8 years ago committed by Thibaut Courouble
parent fbf0c58719
commit f424256f6c

@ -0,0 +1,50 @@
module Docs
class Falcon
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('h1').content.strip
name.remove! "\u{00B6}"
name
end
def get_type
case slug.split('/').first
when 'community'
'Community Guide'
when 'user'
'User Guide'
when 'api'
'Classes and Functions'
else
'Other'
end
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

@ -20,9 +20,10 @@ module Docs
css('div[class*="highlight-"]', 'div[class*="hl-"]').each do |node|
pre = node.at_css('pre')
pre.content = pre.content
lang = node['class'][/highlight\-(\w+)/, 1] || node['class'][/hl\-(\w+)/, 1]
lang = node['class'][/code (\w+) highlight/, 1] || node['class'][/highlight\-(\w+)/, 1] || node['class'][/hl\-(\w+)/, 1]
lang = 'php' if lang == 'ci'
lang = 'markup' if lang == 'html+django'
lang = 'bash' if lang == 'bash'
lang = 'python' if lang == 'default' || lang.start_with?('python') || lang.start_with?('ipython')
pre['data-language'] = lang
node.replace(pre)

@ -0,0 +1,27 @@
module Docs
class Falcon < UrlScraper
self.type = 'sphinx'
self.root_path = 'index.html'
self.links = {
home: 'https://falconframework.org/',
code: 'https://github.com/falconry/falcon'
}
html_filters.push 'falcon/entries', 'sphinx/clean_html'
options[:container] = '.body'
options[:skip_patterns] = [/\Achanges/, /\A_modules/]
options[:attribution] = <<-HTML
&copy; 2016 Falcon Contributors<br>
Licensed under the Apache 2 License.
HTML
version '1.2.0' do
self.release = '1.2.0'
self.base_url = "https://falcon.readthedocs.io/en/#{self.version}/"
end
end
end

@ -0,0 +1 @@
https://github.com/falconry/falcon/blob/master/docs/_static/img/logo.jpg
Loading…
Cancel
Save