Sfoglia il codice sorgente

Update and improve Ruby documentation (2.2.0)

Thibaut 11 anni fa
parent
commit
38b16ed87a
2 ha cambiato i file con 61 aggiunte e 32 eliminazioni
  1. 31 0
      lib/docs/filters/ruby/entries.rb
  2. 30 32
      lib/docs/scrapers/rdoc/ruby.rb

+ 31 - 0
lib/docs/filters/ruby/entries.rb

@@ -17,6 +17,8 @@ module Docs
         'Profiler__'        => 'Profiler',
         'Psych'             => 'YAML',
         'Rinda'             => 'DRb',
+        'SimpleDelegator'   => 'Delegator',
+        'SingleForwardable' => 'Forwardable',
         'SortedSet'         => 'Set',
         'TCPServer'         => 'Socket',
         'TempIO'            => 'Tempfile',
@@ -35,6 +37,9 @@ module Docs
         'Socket' => 'Socket' }
 
       def get_type
+        return 'Language' if guide?
+        return $1 if name =~ /\A(Net\:\:(?:FTP|HTTP|IMAP|SMTP))/
+
         type = super
 
         REPLACE_TYPE_STARTS_WITH.each_pair do |key, value|
@@ -47,6 +52,32 @@ module Docs
 
         REPLACE_TYPE[type] || type
       end
+
+      def additional_entries
+        return super unless guide?
+
+        if slug == 'syntax/control_expressions_rdoc' || slug == 'syntax/miscellaneous_rdoc'
+          css('h2 > code').each_with_object([]) do |node, entries|
+            name = node.content.strip
+            entries << [name, node.parent['id'], 'Syntax'] unless entries.any? { |e| e[0] == name }
+          end
+        elsif slug == 'globals_rdoc'
+          css('dt').map do |node|
+            name = node['id'] = node.content.strip
+            [name, name, 'Globals']
+          end
+        else
+          []
+        end
+      end
+
+      def include_default_entry?
+        guide? || super
+      end
+
+      def guide?
+        slug =~ /[^\/]+_rdoc/
+      end
     end
   end
 end

+ 30 - 32
lib/docs/scrapers/rdoc/ruby.rb

@@ -1,59 +1,56 @@
 module Docs
   class Ruby < Rdoc
     # Generated with:
-    # find \
-    #   *.c \
-    #   lib \
-    #   ext/bigdecimal \
-    #   ext/date \
-    #   ext/digest \
-    #   ext/json \
-    #   ext/pathname \
-    #   ext/psych \
-    #   ext/readline \
-    #   ext/ripper \
-    #   ext/socket \
-    #   ext/stringio \
-    #   ext/zlib \
-    #   \( -name '*.c' -or -name '*.rb' \) \
-    #   -not -wholename '*sample/*' \
-    # | xargs \
-    #   rdoc --format=darkfish --no-line-numbers --op=rdoc --visibility=public
+    # rdoc \
+    #   --root . \
+    #   --page-dir doc \
+    #   --encoding=UTF-8 \
+    #   --visibility=public \
+    #   --format=darkfish \
+    #   --no-line-numbers \
+    #   --op html .
 
-    self.version = '2.1.3'
+    self.version = '2.2.0'
     self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby'
 
     html_filters.replace 'rdoc/entries', 'ruby/entries'
 
     options[:root_title] = 'Ruby Programming Language'
+    options[:title] = ->(filter) { filter.slug == 'globals_rdoc' ? 'Globals' : false }
 
     options[:skip] += %w(
-      fatal.html
-      CompositePublisher.html
+      contributing_rdoc.html
+      contributors_rdoc.html
+      dtrace_probes_rdoc.html
+      maintainers_rdoc.html
+      regexp_rdoc.html
+      standard_library_rdoc.html
+      syntax_rdoc.html
       Data.html
-      E2MM.html
       English.html
-      GServer.html
-      MakeMakefile.html
-      ParallelEach.html
-      SshDirPublisher.html
-      SshFilePublisher.html
-      SshFreshDirPublisher.html
-      YAML/DBM.html)
+      Fcntl.html
+      Kconv.html
+      NKF.html
+      OLEProperty.html
+      OptParse.html
+      UnicodeNormalize.html)
 
-    options[:skip_patterns] = [
-      /\AComplex/,
+    options[:skip_patterns] += [
+      /\Alib\//,
+      /\ADEBUGGER__/,
       /\AException2MessageMapper/,
       /\AJSON\/Ext/,
       /\AGem/,
       /\AHTTP/i,
       /\AIRB/,
+      /\AMakeMakefile/i,
       /\AMiniTest/i,
-      /\ANet\/(?!HTTP)/,
       /\ANQXML/,
       /\AOpenSSL/,
       /\AOptionParser\//,
+      /\APrettyPrint/,
       /\APride/,
+      /\AProfiler__/,
       /\APsych\//,
       /\ARacc/,
       /\ARake/,
@@ -65,6 +62,7 @@ module Docs
       /\ASocket\//,
       /\ATest/,
       /\AWEBrick/,
+      /win32/i,
       /\AXML/,
       /\AXMP/]