History

Update and improve Ruby documentation (2.2.0)

Thibaut committed 11 years ago

Commit 38b16ed1 parent b58bc8b2 files · +61 −32Browse files

Unified · Split

2 files
  1. lib/docs/filters/ruby/entries.rb +31 −0
  2. lib/docs/scrapers/rdoc/ruby.rb +30 −32
lib/docs/filters/ruby/entries.rb+31−0
@@ -17,6 +17,8 @@ module Docs · 16 unmodified lines
17 'Profiler__' => 'Profiler',17 'Profiler__' => 'Profiler',
18 'Psych' => 'YAML',18 'Psych' => 'YAML',
19 'Rinda' => 'DRb',19 'Rinda' => 'DRb',
20 'SimpleDelegator' => 'Delegator',
21 'SingleForwardable' => 'Forwardable',
20 'SortedSet' => 'Set',22 'SortedSet' => 'Set',
21 'TCPServer' => 'Socket',23 'TCPServer' => 'Socket',
22 'TempIO' => 'Tempfile',24 'TempIO' => 'Tempfile',
@@ -35,6 +37,9 @@ module Docs · 12 unmodified lines
35 'Socket' => 'Socket' }37 'Socket' => 'Socket' }
36 38
37 def get_type39 def get_type
40 return 'Language' if guide?
41 return $1 if name =~ /\A(Net\:\:(?:FTP|HTTP|IMAP|SMTP))/
42
38 type = super43 type = super
39 44
40 REPLACE_TYPE_STARTS_WITH.each_pair do |key, value|45 REPLACE_TYPE_STARTS_WITH.each_pair do |key, value|
@@ -47,6 +52,32 @@ module Docs · 6 unmodified lines
47 52
48 REPLACE_TYPE[type] || type53 REPLACE_TYPE[type] || type
49 end54 end
55
56 def additional_entries
57 return super unless guide?
58
59 if slug == 'syntax/control_expressions_rdoc' || slug == 'syntax/miscellaneous_rdoc'
60 css('h2 > code').each_with_object([]) do |node, entries|
61 name = node.content.strip
62 entries << [name, node.parent['id'], 'Syntax'] unless entries.any? { |e| e[0] == name }
63 end
64 elsif slug == 'globals_rdoc'
65 css('dt').map do |node|
66 name = node['id'] = node.content.strip
67 [name, name, 'Globals']
68 end
69 else
70 []
71 end
72 end
73
74 def include_default_entry?
75 guide? || super
76 end
77
78 def guide?
79 slug =~ /[^\/]+_rdoc/
80 end
50 end81 end
51 end82 end
52end83end
lib/docs/scrapers/rdoc/ruby.rb+30−32
@@ -1,59 +1,56 @@
1module Docs1module Docs
2 class Ruby < Rdoc2 class Ruby < Rdoc
3 # Generated with:3 # Generated with:
4 # find \4 # rdoc \
5 # *.c \5 # --root . \
6 # lib \6 # --page-dir doc \
7 # ext/bigdecimal \7 # --encoding=UTF-8 \
8 # ext/date \8 # --visibility=public \
9 # ext/digest \9 # --format=darkfish \
10 # ext/json \10 # --no-line-numbers \
11 # ext/pathname \11 # --op html .
12 # ext/psych \
13 # ext/readline \
14 # ext/ripper \
15 # ext/socket \
16 # ext/stringio \
17 # ext/zlib \
18 # \( -name '*.c' -or -name '*.rb' \) \
19 # -not -wholename '*sample/*' \
20 # | xargs \
21 # rdoc --format=darkfish --no-line-numbers --op=rdoc --visibility=public
22 12
23 self.version = '2.1.3'13 self.version = '2.2.0'
24 self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby'14 self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby'
25 15
26 html_filters.replace 'rdoc/entries', 'ruby/entries'16 html_filters.replace 'rdoc/entries', 'ruby/entries'
27 17
28 options[:root_title] = 'Ruby Programming Language'18 options[:root_title] = 'Ruby Programming Language'
19 options[:title] = ->(filter) { filter.slug == 'globals_rdoc' ? 'Globals' : false }
29 20
30 options[:skip] += %w(21 options[:skip] += %w(
31 fatal.html22 contributing_rdoc.html
32 CompositePublisher.html23 contributors_rdoc.html
24 dtrace_probes_rdoc.html
25 maintainers_rdoc.html
26 regexp_rdoc.html
27 standard_library_rdoc.html
28 syntax_rdoc.html
33 Data.html29 Data.html
34 E2MM.html
35 English.html30 English.html
36 GServer.html31 Fcntl.html
37 MakeMakefile.html32 Kconv.html
38 ParallelEach.html33 NKF.html
39 SshDirPublisher.html34 OLEProperty.html
40 SshFilePublisher.html35 OptParse.html
41 SshFreshDirPublisher.html36 UnicodeNormalize.html)
42 YAML/DBM.html)
43 37
44 options[:skip_patterns] = [38 options[:skip_patterns] += [
45 /\AComplex/,39 /\Alib\//,
40 /\ADEBUGGER__/,
46 /\AException2MessageMapper/,41 /\AException2MessageMapper/,
47 /\AJSON\/Ext/,42 /\AJSON\/Ext/,
48 /\AGem/,43 /\AGem/,
49 /\AHTTP/i,44 /\AHTTP/i,
50 /\AIRB/,45 /\AIRB/,
46 /\AMakeMakefile/i,
51 /\AMiniTest/i,47 /\AMiniTest/i,
52 /\ANet\/(?!HTTP)/,
53 /\ANQXML/,48 /\ANQXML/,
54 /\AOpenSSL/,49 /\AOpenSSL/,
55 /\AOptionParser\//,50 /\AOptionParser\//,
51 /\APrettyPrint/,
56 /\APride/,52 /\APride/,
53 /\AProfiler__/,
57 /\APsych\//,54 /\APsych\//,
58 /\ARacc/,55 /\ARacc/,
59 /\ARake/,56 /\ARake/,
@@ -65,6 +62,7 @@ module Docs · 5 unmodified lines
65 /\ASocket\//,62 /\ASocket\//,
66 /\ATest/,63 /\ATest/,
67 /\AWEBrick/,64 /\AWEBrick/,
65 /win32/i,
68 /\AXML/,66 /\AXML/,
69 /\AXMP/]67 /\AXMP/]
70 68