Merge pull request #1440 from scherepn/codeigniter-fix

Fix CodeIgniter scraper
pull/1445/head
Simon Legner 4 years ago committed by GitHub
commit de33aef552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -22,12 +22,12 @@ module Docs
def additional_entries
entries = []
css('.class').each do |node|
css('.class', '.interface').each do |node|
class_name = node.at_css('dt > .descname').content.split('\\').last
class_id = node.at_css('dt[id]')['id']
entries << [class_name, class_id]
node.css('.method').each do |n|
node.css('.method', '.staticmethod').each do |n|
next unless n.at_css('dt[id]')
name = n.at_css('.descname').content
name = "#{class_name}::#{name}()"
@ -43,6 +43,13 @@ module Docs
entries << [name, id, type]
end
css('.const').each do |node|
name = node.at_css('.descname').content
id = node.at_css('dt[id]')['id']
type = self.type.start_with?('User guide') ? 'Global Constants' : self.type
entries << [name, id, type]
end
entries
end
end

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

@ -10,8 +10,6 @@ module Docs
html_filters.push 'codeigniter/entries', 'sphinx/clean_html'
options[:container] = '.document'
options[:skip] = %w(
license.html
changelog.html
@ -26,6 +24,7 @@ module Docs
options[:skip_patterns] = [
/\Acontributing/,
/\Adocumentation/,
/\Achangelogs/,
/\Ainstallation\/upgrade/
]
@ -37,11 +36,15 @@ module Docs
version '4' do
self.release = '4.0.4'
self.base_url = 'https://codeigniter.com/userguide4/'
options[:container] = '.document > div'
end
version '3' do
self.release = '3.1.8'
self.base_url = 'https://codeigniter.com/userguide3/'
options[:container] = '.document'
end
def get_latest_version(opts)

Loading…
Cancel
Save