mirror of https://github.com/freeCodeCamp/devdocs
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
|
@ -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
|
||||
© 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…
Reference in new issue