diff --git a/assets/images/docs.png b/assets/images/docs.png index 582e0915..2b22418e 100644 Binary files a/assets/images/docs.png and b/assets/images/docs.png differ diff --git a/assets/images/docs@2x.png b/assets/images/docs@2x.png index bb6b7368..f250d321 100644 Binary files a/assets/images/docs@2x.png and b/assets/images/docs@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index d7c98e1c..cde0359f 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,7 +1,7 @@ [ [ "2017-05-14", - "New documentation: Liquid" + "New documentations: Jest and Liquid" ], [ "2017-04-30", "New documentation: OpenJDK" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 2c82650b..fe1895ea 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -283,6 +283,11 @@ credits = [ '2015 InfluxData, Inc.', 'MIT', 'https://github.com/influxdata/docs.influxdata.com/blob/master/LICENSE' + ], [ + 'Jest', + '2014-present Facebook Inc.', + 'BSD', + 'https://raw.githubusercontent.com/facebook/jest/master/LICENSE' ], [ 'jQuery', 'Packt Publishing
© jQuery Foundation and other contributors', diff --git a/assets/javascripts/views/pages/simple.coffee b/assets/javascripts/views/pages/simple.coffee index d8909cf8..23ed2fcd 100644 --- a/assets/javascripts/views/pages/simple.coffee +++ b/assets/javascripts/views/pages/simple.coffee @@ -28,6 +28,7 @@ app.views.ExpressPage = app.views.GoPage = app.views.ImmutablePage = app.views.InfluxdataPage = +app.views.JestPage = app.views.KnockoutPage = app.views.KotlinPage = app.views.LaravelPage = diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 76d43c66..154eb2ae 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -43,6 +43,7 @@ %icon-clipboard-white { background-position: -1rem -2rem; } %icon-close-white { background-position: -2rem -2rem; } +._icon-jest:before { background-position: 0 0; } ._icon-liquid:before { background-position: -1rem 0; } ._icon-openjdk:before { background-position: -2rem 0; } ._icon-codeceptjs:before { background-position: -3rem 0; } diff --git a/assets/stylesheets/pages/_simple.scss b/assets/stylesheets/pages/_simple.scss index 7a770959..d6980e39 100644 --- a/assets/stylesheets/pages/_simple.scss +++ b/assets/stylesheets/pages/_simple.scss @@ -28,6 +28,7 @@ ._haxe, ._immutable, ._influxdata, +._jest, ._less, ._lodash, ._marionette, diff --git a/lib/docs/filters/jest/clean_html.rb b/lib/docs/filters/jest/clean_html.rb new file mode 100644 index 00000000..9d88383f --- /dev/null +++ b/lib/docs/filters/jest/clean_html.rb @@ -0,0 +1,29 @@ +module Docs + class Jest + class CleanHtmlFilter < Filter + def call + @doc = at_css('.mainContainer .post') + + at_css('h1').content = 'Jest' if root_page? + + css('.edit-page-link', '.hash-link', 'hr').remove + + css('.postHeader', 'article', 'div:not([class])').each do |node| + node.before(node.children).remove + end + + css('.anchor[name]').each do |node| + node.parent['id'] = node['name'] + node.remove + end + + css('pre').each do |node| + node['data-language'] = node['class'][/language-(\w+)/, 1] + node.content = node.content + end + + doc + end + end + end +end diff --git a/lib/docs/filters/jest/entries.rb b/lib/docs/filters/jest/entries.rb new file mode 100644 index 00000000..e90f51ca --- /dev/null +++ b/lib/docs/filters/jest/entries.rb @@ -0,0 +1,35 @@ +module Docs + class Jest + class EntriesFilter < Docs::EntriesFilter + def get_name + at_css('.mainContainer h1').content + end + + def get_type + type = at_css('.navItemActive').ancestors('.navGroup').first.at_css('h3').content + + if type == 'Introduction' + 'Guides: Introduction' + elsif type == 'API Reference' + self.name + else + type + end + end + + def additional_entries + return [] unless !root_page? && self.type == self.name # api page + + at_css('.mainContainer ul').css('li > a').map do |node| + name = node.at_css('code').content.strip + name.sub! %r{\(.*\)}, '()' + name.remove! %r{[\s=<].*} + name.prepend 'jest ' if name.start_with?('--') + name.prepend 'Config: ' if slug == 'configuration' + id = node['href'].remove('#') + [name, id] + end + end + end + end +end diff --git a/lib/docs/scrapers/jest.rb b/lib/docs/scrapers/jest.rb new file mode 100644 index 00000000..097d5937 --- /dev/null +++ b/lib/docs/scrapers/jest.rb @@ -0,0 +1,21 @@ +module Docs + class Jest < UrlScraper + self.type = 'jest' + self.release = '20.0.1' + self.base_url = 'https://facebook.github.io/jest/docs/en/' + self.root_path = 'getting-started.html' + self.links = { + home: 'https://facebook.github.io/jest/', + code: 'https://github.com/facebook/jest' + } + + html_filters.push 'jest/entries', 'jest/clean_html' + + options[:container] = '.docMainWrapper' + + options[:attribution] = <<-HTML + © 2014–present Facebook Inc.
+ Licensed under the BSD License. + HTML + end +end diff --git a/public/icons/docs/jest/16.png b/public/icons/docs/jest/16.png new file mode 100644 index 00000000..67a6d30f Binary files /dev/null and b/public/icons/docs/jest/16.png differ diff --git a/public/icons/docs/jest/16@2x.png b/public/icons/docs/jest/16@2x.png new file mode 100644 index 00000000..86e703b0 Binary files /dev/null and b/public/icons/docs/jest/16@2x.png differ diff --git a/public/icons/docs/jest/SOURCE b/public/icons/docs/jest/SOURCE new file mode 100644 index 00000000..5604f134 --- /dev/null +++ b/public/icons/docs/jest/SOURCE @@ -0,0 +1 @@ +https://github.com/facebook/jest/tree/master/website/src/jest/img