Explorar el Código

Add Git documentation

Thibaut hace 12 años
padre
commit
0f08f25b42

BIN
assets/images/icons.png


BIN
assets/images/icons@2x.png


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

@@ -98,6 +98,11 @@ credits = [
     '2013 Yehuda Katz, Tom Dale and Ember.js contributors',
     'MIT',
     'https://raw.github.com/emberjs/ember.js/master/LICENSE'
+  ], [
+    'Git',
+    '2005-2013 Linus Torvalds and others',
+    'GPLv2',
+    'https://raw.github.com/git/git/master/COPYING'
   ], [
     'HTTP',
     '1999 The Internet Society',

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

@@ -24,7 +24,10 @@ newsItem = (date, news) ->
   result
 
 app.news = [
-  [ 1385424000000, # November 26, 2013
+  [ 1386892800000, # December 13, 2013
+    """ New <a href="/git/">Git</a> documentation """
+  ], [
+    1385424000000, # November 26, 2013
     """ New <a href="/python/">Python</a> documentation """
   ], [
     1384819200000, # November 19, 2013

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

@@ -31,6 +31,7 @@
         'pages/coffeescript',
         'pages/ember',
         'pages/jquery',
+        'pages/git',
         'pages/less',
         'pages/lodash',
         'pages/mdn',

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

@@ -42,3 +42,4 @@
 ._icon-ruby:before          { background-position: -3rem -5rem; }
 ._icon-rails:before         { background-position: -4rem -5rem; }
 ._icon-python:before        { background-position: 0 -6rem; }
+._icon-git:before           { background-position: -1rem -6rem; }

+ 7 - 0
assets/stylesheets/pages/_git.scss

@@ -0,0 +1,7 @@
+._git {
+  > h2 { @extend %block-heading; }
+  h3 { font-size: 1rem; }
+  > .callout, > h1 + .sectionbody { @extend %note, %note-green; }
+  code { @extend %label; }
+  em { font-style: normal; }
+}

+ 40 - 0
lib/docs/filters/git/clean_html.rb

@@ -0,0 +1,40 @@
+module Docs
+  class Git
+    class CleanHtmlFilter < Filter
+      def call
+        root_page? ? root : other
+        doc
+      end
+
+      def root
+        at_css('h1').content = 'Git'
+      end
+
+      def other
+        css('h1 + h2', '#_git + div', '#_git').remove
+
+        css('> div', 'pre > tt', 'pre > em', 'div.paragraph').each do |node|
+          node.before(node.children).remove
+        end
+
+        css('> h1').each do |node|
+          node.content = node.content.sub(/\(\d\) Manual Page/, '')
+        end
+
+        unless at_css('> h2')
+          css('> h3').each do |node|
+            node.name = 'h2'
+          end
+        end
+
+        css('h2').each do |node|
+          node.content = node.content.capitalize
+        end
+
+        css('tt', 'p > em').each do |node|
+          node.name = 'code'
+        end
+      end
+    end
+  end
+end

+ 9 - 0
lib/docs/filters/git/entries.rb

@@ -0,0 +1,9 @@
+module Docs
+  class Git
+    class EntriesFilter < Docs::EntriesFilter
+      def get_name
+        slug.sub '-', ' '
+      end
+    end
+  end
+end

+ 19 - 0
lib/docs/scrapers/git.rb

@@ -0,0 +1,19 @@
+module Docs
+  class Git < UrlScraper
+    self.type = 'git'
+    self.version = '1.8.5'
+    self.base_url = 'http://git-scm.com/docs'
+    self.initial_paths = %w(/git.html)
+
+    html_filters.push 'git/clean_html', 'git/entries'
+
+    options[:container] = ->(filter) { filter.root_page? ? '#main' : '.man-page' }
+    options[:follow_links] = ->(filter) { filter.root_page? }
+    options[:only_patterns] = [/\A\/git\-/]
+
+    options[:attribution] = <<-HTML
+      &copy; 2005&ndash;2013 Linus Torvalds and others<br>
+      Licensed under the GNU General Public License version 2.
+    HTML
+  end
+end

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


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


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

@@ -0,0 +1 @@
+http://git-scm.com/downloads/logos