mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Add CodeIgniter Documentation
This commit is contained in:
parent
578ba0acab
commit
8232a0538a
11 changed files with 121 additions and 1 deletions
6
assets/javascripts/views/pages/codeigniter.coffee
Normal file
6
assets/javascripts/views/pages/codeigniter.coffee
Normal file
|
@ -0,0 +1,6 @@
|
|||
#= require views/pages/base
|
||||
|
||||
class app.views.CodeigniterPage extends app.views.BasePage
|
||||
prepare: ->
|
||||
@highlightCode @findAllByTag('pre'), 'php'
|
||||
return
|
|
@ -36,6 +36,7 @@
|
|||
'pages/cakephp',
|
||||
'pages/chai',
|
||||
'pages/clojure',
|
||||
'pages/codeigniter',
|
||||
'pages/coffeescript',
|
||||
'pages/d3',
|
||||
'pages/dojo',
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
'pages/cakephp',
|
||||
'pages/chai',
|
||||
'pages/clojure',
|
||||
'pages/codeigniter',
|
||||
'pages/coffeescript',
|
||||
'pages/d3',
|
||||
'pages/dojo',
|
||||
|
|
6
assets/stylesheets/pages/_codeigniter.scss
Normal file
6
assets/stylesheets/pages/_codeigniter.scss
Normal file
|
@ -0,0 +1,6 @@
|
|||
._codeigniter {
|
||||
@extend %sphinx;
|
||||
|
||||
.important { @extend %note-orange; }
|
||||
.warning { @extend %note-red; }
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
._sphinx {
|
||||
%sphinx {
|
||||
h2, h3 { @extend %block-heading; }
|
||||
dl:not(.docutils) > dt { @extend %block-label, %label-blue; }
|
||||
dt + dt { margin-top: -.5em; }
|
||||
|
@ -24,3 +24,7 @@
|
|||
|
||||
ul.simple { margin: 1em 0; }
|
||||
}
|
||||
|
||||
._sphinx {
|
||||
@extend %sphinx
|
||||
}
|
||||
|
|
24
lib/docs/filters/codeigniter/clean_html.rb
Normal file
24
lib/docs/filters/codeigniter/clean_html.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
module Docs
|
||||
class Codeigniter
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('.headerlink').remove
|
||||
|
||||
css('h1', 'h2', 'h3', 'h4', 'h5', 'pre').each do |node|
|
||||
node.content = node.content
|
||||
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'
|
||||
end
|
||||
|
||||
doc.children
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
42
lib/docs/filters/codeigniter/entries.rb
Normal file
42
lib/docs/filters/codeigniter/entries.rb
Normal file
|
@ -0,0 +1,42 @@
|
|||
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
|
||||
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]
|
||||
|
||||
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]
|
||||
end
|
||||
end
|
||||
|
||||
css('.function').each do |node|
|
||||
name = node.at_css('.descname').content + '()'
|
||||
id = node.at_css('dt')['id']
|
||||
entries << [name, id, get_type]
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
35
lib/docs/scrapers/codeigniter.rb
Normal file
35
lib/docs/scrapers/codeigniter.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
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.root_path = 'index.html'
|
||||
self.links = {
|
||||
home: 'http://codeigniter.com/',
|
||||
code: 'https://github.com/bcit-ci/CodeIgniter'
|
||||
}
|
||||
|
||||
html_filters.push 'codeigniter/clean_html', 'codeigniter/entries'
|
||||
|
||||
options[:container] = '.document'
|
||||
|
||||
options[:only_patterns] = [
|
||||
/\Ageneral/,
|
||||
/\Alibraries/,
|
||||
/\Adatabase/,
|
||||
/\Ahelpers/
|
||||
]
|
||||
|
||||
options[:skip] = %w(
|
||||
general/welcome.html
|
||||
general/requirements.html
|
||||
general/credits.html
|
||||
)
|
||||
|
||||
options[:attribution] = <<-HTML
|
||||
© British Columbia Institute of Technology<br>
|
||||
Licensed under the MIT License.
|
||||
HTML
|
||||
end
|
||||
end
|
BIN
public/icons/docs/codeigniter/16.png
Normal file
BIN
public/icons/docs/codeigniter/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 882 B |
BIN
public/icons/docs/codeigniter/16@2.png
Normal file
BIN
public/icons/docs/codeigniter/16@2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
1
public/icons/docs/codeigniter/SOURCE
Normal file
1
public/icons/docs/codeigniter/SOURCE
Normal file
|
@ -0,0 +1 @@
|
|||
http://www.codeigniter.com/assets/data/ci-logo.zip
|
Loading…
Reference in a new issue