1
0
Thibaut 12 жил өмнө
parent
commit
836a9ea8bf

BIN
assets/images/icons.png


BIN
assets/images/icons@2x.png


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

@@ -148,6 +148,11 @@ credits = [
     '1990-2013 Python Software Foundation<br>Python is a trademark of the Python Software Foundation.',
     'PSFL',
     'http://docs.python.org/3/license.html'
+  ], [
+    'Redis',
+    '2006-2013 Salvatore Sanfilippo and others',
+    'BSD',
+    'https://raw.github.com/antirez/redis/unstable/COPYING'
   ], [
     'Ruby',
     '1993-2013 Yukihiro Matsumoto',

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

@@ -25,7 +25,7 @@ newsItem = (date, news) ->
 
 app.news = [
   [ 1386892800000, # December 13, 2013
-    """ New <a href="/git/">Git</a> documentation """
+    """ New <a href="/git/">Git</a> and <a href="/git/">Redis</a> documentations """
   ], [
     1385424000000, # November 26, 2013
     """ New <a href="/python/">Python</a> documentation """

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

@@ -38,6 +38,7 @@
         'pages/node',
         'pages/php',
         'pages/rdoc',
+        'pages/redis',
         'pages/rfc',
         'pages/sphinx',
         'pages/underscore',

+ 2 - 2
assets/stylesheets/global/_base.scss

@@ -87,7 +87,7 @@ abbr, acronym, dfn {
   border-bottom: 1px dotted $textColor;
 }
 
-pre, code, samp {
+pre, code, samp, %pre {
   font-family: $monoFont;
   font-weight: normal;
   font-style: normal;
@@ -98,7 +98,7 @@ pre, code, samp {
        tab-size: 2;
 }
 
-pre {
+pre, %pre {
   margin: 1.5em 0;
   padding: .375rem .75rem;
   line-height: 1.5;

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

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

+ 44 - 0
assets/stylesheets/pages/_redis.scss

@@ -0,0 +1,44 @@
+._redis {
+  // Index
+
+  > .commands {
+    padding-left: 0;
+    list-style: none;
+
+    > li { margin-bottom: 1em; }
+  }
+
+  .command, .summary { display: block; }
+
+  .args {
+    font-size: .75rem;
+    color: $textColorLight;
+  }
+
+  // Others
+
+  > h2 { @extend %block-heading; }
+  p > code { @extend %label; }
+
+  > .metadata { @extend %note, %note-green; }
+  > .metadata > p { margin: 0; }
+
+  > .example {
+    white-space: normal;
+    @extend %pre;
+
+    > .prompt {
+      float: left;
+      margin-right: .5em;
+      color: $textColorLight;
+    }
+
+    > code {
+      display: block;
+      clear: left;
+      margin-bottom: .5em;
+
+      &:last-child { margin-bottom: 0; }
+    }
+  }
+}

+ 21 - 0
lib/docs/filters/redis/clean_html.rb

@@ -0,0 +1,21 @@
+module Docs
+  class Redis
+    class CleanHtmlFilter < Filter
+      def call
+        at_css('ul')['class'] = 'commands' if root_page?
+
+        css('nav', 'aside', 'form').remove
+
+        css('> article', 'pre > code').each do |node|
+          node.before(node.children).remove
+        end
+
+        css('.example > pre').each do |node|
+          node.name = 'code'
+        end
+
+        doc
+      end
+    end
+  end
+end

+ 26 - 0
lib/docs/filters/redis/entries.rb

@@ -0,0 +1,26 @@
+module Docs
+  class Redis
+    class EntriesFilter < Docs::EntriesFilter
+      def get_name
+        slug.gsub('-', ' ')
+      end
+
+      def get_type
+        case at_css('aside > ul:last-child a').content.strip
+        when 'DEL'          then 'Keys'
+        when 'APPEND'       then 'Strings'
+        when 'HDEL'         then 'Hashes'
+        when 'BLPOP'        then 'Lists'
+        when 'SADD'         then 'Sets'
+        when 'ZADD'         then 'Sorted Sets'
+        when 'PSUBSCRIBE'   then 'Pub/Sub'
+        when 'DISCARD'      then 'Transactions'
+        when 'EVAL'         then 'Scripting'
+        when 'AUTH'         then 'Connection'
+        when 'BGREWRITEAOF' then 'Server'
+        else 'Miscellaneous'
+        end
+      end
+    end
+  end
+end

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

@@ -0,0 +1,19 @@
+module Docs
+  class Redis < UrlScraper
+    self.type = 'redis'
+    self.version = 'up to 2.8.3'
+    self.base_url = 'http://redis.io/commands'
+
+    html_filters.push 'redis/entries', 'redis/clean_html', 'title'
+
+    options[:container] = ->(filter) { filter.root_page? ? '#commands' : '.text' }
+    options[:title] = false
+    options[:root_title] = 'Redis'
+    options[:follow_links] = ->(filter) { filter.root_page? }
+
+    options[:attribution] = <<-HTML
+      &copy; 2006&ndash;2013 Salvatore Sanfilippo and others<br>
+      Licensed under the three clause BSD license.
+    HTML
+  end
+end

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


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


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

@@ -0,0 +1 @@
+http://redis.io/documentation