Add Chai documentation

pull/113/head
Thibaut 11 years ago
parent 94e02963be
commit 46f6db4a90

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 52 KiB

@ -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',

@ -24,7 +24,10 @@ newsItem = (date, news) ->
result
app.news = [
[ 1402790400000, # June 15, 2014
[ 1404172800000, # July 1, 2014
""" New <a href="/chai/">Chai</a> documentation """,
], [
1402790400000, # June 15, 2014
""" New <a href="/requirejs/">RequireJS</a> documentation """,
], [
1402704000000, # June 14, 2014

@ -0,0 +1,4 @@
#= require views/pages/base
#= require views/pages/underscore
app.views.ChaiPage = app.views.UnderscorePage

@ -30,6 +30,7 @@
@import 'pages/angular',
'pages/c',
'pages/chai',
'pages/coffeescript',
'pages/d3',
'pages/ember',

@ -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; }

@ -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; }
}

@ -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

@ -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

@ -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
&copy; 2011&ndash;2014 Jake Luer<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -0,0 +1 @@
http://chaijs.com/
Loading…
Cancel
Save