History

Add Jest documentation

Thibaut Courouble committed 9 years ago

Commit aa1be2f1 parent 22461b013 files · +91 −-3Browse files

Unified · Split

13 files
  1. assets/images/docs.png +0 −0
  2. assets/images/docs@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/jest/clean_html.rb +29 −0
  9. lib/docs/filters/jest/entries.rb +35 −0
  10. lib/docs/scrapers/jest.rb +21 −0
  11. public/icons/docs/jest/16.png +0 −0
  12. public/icons/docs/jest/16@2x.png +0 −0
  13. public/icons/docs/jest/SOURCE +1 −0
assets/images/docs.png+0−0

Binary file not shown.

assets/images/docs@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 documentation: <a href=\"/liquid/\">Liquid</a>"
4+ "New documentations: <a href=\"/jest/\">Jest</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+ 'Jest',
288+ '2014-present Facebook Inc.',
289+ 'BSD',
290+ 'https://raw.githubusercontent.com/facebook/jest/master/LICENSE'
286291 ], [
287292 'jQuery',
288293 'Packt Publishing<br>&copy; jQuery Foundation and other contributors',
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.JestPage =
3132 app.views.KnockoutPage =
3233 app.views.KotlinPage =
3334 app.views.LaravelPage =
assets/stylesheets/global/_icons.scss+1−0
@@ -43,6 +43,7 @@ · 42 unmodified lines
4343 %icon-clipboard-white { background-position: -1rem -2rem; }
4444 %icon-close-white { background-position: -2rem -2rem; }
4545
46+._icon-jest:before { background-position: 0 0; }
4647 ._icon-liquid:before { background-position: -1rem 0; }
4748 ._icon-openjdk:before { background-position: -2rem 0; }
4849 ._icon-codeceptjs:before { background-position: -3rem 0; }
assets/stylesheets/pages/_simple.scss+1−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 ._haxe,
2929 ._immutable,
3030 ._influxdata,
31+._jest,
3132 ._less,
3233 ._lodash,
3334 ._marionette,
lib/docs/filters/jest/clean_html.rb+29−0
@@ -0,0 +1,29 @@
1+module Docs
2+ class Jest
3+ class CleanHtmlFilter < Filter
4+ def call
5+ @doc = at_css('.mainContainer .post')
6+
7+ at_css('h1').content = 'Jest' if root_page?
8+
9+ css('.edit-page-link', '.hash-link', 'hr').remove
10+
11+ css('.postHeader', 'article', 'div:not([class])').each do |node|
12+ node.before(node.children).remove
13+ end
14+
15+ css('.anchor[name]').each do |node|
16+ node.parent['id'] = node['name']
17+ node.remove
18+ end
19+
20+ css('pre').each do |node|
21+ node['data-language'] = node['class'][/language-(\w+)/, 1]
22+ node.content = node.content
23+ end
24+
25+ doc
26+ end
27+ end
28+ end
29+end
lib/docs/filters/jest/entries.rb+35−0
@@ -0,0 +1,35 @@
1+module Docs
2+ class Jest
3+ class EntriesFilter < Docs::EntriesFilter
4+ def get_name
5+ at_css('.mainContainer h1').content
6+ end
7+
8+ def get_type
9+ type = at_css('.navItemActive').ancestors('.navGroup').first.at_css('h3').content
10+
11+ if type == 'Introduction'
12+ 'Guides: Introduction'
13+ elsif type == 'API Reference'
14+ self.name
15+ else
16+ type
17+ end
18+ end
19+
20+ def additional_entries
21+ return [] unless !root_page? && self.type == self.name # api page
22+
23+ at_css('.mainContainer ul').css('li > a').map do |node|
24+ name = node.at_css('code').content.strip
25+ name.sub! %r{\(.*\)}, '()'
26+ name.remove! %r{[\s=<].*}
27+ name.prepend 'jest ' if name.start_with?('--')
28+ name.prepend 'Config: ' if slug == 'configuration'
29+ id = node['href'].remove('#')
30+ [name, id]
31+ end
32+ end
33+ end
34+ end
35+end
lib/docs/scrapers/jest.rb+21−0
@@ -0,0 +1,21 @@
1+module Docs
2+ class Jest < UrlScraper
3+ self.type = 'jest'
4+ self.release = '20.0.1'
5+ self.base_url = 'https://facebook.github.io/jest/docs/en/'
6+ self.root_path = 'getting-started.html'
7+ self.links = {
8+ home: 'https://facebook.github.io/jest/',
9+ code: 'https://github.com/facebook/jest'
10+ }
11+
12+ html_filters.push 'jest/entries', 'jest/clean_html'
13+
14+ options[:container] = '.docMainWrapper'
15+
16+ options[:attribution] = <<-HTML
17+ &copy; 2014&ndash;present Facebook Inc.<br>
18+ Licensed under the BSD License.
19+ HTML
20+ end
21+end
public/icons/docs/jest/16.png+0−0

Binary file not shown.

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

Binary file not shown.

public/icons/docs/jest/SOURCE+1−0
@@ -0,0 +1 @@
1+https://github.com/facebook/jest/tree/master/website/src/jest/img