History

Add Jasmine documentation

Thibaut Courouble committed 9 years ago

Commit 7a1ca031 parent c13877f13 files · +84 −-3Browse files

Unified · Split

13 files
  1. assets/images/docs-2.png +0 −0
  2. assets/images/docs-2@2x.png +0 −0
  3. assets/javascripts/news.json +1 −1
  4. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  5. assets/javascripts/views/pages/simple.coffee +1 −0
  6. assets/stylesheets/global/_icons.scss +1 −0
  7. assets/stylesheets/pages/_simple.scss +1 −0
  8. lib/docs/filters/jasmine/clean_html.rb +30 −0
  9. lib/docs/filters/jasmine/entries.rb +27 −0
  10. lib/docs/scrapers/jasmine.rb +21 −0
  11. public/icons/docs/jasmine/16.png +0 −0
  12. public/icons/docs/jasmine/16@2x.png +0 −0
  13. public/icons/docs/jasmine/SOURCE +1 −0
assets/images/docs-2.png+0−0

Binary file not shown.

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

Binary file not shown.

assets/javascripts/news.json+1−1
@@ -1,7 +1,7 @@
11 [
22 [
33 "2017-05-14",
4− "New documentations: <a href=\"/jest/\">Jest</a> and <a href=\"/liquid/\">Liquid</a>"
4+ "New documentations: <a href=\"/jest/\">Jest</a>, <a href=\"/jasmine/\">Jasmine</a> and <a href=\"/liquid/\">Liquid</a>"
55 ], [
66 "2017-04-30",
77 "New documentation: <a href=\"/openjdk/\">OpenJDK</a>"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -283,6 +283,11 @@ credits = [ · 282 unmodified lines
283283 '2015 InfluxData, Inc.',
284284 'MIT',
285285 'https://github.com/influxdata/docs.influxdata.com/blob/master/LICENSE'
286+ ], [
287+ 'Jasmine',
288+ '2008-2017 Pivotal Labs',
289+ 'MIT',
290+ 'https://raw.githubusercontent.com/jasmine/jasmine/master/MIT.LICENSE'
286291 ], [
287292 'Jest',
288293 '2014-present Facebook Inc.',
assets/javascripts/views/pages/simple.coffee+1−0
@@ -28,6 +28,7 @@ app.views.ExpressPage = · 27 unmodified lines
2828 app.views.GoPage =
2929 app.views.ImmutablePage =
3030 app.views.InfluxdataPage =
31+app.views.JasminePage =
3132 app.views.JestPage =
3233 app.views.KnockoutPage =
3334 app.views.KotlinPage =
assets/stylesheets/global/_icons.scss+1−0
@@ -171,3 +171,4 @@ · 170 unmodified lines
171171 ._icon-padrino:before { background-position: -7rem -1rem; @extend %doc-icon-2; }
172172 ._icon-angular:before { background-position: -8rem -1rem; @extend %doc-icon-2; }
173173 ._icon-love:before { background-position: -9rem -1rem; @extend %doc-icon-2; }
174+._icon-jasmine:before { background-position: 0 -2rem; @extend %doc-icon-2; }
assets/stylesheets/pages/_simple.scss+1−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 ._haxe,
2929 ._immutable,
3030 ._influxdata,
31+._jasmine,
3132 ._jest,
3233 ._less,
3334 ._lodash,
lib/docs/filters/jasmine/clean_html.rb+30−0
@@ -0,0 +1,30 @@
1+module Docs
2+ class Jasmine
3+ class CleanHtmlFilter < Filter
4+ def call
5+ @doc = at_css('.docs')
6+
7+ at_css('h1').content = 'Jasmine' if root_page?
8+
9+ css('header', 'article', 'section:not([class])', 'div.description').each do |node|
10+ node.before(node.children).remove
11+ end
12+
13+ css('h3.subsection-title').each do |node|
14+ node.name = 'h2'
15+ end
16+
17+ css('h4.name').each do |node|
18+ node.name = 'h3'
19+ end
20+
21+ css('pre').each do |node|
22+ node.content = node.content
23+ node['data-language'] = 'javascript'
24+ end
25+
26+ doc
27+ end
28+ end
29+ end
30+end
lib/docs/filters/jasmine/entries.rb+27−0
@@ -0,0 +1,27 @@
1+module Docs
2+ class Jasmine
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ name = at_css('h1').content.strip
6+ name.remove! %r{\A\w+:\s}
7+ name
8+ end
9+
10+ def get_type
11+ at_css('h1').content.strip
12+ end
13+
14+ def additional_entries
15+ css('h3[id]').each_with_object [] do |node, entries|
16+ name = node.content.strip
17+ next if name.start_with?('new ')
18+ static = name.sub! '(static) ', ''
19+ name.sub! %r{\(.*\)}, '()'
20+ name.remove! %r{\s.*}
21+ name.prepend "#{self.name}#{static ? '.' : '#'}" unless slug == 'global'
22+ entries << [name, node['id']]
23+ end
24+ end
25+ end
26+ end
27+end
lib/docs/scrapers/jasmine.rb+21−0
@@ -0,0 +1,21 @@
1+module Docs
2+ class Jasmine < UrlScraper
3+ self.type = 'jasmine'
4+ self.release = '2.6.1'
5+ self.base_url = 'https://jasmine.github.io/api/2.6/'
6+ self.root_path = 'index.html'
7+ self.links = {
8+ home: 'https://jasmine.github.io/',
9+ code: 'https://github.com/jasmine/jasmine'
10+ }
11+
12+ html_filters.push 'jasmine/clean_html', 'jasmine/entries'
13+
14+ options[:container] = '.main-content'
15+
16+ options[:attribution] = <<-HTML
17+ &copy; 2008&ndash;2017 Pivotal Labs<br>
18+ Licensed under the MIT License.
19+ HTML
20+ end
21+end
public/icons/docs/jasmine/16.png+0−0

Binary file not shown.

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

Binary file not shown.

public/icons/docs/jasmine/SOURCE+1−0
@@ -0,0 +1 @@
1+https://github.com/jasmine/jasmine.github.io/tree/master/images