History

Update and version Sinon.JS documentation

Thibaut Courouble committed 9 years ago

Commit 7e5c3fc1 parent 458000314 files · +49 −48Browse files

Unified · Split

14 files
  1. assets/images/docs.png +0 −0
  2. assets/images/docs@2x.png +0 −0
  3. assets/javascripts/templates/pages/about_tmpl.coffee +2 −2
  4. assets/stylesheets/application-dark.css.scss +1 −0
  5. assets/stylesheets/application.css.scss +1 −0
  6. assets/stylesheets/global/_icons.scss +1 −1
  7. assets/stylesheets/pages/_simple.scss +0 −1
  8. assets/stylesheets/pages/_sinon.scss +5 −0
  9. lib/docs/filters/sinon/clean_html.rb +10 −4
  10. lib/docs/filters/sinon/entries.rb +16 −35
  11. lib/docs/scrapers/sinon.rb +16 −8
  12. public/icons/docs/sinon/16.png +0 −0
  13. public/icons/docs/sinon/16@2x.png +0 −0
  14. public/icons/docs/sinon/SOURCE +1 −1
assets/images/docs.png+0−0

Binary file not shown.

assets/images/docs@2x.png+0−0

Binary file not shown.

assets/javascripts/templates/pages/about_tmpl.coffee+2−2
@@ -531,9 +531,9 @@ credits = [ · 530 unmodified lines
531531 'https://raw.githubusercontent.com/scikit-learn/scikit-learn/master/COPYING'
532532 ], [
533533 'Sinon',
534− '2010-2016 Christian Johansen',
534+ '2010-2017 Christian Johansen',
535535 'BSD',
536− 'https://raw.githubusercontent.com/cjohansen/Sinon.JS/master/LICENSE'
536+ 'https://raw.githubusercontent.com/sinonjs/sinon/master/LICENSE'
537537 ], [
538538 'Socket.io',
539539 '2014-2015 Automattic',
assets/stylesheets/application-dark.css.scss+1−0
@@ -81,6 +81,7 @@ · 80 unmodified lines
8181 'pages/rfc',
8282 'pages/rubydoc',
8383 'pages/rust',
84+ 'pages/sinon',
8485 'pages/socketio',
8586 'pages/sphinx',
8687 'pages/sphinx_simple',
assets/stylesheets/application.css.scss+1−0
@@ -81,6 +81,7 @@ · 80 unmodified lines
8181 'pages/rfc',
8282 'pages/rubydoc',
8383 'pages/rust',
84+ 'pages/sinon',
8485 'pages/socketio',
8586 'pages/sphinx',
8687 'pages/sphinx_simple',
assets/stylesheets/global/_icons.scss+1−1
@@ -93,7 +93,7 @@ · 92 unmodified lines
9393 ._icon-haskell:before { background-position: -6rem -4rem; }
9494 ._icon-requirejs:before { background-position: -7rem -4rem; }
9595 ._icon-chai:before { background-position: -8rem -4rem; }
96−._icon-sinon:before { background-position: -9rem -4rem; @extend %darkIconFix !optional; }
96+._icon-sinon:before { background-position: -9rem -4rem; }
9797 ._icon-cordova:before { background-position: 0 -5rem; }
9898 ._icon-markdown:before { background-position: -1rem -5rem; @extend %darkIconFix !optional; }
9999 ._icon-django:before { background-position: -2rem -5rem; }
assets/stylesheets/pages/_simple.scss+0−1
@@ -35,7 +35,6 @@ · 34 unmodified lines
3535 ._mocha,
3636 ._mongoose,
3737 ._redux,
38−._sinon,
3938 ._typescript,
4039 ._yarn {
4140 @extend %simple;
assets/stylesheets/pages/_sinon.scss+5−0
@@ -0,0 +1,5 @@
1+._sinon {
2+ @extend %simple;
3+
4+ h4 { @extend %block-label;}
5+}
lib/docs/filters/sinon/clean_html.rb+10−4
@@ -2,15 +2,21 @@ module Docs · 1 unmodified line
22 class Sinon
33 class CleanHtmlFilter < Filter
44 def call
5− css('> p:first-child', 'a.api', 'ul.nav').remove
5+ if root_page?
6+ at_css('h1').content = 'Sinon.JS'
7+ else
8+ css('h1').each do |node|
9+ node.content = node.content.remove(' - Sinon.JS')
10+ end
11+ end
612
7− css('.section', 'h2 code', 'h3 code').each do |node|
13+ css('.post', '.post-header', '.post-content', 'pre code').each do |node|
814 node.before(node.children).remove
915 end
1016
11− # Remove code highlighting
17+ css('h1 + h1').remove
18+
1219 css('pre').each do |node|
13− node.content = node.content
1420 node['data-language'] = 'javascript'
1521 end
1622
lib/docs/filters/sinon/entries.rb+16−35
@@ -1,46 +1,27 @@
11 module Docs
22 class Sinon
33 class EntriesFilter < Docs::EntriesFilter
4− def additional_entries
5− entries = []
6− type = config = nil
7−
8− css('*').each do |node|
9− if node.name == 'h2'
10− config = false
11− type = node.content.strip
12− type.remove! 'Test '
13− type.remove! 'Sinon.JS '
14− type = type[0].upcase + type.from(1)
15−
16− id = type.parameterize
17− node['id'] = id
4+ def get_name
5+ at_css('h1').content.strip
6+ end
187
19− entries << [type, id, 'Sections']
20− elsif node.name == 'h3' && node.content.include?('sinon.config')
21− config = true
22− elsif node.name == 'dl'
23− node.css('dt > code').each do |code|
24− name = code.content.strip
25− name.sub! %r{\(.*\);?}, '()'
26− name.sub! %r{\Aserver.(\w+)\s=.*\z}, 'server.\1'
27− name.remove! '`'
28− name.remove! %r{\A.+?\=\s+}
29− name.remove! %r{\A\w+?\s}
30− name.prepend 'sinon.config.' if config
8+ def get_type
9+ name
10+ end
3111
32− next if name =~ /\s/
33− next if entries.any? { |entry| entry[0].casecmp(name) == 0 }
12+ def additional_entries
13+ css('h4 > code').each_with_object [] do |node, entries|
14+ name = node.content.strip
15+ name.sub! %r{\s*\(.*\);?}, '()'
16+ name.sub! %r{\A(\w+\.\w+)\s+\=.*}, '\1'
17+ name.remove! %r{\A.+?\=\s+}
18+ name.remove! %r{\A\w+?\s}
19+ name.remove! %r{;\z}
3420
35− id = name.parameterize
36− code.parent['id'] = id
21+ next if entries.any? { |entry| entry[0].casecmp(name) == 0 }
3722
38− entries << [name, id, type]
39− end
40− end
23+ entries << [name, node.parent['id']]
4124 end
42−
43− entries
4425 end
4526 end
4627 end
lib/docs/scrapers/sinon.rb+16−8
@@ -1,23 +1,31 @@
11 module Docs
22 class Sinon < UrlScraper
3− self.name = 'Sinon'
3+ self.name = 'Sinon.JS'
4+ self.slug = 'sinon'
45 self.type = 'sinon'
5− self.release = '1.17.5'
6− self.base_url = 'http://sinonjs.org/docs/'
76 self.links = {
87 home: 'http://sinonjs.org/',
9− code: 'https://github.com/cjohansen/Sinon.JS'
8+ code: 'https://github.com/sinonjs/sinon'
109 }
1110
12− html_filters.push 'sinon/clean_html', 'sinon/entries', 'title'
11+ html_filters.push 'sinon/clean_html', 'sinon/entries'
1312
1413 options[:title] = 'Sinon.JS'
15− options[:container] = '.docs'
16− options[:skip_links] = true
14+ options[:container] = '.content .container'
1715
1816 options[:attribution] = <<-HTML
19− &copy; 2010&ndash;2016 Christian Johansen<br>
17+ &copy; 2010&ndash;2017 Christian Johansen<br>
2018 Licensed under the BSD License.
2119 HTML
20+
21+ version '2' do
22+ self.release = '2.1.0'
23+ self.base_url = "http://sinonjs.org/releases/v#{release}/"
24+ end
25+
26+ version '1' do
27+ self.release = '1.17.7'
28+ self.base_url = "http://sinonjs.org/releases/v#{release}/"
29+ end
2230 end
2331 end
public/icons/docs/sinon/16.png+0−0

Binary file not shown.

public/icons/docs/sinon/16@2x.png+0−0

Binary file not shown.

public/icons/docs/sinon/SOURCE+1−1
@@ -1 +1 @@
1−https://github.com/Kapeli/Dash-X-Platform-Resources/blob/master/docset_icons/sinon%402x.png
1+https://github.com/sinonjs/sinon/blob/master/docs/assets/images/logo.png