diff --git a/assets/images/icons.png b/assets/images/icons.png index cd4c124a..e09ee647 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 ee0ef48f..6554b777 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 342cc526..24772e51 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -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', diff --git a/assets/javascripts/templates/pages/news_tmpl.coffee b/assets/javascripts/templates/pages/news_tmpl.coffee index febe0ffa..b46e4d8e 100644 --- a/assets/javascripts/templates/pages/news_tmpl.coffee +++ b/assets/javascripts/templates/pages/news_tmpl.coffee @@ -25,7 +25,7 @@ newsItem = (date, news) -> app.news = [ [ 1404172800000, # July 1, 2014 - """ New Chai documentation """, + """ New Chai and Sinon documentations """, ], [ 1402790400000, # June 15, 2014 """ New RequireJS documentation """, diff --git a/assets/javascripts/views/pages/sinon.coffee b/assets/javascripts/views/pages/sinon.coffee new file mode 100644 index 00000000..1bddad9f --- /dev/null +++ b/assets/javascripts/views/pages/sinon.coffee @@ -0,0 +1,4 @@ +#= require views/pages/base +#= require views/pages/underscore + +app.views.SinonPage = app.views.UnderscorePage diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index c84211aa..d769758b 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -54,6 +54,7 @@ 'pages/redis', 'pages/requirejs', 'pages/rfc', + 'pages/sinon', 'pages/sphinx', 'pages/underscore', 'pages/yard', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 321959f3..ce8c6eec 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -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; } diff --git a/assets/stylesheets/pages/_sinon.scss b/assets/stylesheets/pages/_sinon.scss new file mode 100644 index 00000000..90f5e044 --- /dev/null +++ b/assets/stylesheets/pages/_sinon.scss @@ -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; } +} diff --git a/lib/docs/filters/sinon/clean_html.rb b/lib/docs/filters/sinon/clean_html.rb new file mode 100644 index 00000000..a3a830fc --- /dev/null +++ b/lib/docs/filters/sinon/clean_html.rb @@ -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 diff --git a/lib/docs/filters/sinon/entries.rb b/lib/docs/filters/sinon/entries.rb new file mode 100644 index 00000000..9096f87d --- /dev/null +++ b/lib/docs/filters/sinon/entries.rb @@ -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 diff --git a/lib/docs/scrapers/sinon.rb b/lib/docs/scrapers/sinon.rb new file mode 100644 index 00000000..fa158aa4 --- /dev/null +++ b/lib/docs/scrapers/sinon.rb @@ -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 + © 2010–2014 Christian Johansen
+ Licensed under the BSD License. + HTML + end +end diff --git a/public/icons/docs/sinon/16.png b/public/icons/docs/sinon/16.png new file mode 100644 index 00000000..22177d34 Binary files /dev/null and b/public/icons/docs/sinon/16.png differ diff --git a/public/icons/docs/sinon/16@2x.png b/public/icons/docs/sinon/16@2x.png new file mode 100644 index 00000000..db542d90 Binary files /dev/null and b/public/icons/docs/sinon/16@2x.png differ diff --git a/public/icons/docs/sinon/SOURCE b/public/icons/docs/sinon/SOURCE new file mode 100644 index 00000000..dce65418 --- /dev/null +++ b/public/icons/docs/sinon/SOURCE @@ -0,0 +1 @@ +https://github.com/Kapeli/Dash-X-Platform-Resources/blob/master/docset_icons/sinon%402x.png