Fix CodeIgniter scraper
Unified · Split
| @@ -22,12 +22,12 @@ module Docs · 21 unmodified lines | ||
| 22 | 22 | def additional_entries |
| 23 | 23 | entries = [] |
| 24 | 24 | |
| 25 | − css('.class').each do |node| | |
| 25 | + css('.class', '.interface').each do |node| | |
| 26 | 26 | class_name = node.at_css('dt > .descname').content.split('\\').last |
| 27 | 27 | class_id = node.at_css('dt[id]')['id'] |
| 28 | 28 | entries << [class_name, class_id] |
| 29 | 29 | |
| 30 | − node.css('.method').each do |n| | |
| 30 | + node.css('.method', '.staticmethod').each do |n| | |
| 31 | 31 | next unless n.at_css('dt[id]') |
| 32 | 32 | name = n.at_css('.descname').content |
| 33 | 33 | name = "#{class_name}::#{name}()" |
| @@ -43,6 +43,13 @@ module Docs · 9 unmodified lines | ||
| 43 | 43 | entries << [name, id, type] |
| 44 | 44 | end |
| 45 | 45 | |
| 46 | + css('.const').each do |node| | |
| 47 | + name = node.at_css('.descname').content | |
| 48 | + id = node.at_css('dt[id]')['id'] | |
| 49 | + type = self.type.start_with?('User guide') ? 'Global Constants' : self.type | |
| 50 | + entries << [name, id, type] | |
| 51 | + end | |
| 52 | + | |
| 46 | 53 | entries |
| 47 | 54 | end |
| 48 | 55 | end |
| @@ -20,8 +20,8 @@ module Docs · 19 unmodified lines | ||
| 20 | 20 | css('div[class*="highlight-"]', 'div[class*="hl-"]').each do |node| |
| 21 | 21 | pre = node.at_css('pre') |
| 22 | 22 | pre.content = pre.content |
| 23 | − lang = node['class'][/code (\w+) highlight/, 1] || node['class'][/highlight\-(\w+)/, 1] || node['class'][/hl\-(\w+)/, 1] | |
| 24 | − lang = 'php' if lang == 'ci' | |
| 23 | + lang = node['class'][/code (\w+) highlight/, 1] || node['class'][/highlight\-([\w\+]+)/, 1] || node['class'][/hl\-(\w+)/, 1] | |
| 24 | + lang = 'php' if lang == 'ci'|| lang == 'html+php' | |
| 25 | 25 | lang = 'markup' if lang == 'html+django' |
| 26 | 26 | lang = 'bash' if lang == 'bash' |
| 27 | 27 | lang = 'python' if lang == 'default' || lang.start_with?('python') || lang.start_with?('ipython') |
| @@ -10,8 +10,6 @@ module Docs · 9 unmodified lines | ||
| 10 | 10 | |
| 11 | 11 | html_filters.push 'codeigniter/entries', 'sphinx/clean_html' |
| 12 | 12 | |
| 13 | − options[:container] = '.document' | |
| 14 | − | |
| 15 | 13 | options[:skip] = %w( |
| 16 | 14 | license.html |
| 17 | 15 | changelog.html |
| @@ -26,6 +24,7 @@ module Docs · 8 unmodified lines | ||
| 26 | 24 | options[:skip_patterns] = [ |
| 27 | 25 | /\Acontributing/, |
| 28 | 26 | /\Adocumentation/, |
| 27 | + /\Achangelogs/, | |
| 29 | 28 | /\Ainstallation\/upgrade/ |
| 30 | 29 | ] |
| 31 | 30 | |
| @@ -37,11 +36,15 @@ module Docs · 5 unmodified lines | ||
| 37 | 36 | version '4' do |
| 38 | 37 | self.release = '4.0.4' |
| 39 | 38 | self.base_url = 'https://codeigniter.com/userguide4/' |
| 39 | + | |
| 40 | + options[:container] = '.document > div' | |
| 40 | 41 | end |
| 41 | 42 | |
| 42 | 43 | version '3' do |
| 43 | 44 | self.release = '3.1.8' |
| 44 | 45 | self.base_url = 'https://codeigniter.com/userguide3/' |
| 46 | + | |
| 47 | + options[:container] = '.document' | |
| 45 | 48 | end |
| 46 | 49 | |
| 47 | 50 | def get_latest_version(opts) |