Finish CodeIgniter scraper

pull/359/merge
Thibaut Courouble 9 years ago
parent 8232a0538a
commit 0efa4c349e

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

@ -1,5 +1,8 @@
[
[
"2016-02-28",
"New documentation: <a href=\"/codeigniter/\">CodeIgniter</a>"
], [
"2016-02-15",
"New documentations: <a href=\"/cakephp/\">CakePHP</a>, <a href=\"/chef/\">Chef</a> and <a href=\"/ramda/\">Ramda</a>"
], [

@ -119,6 +119,11 @@ credits = [
'Rich Hickey',
'EPL',
'https://github.com/clojure/clojure/blob/master/epl-v10.html'
], [
'CodeIgniter',
'2014-2016 British Columbia Institute of Technology',
'MIT',
'https://raw.githubusercontent.com/bcit-ci/CodeIgniter/develop/license.txt'
], [
'CoffeeScript',
'2009-2015 Jeremy Ashkenas',

@ -1,6 +0,0 @@
#= require views/pages/base
class app.views.CodeigniterPage extends app.views.BasePage
prepare: ->
@highlightCode @findAllByTag('pre'), 'php'
return

@ -4,4 +4,5 @@ class app.views.SphinxPage extends app.views.BasePage
prepare: ->
@highlightCode @findAll('pre.python'), 'python'
@highlightCode @findAll('pre.markup'), 'markup'
@highlightCode @findAll('pre.php'), 'php'
return

@ -36,7 +36,6 @@
'pages/cakephp',
'pages/chai',
'pages/clojure',
'pages/codeigniter',
'pages/coffeescript',
'pages/d3',
'pages/dojo',

@ -36,7 +36,6 @@
'pages/cakephp',
'pages/chai',
'pages/clojure',
'pages/codeigniter',
'pages/coffeescript',
'pages/d3',
'pages/dojo',

@ -126,3 +126,4 @@
._icon-erlang:before { background-position: -1rem -10rem; }
._icon-chef:before { background-position: -2rem -10rem; }
._icon-ramda:before { background-position: -3rem -10rem; @extend %darkIconFix !optional; }
._icon-codeigniter:before { background-position: -4rem -10rem; @extend %darkIconFix !optional; }

@ -1,6 +0,0 @@
._codeigniter {
@extend %sphinx;
.important { @extend %note-orange; }
.warning { @extend %note-red; }
}

@ -4,7 +4,8 @@
dt + dt { margin-top: -.5em; }
.note, .admonition, .versionadded, .versionchanged, .deprecated-removed { @extend %note; }
.deprecated-removed { @extend %note-red; }
.important { @extend %note-orange; }
.warning, .deprecated-removed { @extend %note-red; }
.versionmodified { font-weight: bold; }
p > code, li > code { @extend %label; }
@ -26,5 +27,5 @@
}
._sphinx {
@extend %sphinx
@extend %sphinx;
}

@ -8,16 +8,22 @@ module Docs
node.content = node.content
end
css('div[class^="highlight-"]').each do |node|
node.content = node.content.strip
node.name = 'pre'
node['class'] = 'php' if node['class'].include?('highlight-ci')
end
css('table').each do |node|
node.remove_attribute 'border'
end
css('.section > h2', '.section > h3', '.section > h4', '.section > h5').each do |node|
node['id'] = node.parent['id']
node.parent.remove_attribute 'id'
css('.section').each do |node|
node.first_element_child['id'] = node['id'] if node['id']
node.before(node.children).remove
end
doc.children
doc
end
end
end

@ -1,38 +1,43 @@
module Docs
class Codeigniter
class EntriesFilter < Docs::EntriesFilter
def include_default_entry?
not slug.ends_with? 'index'
end
def get_name
at_css('h1').content.strip
end
def get_type
slug.split('/')[0].capitalize
type = slug.split('/').first.capitalize
if type.in? %w(Tutorial Installation Overview General)
type.prepend 'User guide: '
elsif type.in? %w(Libraries Helpers)
type = name.remove %r{\ (?:Helper|Class|Classes|Library|Driver)\z}
end
type
end
def additional_entries
entries = []
css('.class').each do |c_node|
c_name = c_node.at_css('dt > .descname').content
c_id = c_node.at_css('dt')['id']
entries << [c_name, c_id, get_type]
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]
c_node.css('.method').each do |node|
m_name = node.at_css('.descname').content
name = c_name + '::' + m_name + '()'
id = node.at_css('dt')['id']
entries << [name, id, get_type]
node.css('.method').each do |n|
name = n.at_css('.descname').content
name = "#{class_name}::#{name}()"
id = node.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']
entries << [name, id, get_type]
name = "#{node.at_css('.descname').content}()"
id = node.at_css('dt[id]')['id']
type = self.type.start_with?('User guide') ? 'Functions' : self.type
entries << [name, id, type]
end
entries

@ -1,12 +1,11 @@
module Docs
class Codeigniter < UrlScraper
self.name = 'CodeIgniter'
self.type = 'codeigniter'
self.release = '3.0'
self.base_url = 'http://www.codeigniter.com/user_guide/'
self.type = 'sphinx'
self.base_url = 'https://www.codeigniter.com/user_guide/'
self.root_path = 'index.html'
self.links = {
home: 'http://codeigniter.com/',
home: 'https://codeigniter.com/',
code: 'https://github.com/bcit-ci/CodeIgniter'
}
@ -14,22 +13,30 @@ module Docs
options[:container] = '.document'
options[:only_patterns] = [
/\Ageneral/,
/\Alibraries/,
/\Adatabase/,
/\Ahelpers/
]
options[:skip] = %w(
license.html
changelog.html
DCO.html
general/welcome.html
general/requirements.html
general/credits.html
libraries/index.html
helpers/index.html
)
options[:skip_patterns] = [
/\Acontributing/,
/\Adocumentation/,
/\Ainstallation\/upgrade/
]
options[:attribution] = <<-HTML
&copy; British Columbia Institute of Technology<br>
&copy; 2014&ndash;2016 British Columbia Institute of Technology<br>
Licensed under the MIT License.
HTML
version '3.0' do
self.release = '3.0.4'
end
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

Loading…
Cancel
Save