Bladeren bron

Add Grunt documentation

Thibaut 11 jaren geleden
bovenliggende
commit
50dfc91721

BIN
assets/images/icons.png


BIN
assets/images/icons@2x.png


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

@@ -125,6 +125,11 @@ credits = [
     'Google, Inc.',
     'CC BY',
     'http://creativecommons.org/licenses/by/3.0/'
+  ], [
+    'Grunt',
+    '2014 Grunt Team',
+    'MIT',
+    'https://raw.githubusercontent.com/gruntjs/gruntjs.com/master/LICENSE'
   ], [
     'HTTP',
     '1999 The Internet Society',

+ 1 - 1
assets/javascripts/templates/pages/news_tmpl.coffee

@@ -25,7 +25,7 @@ newsItem = (date, news) ->
 
 app.news = [
   [ 1399075200000, # May 3, 2014
-    """ New <a href="/express/">Express</a> documentation """,
+    """ New <a href="/express/">Express</a> and <a href="/grunt/">Grunt</a> documentations """,
   ], [
     1396742400000, # April 6, 2014
     """ New <a href="/go/">Go</a> documentation """,

+ 4 - 0
assets/javascripts/views/pages/grunt.coffee

@@ -0,0 +1,4 @@
+#= require views/pages/base
+#= require views/pages/underscore
+
+app.views.GruntPage = app.views.UnderscorePage

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

@@ -38,6 +38,7 @@
         'pages/jquery',
         'pages/knockout',
         'pages/git',
+        'pages/grunt',
         'pages/less',
         'pages/lodash',
         'pages/mdn',

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

@@ -54,3 +54,4 @@
 ._icon-cpp:before           { background-position: 0 -8rem; }
 ._icon-go:before            { background-position: -1rem -8rem; }
 ._icon-express:before       { background-position: -2rem -8rem; }
+._icon-grunt:before         { background-position: -3rem -8rem; }

+ 8 - 0
assets/stylesheets/pages/_grunt.scss

@@ -0,0 +1,8 @@
+._grunt {
+  padding-left: 1rem;
+
+  h1, h2, h3 { margin-left: -1rem; }
+  h2 { @extend %block-heading; }
+  h3 { @extend %block-label, %label-blue; }
+  p > code { @extend %label; }
+}

+ 28 - 0
lib/docs/filters/grunt/clean_html.rb

@@ -0,0 +1,28 @@
+module Docs
+  class Grunt
+    class CleanHtmlFilter < Filter
+      def call
+        @doc = at_css('.hero-unit')
+
+        if root_page?
+          at_css('h1').content = 'Grunt'
+        end
+
+        css('.end-link').remove
+
+        # Put id attributes on headings
+        css('a.anchor').each do |node|
+          node.parent['id'] = node['name']
+          node.before(node.children).remove
+        end
+
+        # Remove code highlighting
+        css('pre').each do |node|
+          node.content = node.content
+        end
+
+        doc
+      end
+    end
+  end
+end

+ 34 - 0
lib/docs/filters/grunt/entries.rb

@@ -0,0 +1,34 @@
+module Docs
+  class Grunt
+    class EntriesFilter < Docs::EntriesFilter
+      def get_name
+        at_css('h1').content
+      end
+
+      def get_type
+        if name.starts_with?('grunt') || name == 'Inside Tasks'
+          name
+        else
+          'Miscellaneous'
+        end
+      end
+
+      def additional_entries
+        return [] unless subpath.starts_with?('api')
+
+        css('h3').each_with_object [] do |node, entries|
+          name = node.content
+          name.remove! %r{\s.+\z}
+
+          next if name == self.name
+
+          entries << [name, node['id']]
+        end
+      end
+
+      def include_default_entry?
+        name != 'Inside Tasks'
+      end
+    end
+  end
+end

+ 27 - 0
lib/docs/scrapers/grunt.rb

@@ -0,0 +1,27 @@
+module Docs
+  class Grunt < UrlScraper
+    self.name = 'Grunt'
+    self.type = 'grunt'
+    self.version = '0.4.4'
+    self.base_url = 'http://gruntjs.com/'
+    self.root_path = 'getting-started'
+    self.initial_paths = %w(api/grunt)
+
+    html_filters.push 'grunt/clean_html', 'grunt/entries'
+
+    options[:only] = %w(
+      configuring-tasks
+      sample-gruntfile
+      creating-tasks
+      using-the-cli
+    )
+    options[:only_patterns] = [/\Aapi\//]
+
+    options[:container] = '.container > .row-fluid'
+
+    options[:attribution] = <<-HTML
+      &copy; 2014 Grunt Team<br>
+      Licensed under the MIT License.
+    HTML
+  end
+end

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


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


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

@@ -0,0 +1 @@
+https://github.com/gruntjs/gruntjs.com/tree/master/src/img