diff --git a/assets/images/icons.png b/assets/images/icons.png index a9977a65..cd4c124a 100644 Binary files a/assets/images/icons.png and b/assets/images/icons.png differ diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png index d9051667..ee0ef48f 100644 Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 8e4a50df..342cc526 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -90,6 +90,11 @@ credits = [ 'cppreference.com', 'CC BY-SA', 'http://en.cppreference.com/w/Cppreference:Copyright/CC-BY-SA' + ], [ + 'Chai', + '2011-2014 Jake Luer', + 'MIT', + 'https://github.com/chaijs/chai/blob/master/README.md#license' ], [ 'CoffeeScript', '2009-2014 Jeremy Ashkenas', diff --git a/assets/javascripts/templates/pages/news_tmpl.coffee b/assets/javascripts/templates/pages/news_tmpl.coffee index 5dcede7c..febe0ffa 100644 --- a/assets/javascripts/templates/pages/news_tmpl.coffee +++ b/assets/javascripts/templates/pages/news_tmpl.coffee @@ -24,7 +24,10 @@ newsItem = (date, news) -> result app.news = [ - [ 1402790400000, # June 15, 2014 + [ 1404172800000, # July 1, 2014 + """ New Chai documentation """, + ], [ + 1402790400000, # June 15, 2014 """ New RequireJS documentation """, ], [ 1402704000000, # June 14, 2014 diff --git a/assets/javascripts/views/pages/chai.coffee b/assets/javascripts/views/pages/chai.coffee new file mode 100644 index 00000000..ad3a3834 --- /dev/null +++ b/assets/javascripts/views/pages/chai.coffee @@ -0,0 +1,4 @@ +#= require views/pages/base +#= require views/pages/underscore + +app.views.ChaiPage = app.views.UnderscorePage diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 937cdd6f..c84211aa 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -30,6 +30,7 @@ @import 'pages/angular', 'pages/c', + 'pages/chai', 'pages/coffeescript', 'pages/d3', 'pages/ember', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 76e56a18..321959f3 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -59,3 +59,4 @@ ._icon-laravel:before { background-position: 0 -9rem; } ._icon-haskell:before { background-position: -1rem -9rem; } ._icon-requirejs:before { background-position: -2rem -9rem; } +._icon-chai:before { background-position: -3rem -9rem; } diff --git a/assets/stylesheets/pages/_chai.scss b/assets/stylesheets/pages/_chai.scss new file mode 100644 index 00000000..a74567e8 --- /dev/null +++ b/assets/stylesheets/pages/_chai.scss @@ -0,0 +1,13 @@ +._chai { + padding-left: 1rem; + + > h1, > h2, h3 { margin-left: -1rem; } + > h2 { @extend %block-heading; } + h3 { @extend %block-label, %label-blue; } + h4 { font-size: 1em; } + + code { @extend %label; } + blockquote { @extend %note; } + + li.tag span { margin-right: 5px; } +} diff --git a/lib/docs/filters/chai/clean_html.rb b/lib/docs/filters/chai/clean_html.rb new file mode 100644 index 00000000..9a444abd --- /dev/null +++ b/lib/docs/filters/chai/clean_html.rb @@ -0,0 +1,24 @@ +module Docs + class Chai + class CleanHtmlFilter < Filter + def call + @doc = at_css('.documentation .rendered') + + if root_page? + at_css('h1').content = 'Chai Assertion Library' + end + + css('> article', '.header').each do |node| + node.before(node.children).remove + end + + # Remove code highlighting + css('pre').each do |node| + node.content = node.content + end + + doc + end + end + end +end diff --git a/lib/docs/filters/chai/entries.rb b/lib/docs/filters/chai/entries.rb new file mode 100644 index 00000000..8875ed3e --- /dev/null +++ b/lib/docs/filters/chai/entries.rb @@ -0,0 +1,22 @@ +module Docs + class Chai + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('h1').content + end + + def get_type + subpath.start_with?('/guide') ? 'Guides' : nil + end + + def additional_entries + css('.antiscroll-inner a').each_with_object [] do |node, entries| + id = node['href'].remove('#') + '-section' + node.content.strip.split(' / ').uniq { |name| name.downcase }.each do |name| + entries << [name, id, self.name] + end + end + end + end + end +end diff --git a/lib/docs/scrapers/chai.rb b/lib/docs/scrapers/chai.rb new file mode 100644 index 00000000..02e24cec --- /dev/null +++ b/lib/docs/scrapers/chai.rb @@ -0,0 +1,23 @@ +module Docs + class Chai < UrlScraper + self.name = 'Chai' + self.type = 'chai' + self.version = '1.9.1' + self.base_url = 'http://chaijs.com' + self.root_path = '/api/' + self.initial_paths = %w(/guide/installation/) + + html_filters.push 'chai/entries', 'chai/clean_html' + + options[:container] = '#content' + options[:trailing_slash] = true + + options[:only_patterns] = [/\A\/guide/, /\A\/api/] + options[:skip] = %w(/api/test/ /guide/ /guide/resources/) + + options[:attribution] = <<-HTML + © 2011–2014 Jake Luer
+ Licensed under the MIT License. + HTML + end +end diff --git a/public/icons/docs/chai/16.png b/public/icons/docs/chai/16.png new file mode 100644 index 00000000..0b2ab92c Binary files /dev/null and b/public/icons/docs/chai/16.png differ diff --git a/public/icons/docs/chai/16@2x.png b/public/icons/docs/chai/16@2x.png new file mode 100644 index 00000000..2a18a6db Binary files /dev/null and b/public/icons/docs/chai/16@2x.png differ diff --git a/public/icons/docs/chai/SOURCE b/public/icons/docs/chai/SOURCE new file mode 100644 index 00000000..05a70690 --- /dev/null +++ b/public/icons/docs/chai/SOURCE @@ -0,0 +1 @@ +http://chaijs.com/