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 @@
1[1[
2 [2 [
3 "2017-05-14",3 "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>"
5 ], [5 ], [
6 "2017-04-30",6 "2017-04-30",
7 "New documentation: <a href=\"/openjdk/\">OpenJDK</a>"7 "New documentation: <a href=\"/openjdk/\">OpenJDK</a>"
assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -283,6 +283,11 @@ credits = [ · 282 unmodified lines
283 '2015 InfluxData, Inc.',283 '2015 InfluxData, Inc.',
284 'MIT',284 'MIT',
285 'https://github.com/influxdata/docs.influxdata.com/blob/master/LICENSE'285 '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'
286 ], [291 ], [
287 'jQuery',292 'jQuery',
288 'Packt Publishing<br>&copy; jQuery Foundation and other contributors',293 '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
28app.views.GoPage =28app.views.GoPage =
29app.views.ImmutablePage =29app.views.ImmutablePage =
30app.views.InfluxdataPage =30app.views.InfluxdataPage =
31app.views.JestPage =
31app.views.KnockoutPage =32app.views.KnockoutPage =
32app.views.KotlinPage =33app.views.KotlinPage =
33app.views.LaravelPage =34app.views.LaravelPage =
assets/stylesheets/global/_icons.scss+1−0
@@ -43,6 +43,7 @@ · 42 unmodified lines
43%icon-clipboard-white { background-position: -1rem -2rem; }43%icon-clipboard-white { background-position: -1rem -2rem; }
44%icon-close-white { background-position: -2rem -2rem; }44%icon-close-white { background-position: -2rem -2rem; }
45 45
46._icon-jest:before { background-position: 0 0; }
46._icon-liquid:before { background-position: -1rem 0; }47._icon-liquid:before { background-position: -1rem 0; }
47._icon-openjdk:before { background-position: -2rem 0; }48._icon-openjdk:before { background-position: -2rem 0; }
48._icon-codeceptjs:before { background-position: -3rem 0; }49._icon-codeceptjs:before { background-position: -3rem 0; }
assets/stylesheets/pages/_simple.scss+1−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
28._haxe,28._haxe,
29._immutable,29._immutable,
30._influxdata,30._influxdata,
31._jest,
31._less,32._less,
32._lodash,33._lodash,
33._marionette,34._marionette,
lib/docs/filters/jest/clean_html.rb+29−0
@@ -0,0 +1,29 @@
1module 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
29end
lib/docs/filters/jest/entries.rb+35−0
@@ -0,0 +1,35 @@
1module 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
35end
lib/docs/scrapers/jest.rb+21−0
@@ -0,0 +1,21 @@
1module 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
21end
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 @@
1https://github.com/facebook/jest/tree/master/website/src/jest/img