Unified · Split
| @@ -0,0 +1,50 @@ | |||
| 1 | module Docs | ||
| 2 | class Falcon | ||
| 3 | class EntriesFilter < Docs::EntriesFilter | ||
| 4 | def get_name | ||
| 5 | name = at_css('h1').content.strip | ||
| 6 | name.remove! "\u{00B6}" | ||
| 7 | name | ||
| 8 | end | ||
| 9 | |||
| 10 | def get_type | ||
| 11 | case slug.split('/').first | ||
| 12 | when 'community' | ||
| 13 | 'Community Guide' | ||
| 14 | when 'user' | ||
| 15 | 'User Guide' | ||
| 16 | when 'api' | ||
| 17 | 'Classes and Functions' | ||
| 18 | else | ||
| 19 | 'Other' | ||
| 20 | end | ||
| 21 | end | ||
| 22 | |||
| 23 | def additional_entries | ||
| 24 | entries = [] | ||
| 25 | |||
| 26 | css('.class').each do |node| | ||
| 27 | class_name = node.at_css('dt > .descname').content | ||
| 28 | class_id = node.at_css('dt[id]')['id'] | ||
| 29 | entries << [class_name, class_id] | ||
| 30 | |||
| 31 | node.css('.method').each do |n| | ||
| 32 | next unless n.at_css('dt[id]') | ||
| 33 | name = n.at_css('.descname').content | ||
| 34 | name = "#{class_name}.#{name}()" | ||
| 35 | id = n.at_css('dt[id]')['id'] | ||
| 36 | entries << [name, id] | ||
| 37 | end | ||
| 38 | end | ||
| 39 | |||
| 40 | css('.function').each do |node| | ||
| 41 | name = "#{node.at_css('.descname').content}()" | ||
| 42 | id = node.at_css('dt[id]')['id'] | ||
| 43 | entries << [name, id] | ||
| 44 | end | ||
| 45 | |||
| 46 | entries | ||
| 47 | end | ||
| 48 | end | ||
| 49 | end | ||
| 50 | end | ||
| @@ -20,9 +20,10 @@ module Docs · 19 unmodified lines | |||
| 20 | css('div[class*="highlight-"]', 'div[class*="hl-"]').each do |node| | 20 | css('div[class*="highlight-"]', 'div[class*="hl-"]').each do |node| |
| 21 | pre = node.at_css('pre') | 21 | pre = node.at_css('pre') |
| 22 | pre.content = pre.content | 22 | pre.content = pre.content |
| 23 | lang = node['class'][/highlight\-(\w+)/, 1] || node['class'][/hl\-(\w+)/, 1] | 23 | lang = node['class'][/code (\w+) highlight/, 1] || node['class'][/highlight\-(\w+)/, 1] || node['class'][/hl\-(\w+)/, 1] |
| 24 | lang = 'php' if lang == 'ci' | 24 | lang = 'php' if lang == 'ci' |
| 25 | lang = 'markup' if lang == 'html+django' | 25 | lang = 'markup' if lang == 'html+django' |
| 26 | lang = 'bash' if lang == 'bash' | ||
| 26 | lang = 'python' if lang == 'default' || lang.start_with?('python') || lang.start_with?('ipython') | 27 | lang = 'python' if lang == 'default' || lang.start_with?('python') || lang.start_with?('ipython') |
| 27 | pre['data-language'] = lang | 28 | pre['data-language'] = lang |
| 28 | node.replace(pre) | 29 | node.replace(pre) |
| @@ -0,0 +1,27 @@ | |||
| 1 | module Docs | ||
| 2 | class Falcon < UrlScraper | ||
| 3 | self.type = 'sphinx' | ||
| 4 | self.root_path = 'index.html' | ||
| 5 | self.links = { | ||
| 6 | home: 'https://falconframework.org/', | ||
| 7 | code: 'https://github.com/falconry/falcon' | ||
| 8 | } | ||
| 9 | |||
| 10 | html_filters.push 'falcon/entries', 'sphinx/clean_html' | ||
| 11 | |||
| 12 | options[:container] = '.body' | ||
| 13 | |||
| 14 | options[:skip_patterns] = [/\Achanges/, /\A_modules/] | ||
| 15 | |||
| 16 | options[:attribution] = <<-HTML | ||
| 17 | © 2016 Falcon Contributors<br> | ||
| 18 | Licensed under the Apache 2 License. | ||
| 19 | HTML | ||
| 20 | |||
| 21 | version '1.2.0' do | ||
| 22 | self.release = '1.2.0' | ||
| 23 | self.base_url = "https://falcon.readthedocs.io/en/#{self.version}/" | ||
| 24 | end | ||
| 25 | |||
| 26 | end | ||
| 27 | end | ||
| @@ -0,0 +1 @@ | |||
| 1 | https://github.com/falconry/falcon/blob/master/docs/_static/img/logo.jpg | ||