Add Sinon documentation

pull/113/head
Thibaut 11 years ago
parent 46f6db4a90
commit 63715a31f9

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

@ -235,6 +235,11 @@ credits = [
'2006-2014 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
'MIT',
'https://raw.github.com/nex3/sass/master/MIT-LICENSE'
], [
'Sinon',
'2010-2014 Christian Johansen',
'BSD',
'https://raw.githubusercontent.com/cjohansen/Sinon.JS/master/LICENSE'
], [
'Underscore.js',
'2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',

@ -25,7 +25,7 @@ newsItem = (date, news) ->
app.news = [
[ 1404172800000, # July 1, 2014
""" New <a href="/chai/">Chai</a> documentation """,
""" New <a href="/chai/">Chai</a> and <a href="/sinon/">Sinon</a> documentations """,
], [
1402790400000, # June 15, 2014
""" New <a href="/requirejs/">RequireJS</a> documentation """,

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

@ -54,6 +54,7 @@
'pages/redis',
'pages/requirejs',
'pages/rfc',
'pages/sinon',
'pages/sphinx',
'pages/underscore',
'pages/yard',

@ -60,3 +60,4 @@
._icon-haskell:before { background-position: -1rem -9rem; }
._icon-requirejs:before { background-position: -2rem -9rem; }
._icon-chai:before { background-position: -3rem -9rem; }
._icon-sinon:before { background-position: -4rem -9rem; }

@ -0,0 +1,9 @@
._sinon {
padding-left: 1rem;
> h1, > h2, > h3 { margin-left: -1rem; }
> h2 { @extend %block-heading; }
> h3 { @extend %block-label, %label-blue; }
dt > code { @extend %label; }
}

@ -0,0 +1,20 @@
module Docs
class Sinon
class CleanHtmlFilter < Filter
def call
css('> p:first-child', 'a.api', 'ul.nav').remove
css('.section', 'h2 code', 'h3 code').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,47 @@
module Docs
class Sinon
class EntriesFilter < Docs::EntriesFilter
def additional_entries
entries = []
type = config = nil
css('*').each do |node|
if node.name == 'h2'
config = false
type = node.content.strip
type.remove! 'Test '
type.remove! 'Sinon.JS '
type = type[0].upcase + type.from(1)
id = type.parameterize
node['id'] = id
entries << [type, id, 'Sections']
elsif node.name == 'h3' && node.content.include?('sinon.config')
config = true
elsif node.name == 'dl'
node.css('dt > code').each do |code|
name = code.content.strip
name.sub! %r{\(.*\);?}, '()'
name.sub! %r{\Aserver.(\w+)\s=.*\z}, 'server.\1'
name.remove! '`'
name.remove! %r{\A.+?\=\s+}
name.remove! %r{\A\w+?\s}
name.prepend 'sinon.config.' if config
next if name =~ /\s/
next if entries.any? { |entry| entry[0].casecmp(name) == 0 }
id = name.parameterize
code.parent['id'] = id
entries << [name, id, type]
end
end
end
entries
end
end
end
end

@ -0,0 +1,19 @@
module Docs
class Sinon < UrlScraper
self.name = 'Sinon'
self.type = 'sinon'
self.version = '1.10.2'
self.base_url = 'http://sinonjs.org/docs/'
html_filters.push 'sinon/clean_html', 'sinon/entries', 'title'
options[:title] = 'Sinon.JS'
options[:container] = '.docs'
options[:skip_links] = true
options[:attribution] = <<-HTML
&copy; 2010&ndash;2014 Christian Johansen<br>
Licensed under the BSD License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

@ -0,0 +1 @@
https://github.com/Kapeli/Dash-X-Platform-Resources/blob/master/docset_icons/sinon%402x.png
Loading…
Cancel
Save