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