diff --git a/assets/javascripts/views/pages/codeigniter.coffee b/assets/javascripts/views/pages/codeigniter.coffee new file mode 100644 index 00000000..606ecae4 --- /dev/null +++ b/assets/javascripts/views/pages/codeigniter.coffee @@ -0,0 +1,6 @@ +#= require views/pages/base + +class app.views.CodeigniterPage extends app.views.BasePage + prepare: -> + @highlightCode @findAllByTag('pre'), 'php' + return diff --git a/assets/stylesheets/application-dark.css.scss b/assets/stylesheets/application-dark.css.scss index 6e9a310f..2ba96e28 100644 --- a/assets/stylesheets/application-dark.css.scss +++ b/assets/stylesheets/application-dark.css.scss @@ -36,6 +36,7 @@ 'pages/cakephp', 'pages/chai', 'pages/clojure', + 'pages/codeigniter', 'pages/coffeescript', 'pages/d3', 'pages/dojo', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 35e24aac..d3bf5c58 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -36,6 +36,7 @@ 'pages/cakephp', 'pages/chai', 'pages/clojure', + 'pages/codeigniter', 'pages/coffeescript', 'pages/d3', 'pages/dojo', diff --git a/assets/stylesheets/pages/_codeigniter.scss b/assets/stylesheets/pages/_codeigniter.scss new file mode 100644 index 00000000..5cda3059 --- /dev/null +++ b/assets/stylesheets/pages/_codeigniter.scss @@ -0,0 +1,6 @@ +._codeigniter { + @extend %sphinx; + + .important { @extend %note-orange; } + .warning { @extend %note-red; } +} diff --git a/assets/stylesheets/pages/_sphinx.scss b/assets/stylesheets/pages/_sphinx.scss index 44b9f1f3..35351cf1 100644 --- a/assets/stylesheets/pages/_sphinx.scss +++ b/assets/stylesheets/pages/_sphinx.scss @@ -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 +} diff --git a/lib/docs/filters/codeigniter/clean_html.rb b/lib/docs/filters/codeigniter/clean_html.rb new file mode 100644 index 00000000..6571f249 --- /dev/null +++ b/lib/docs/filters/codeigniter/clean_html.rb @@ -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 diff --git a/lib/docs/filters/codeigniter/entries.rb b/lib/docs/filters/codeigniter/entries.rb new file mode 100644 index 00000000..06e7dfa0 --- /dev/null +++ b/lib/docs/filters/codeigniter/entries.rb @@ -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 diff --git a/lib/docs/scrapers/codeigniter.rb b/lib/docs/scrapers/codeigniter.rb new file mode 100644 index 00000000..9b8670f4 --- /dev/null +++ b/lib/docs/scrapers/codeigniter.rb @@ -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
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/codeigniter/16.png b/public/icons/docs/codeigniter/16.png new file mode 100644 index 00000000..a49b9f02 Binary files /dev/null and b/public/icons/docs/codeigniter/16.png differ diff --git a/public/icons/docs/codeigniter/16@2.png b/public/icons/docs/codeigniter/16@2.png new file mode 100644 index 00000000..a202fc8c Binary files /dev/null and b/public/icons/docs/codeigniter/16@2.png differ diff --git a/public/icons/docs/codeigniter/SOURCE b/public/icons/docs/codeigniter/SOURCE new file mode 100644 index 00000000..dd068ebf --- /dev/null +++ b/public/icons/docs/codeigniter/SOURCE @@ -0,0 +1 @@ +http://www.codeigniter.com/assets/data/ci-logo.zip