Bläddra i källkod

Add Jasmine documentation

Thibaut Courouble 8 år sedan
förälder
incheckning
7a1ca03397

BIN
assets/images/docs-2.png


BIN
assets/images/docs-2@2x.png


+ 1 - 1
assets/javascripts/news.json

@@ -1,7 +1,7 @@
 [
   [
     "2017-05-14",
-    "New documentations: <a href=\"/jest/\">Jest</a> and <a href=\"/liquid/\">Liquid</a>"
+    "New documentations: <a href=\"/jest/\">Jest</a>, <a href=\"/jasmine/\">Jasmine</a> and <a href=\"/liquid/\">Liquid</a>"
   ], [
     "2017-04-30",
     "New documentation: <a href=\"/openjdk/\">OpenJDK</a>"

+ 5 - 0
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'
+  ], [
+    'Jasmine',
+    '2008-2017 Pivotal Labs',
+    'MIT',
+    'https://raw.githubusercontent.com/jasmine/jasmine/master/MIT.LICENSE'
   ], [
     'Jest',
     '2014-present Facebook Inc.',

+ 1 - 0
assets/javascripts/views/pages/simple.coffee

@@ -28,6 +28,7 @@ app.views.ExpressPage =
 app.views.GoPage =
 app.views.ImmutablePage =
 app.views.InfluxdataPage =
+app.views.JasminePage =
 app.views.JestPage =
 app.views.KnockoutPage =
 app.views.KotlinPage =

+ 1 - 0
assets/stylesheets/global/_icons.scss

@@ -171,3 +171,4 @@
 ._icon-padrino:before       { background-position: -7rem -1rem; @extend %doc-icon-2; }
 ._icon-angular:before       { background-position: -8rem -1rem; @extend %doc-icon-2; }
 ._icon-love:before          { background-position: -9rem -1rem; @extend %doc-icon-2; }
+._icon-jasmine:before       { background-position: 0 -2rem; @extend %doc-icon-2; }

+ 1 - 0
assets/stylesheets/pages/_simple.scss

@@ -28,6 +28,7 @@
 ._haxe,
 ._immutable,
 ._influxdata,
+._jasmine,
 ._jest,
 ._less,
 ._lodash,

+ 30 - 0
lib/docs/filters/jasmine/clean_html.rb

@@ -0,0 +1,30 @@
+module Docs
+  class Jasmine
+    class CleanHtmlFilter < Filter
+      def call
+        @doc = at_css('.docs')
+
+        at_css('h1').content = 'Jasmine' if root_page?
+
+        css('header', 'article', 'section:not([class])', 'div.description').each do |node|
+          node.before(node.children).remove
+        end
+
+        css('h3.subsection-title').each do |node|
+          node.name = 'h2'
+        end
+
+        css('h4.name').each do |node|
+          node.name = 'h3'
+        end
+
+        css('pre').each do |node|
+          node.content = node.content
+          node['data-language'] = 'javascript'
+        end
+
+        doc
+      end
+    end
+  end
+end

+ 27 - 0
lib/docs/filters/jasmine/entries.rb

@@ -0,0 +1,27 @@
+module Docs
+  class Jasmine
+    class EntriesFilter < Docs::EntriesFilter
+      def get_name
+        name = at_css('h1').content.strip
+        name.remove! %r{\A\w+:\s}
+        name
+      end
+
+      def get_type
+        at_css('h1').content.strip
+      end
+
+      def additional_entries
+        css('h3[id]').each_with_object [] do |node, entries|
+          name = node.content.strip
+          next if name.start_with?('new ')
+          static = name.sub! '(static) ', ''
+          name.sub! %r{\(.*\)}, '()'
+          name.remove! %r{\s.*}
+          name.prepend "#{self.name}#{static ? '.' : '#'}" unless slug == 'global'
+          entries << [name, node['id']]
+        end
+      end
+    end
+  end
+end

+ 21 - 0
lib/docs/scrapers/jasmine.rb

@@ -0,0 +1,21 @@
+module Docs
+  class Jasmine < UrlScraper
+    self.type = 'jasmine'
+    self.release = '2.6.1'
+    self.base_url = 'https://jasmine.github.io/api/2.6/'
+    self.root_path = 'index.html'
+    self.links = {
+      home: 'https://jasmine.github.io/',
+      code: 'https://github.com/jasmine/jasmine'
+    }
+
+    html_filters.push 'jasmine/clean_html', 'jasmine/entries'
+
+    options[:container] = '.main-content'
+
+    options[:attribution] = <<-HTML
+      &copy; 2008&ndash;2017 Pivotal Labs<br>
+      Licensed under the MIT License.
+    HTML
+  end
+end

BIN
public/icons/docs/jasmine/16.png


BIN
public/icons/docs/jasmine/16@2x.png


+ 1 - 0
public/icons/docs/jasmine/SOURCE

@@ -0,0 +1 @@
+https://github.com/jasmine/jasmine.github.io/tree/master/images