Pārlūkot izejas kodu

Add Async documentation

Thibaut Courouble 9 gadi atpakaļ
vecāks
revīzija
6e43cfe7ba

BIN
assets/images/docs.png


BIN
assets/images/docs@2x.png


+ 1 - 1
assets/javascripts/news.json

@@ -1,7 +1,7 @@
 [
   [
     "2016-11-20",
-    "New documentations: <a href=\"/yarn/\">Yarn</a> and <a href=\"/immutable/\">Immutable.js</a>"
+    "New documentations: <a href=\"/yarn/\">Yarn</a>, <a href=\"/immutable/\">Immutable.js</a> and <a href=\"/async/\">Async</a>"
   ], [
     "2016-10-10",
     "New documentations: <a href=\"/scikit_learn/\">scikit-learn</a> and <a href=\"/statsmodels/\">Statsmodels</a>"

+ 5 - 0
assets/javascripts/templates/pages/about_tmpl.coffee

@@ -99,6 +99,11 @@ credits = [
     '2016 The Apache Software Foundation<br>Apache and the Apache feather logo are trademarks of The Apache Software Foundation.',
     'Apache',
     'https://www.apache.org/licenses/LICENSE-2.0'
+  ], [
+    'Async',
+    '2010-2016 Caolan McMahon',
+    'MIT',
+    'https://raw.githubusercontent.com/caolan/async/master/LICENSE'
   ], [
     'Backbone.js',
     '2010-2016 Jeremy Ashkenas, DocumentCloud',

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

@@ -8,6 +8,7 @@ class app.views.SimplePage extends app.views.BasePage
 
 app.views.AngularPage =
 app.views.AngularjsPage =
+app.views.AsyncPage =
 app.views.BootstrapPage =
 app.views.BowerPage =
 app.views.CPage =

+ 1 - 0
assets/stylesheets/application-dark.css.scss

@@ -34,6 +34,7 @@
         'pages/angular',
         'pages/angularjs',
         'pages/apache',
+        'pages/async',
         'pages/bootstrap',
         'pages/c',
         'pages/cakephp',

+ 1 - 0
assets/stylesheets/application.css.scss

@@ -34,6 +34,7 @@
         'pages/angular',
         'pages/angularjs',
         'pages/apache',
+        'pages/async',
         'pages/bootstrap',
         'pages/c',
         'pages/cakephp',

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

@@ -56,6 +56,7 @@
 %icon-close-white           { background-position: -2rem -5rem; }
 %icon-back                  { background-position: -3rem -5rem; @extend %darkIconFix !optional; }
 
+._icon-async:before         { background-position: -6rem 0; @extend %darkIconFix !optional; }
 ._icon-http:before          { background-position: -7rem 0; @extend %darkIconFix !optional; }
 ._icon-jquery:before        { background-position: -8rem 0; @extend %darkIconFix !optional; }
 ._icon-underscore:before    { background-position: -9rem 0; @extend %darkIconFix !optional; }

+ 15 - 0
assets/stylesheets/pages/_async.scss

@@ -0,0 +1,15 @@
+._async {
+  @extend %simple;
+
+  h3 > .type-signature {
+    float: right;
+    color: $textColorLight;
+  }
+
+  h3 > .signature-attributes {
+    font-size: .75rem;
+    font-weight: normal;
+    font-style: italic;
+    color: $textColorLighter;
+  }
+}

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

@@ -0,0 +1,30 @@
+module Docs
+  class Async
+    class CleanHtmlFilter < Filter
+      def call
+        @doc = at_css('#main-container')
+
+        at_css('footer').remove
+
+        css('section', 'header', 'article', '.container-overview', 'span.signature', 'div.description').each do |node|
+          node.before(node.children).remove
+        end
+
+        css('h3', 'h4', 'h5').each do |node|
+          node.name = node.name.sub(/\d/) { |i| i.to_i - 1 }
+        end
+
+        css('dd ul').each do |node|
+          node.replace(node.css('li').map(&:inner_html).join(' '))
+        end
+
+        css('pre').each do |node|
+          node['data-language'] = 'javascript'
+          node.content = node.content
+        end
+
+        doc
+      end
+    end
+  end
+end

+ 22 - 0
lib/docs/filters/async/entries.rb

@@ -0,0 +1,22 @@
+module Docs
+  class Async
+    class EntriesFilter < Docs::EntriesFilter
+      def additional_entries
+        type = nil
+        entries = []
+
+        css('.nav.methods li').each do |node|
+          if node['class'] == 'toc-header'
+            type = node.content
+          else
+            name = node.content
+            id = node.at_css('a')['href'].remove('#')
+            entries << [name, id, type]
+          end
+        end
+
+        entries
+      end
+    end
+  end
+end

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

@@ -0,0 +1,21 @@
+module Docs
+  class Async < UrlScraper
+    self.type = 'async'
+    self.release = '2.1.2'
+    self.base_url = 'https://caolan.github.io/async/'
+    self.root_path = 'docs.html'
+    self.links = {
+      home: 'https://caolan.github.io/async/',
+      code: 'https://github.com/caolan/async'
+    }
+
+    html_filters.push 'async/entries', 'async/clean_html'
+
+    options[:skip_links] = true
+
+    options[:attribution] = <<-HTML
+      &copy; 2010&ndash;2016 Caolan McMahon<br>
+      Licensed under the MIT License.
+    HTML
+  end
+end

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


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


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

@@ -0,0 +1 @@
+https://raw.githubusercontent.com/caolan/async/master/logo/favicon.ico