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
1717 'Profiler__' => 'Profiler',
1818 'Psych' => 'YAML',
1919 'Rinda' => 'DRb',
20+ 'SimpleDelegator' => 'Delegator',
21+ 'SingleForwardable' => 'Forwardable',
2022 'SortedSet' => 'Set',
2123 'TCPServer' => 'Socket',
2224 'TempIO' => 'Tempfile',
@@ -35,6 +37,9 @@ module Docs · 12 unmodified lines
3537 'Socket' => 'Socket' }
3638
3739 def get_type
40+ return 'Language' if guide?
41+ return $1 if name =~ /\A(Net\:\:(?:FTP|HTTP|IMAP|SMTP))/
42+
3843 type = super
3944
4045 REPLACE_TYPE_STARTS_WITH.each_pair do |key, value|
@@ -47,6 +52,32 @@ module Docs · 6 unmodified lines
4752
4853 REPLACE_TYPE[type] || type
4954 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
5081 end
5182 end
5283 end
lib/docs/scrapers/rdoc/ruby.rb+30−32
@@ -1,59 +1,56 @@
11 module Docs
22 class Ruby < Rdoc
33 # Generated with:
4− # find \
5− # *.c \
6− # lib \
7− # ext/bigdecimal \
8− # ext/date \
9− # ext/digest \
10− # ext/json \
11− # ext/pathname \
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
4+ # rdoc \
5+ # --root . \
6+ # --page-dir doc \
7+ # --encoding=UTF-8 \
8+ # --visibility=public \
9+ # --format=darkfish \
10+ # --no-line-numbers \
11+ # --op html .
2212
23− self.version = '2.1.3'
13+ self.version = '2.2.0'
2414 self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Ruby'
2515
2616 html_filters.replace 'rdoc/entries', 'ruby/entries'
2717
2818 options[:root_title] = 'Ruby Programming Language'
19+ options[:title] = ->(filter) { filter.slug == 'globals_rdoc' ? 'Globals' : false }
2920
3021 options[:skip] += %w(
31− fatal.html
32− CompositePublisher.html
22+ contributing_rdoc.html
23+ 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
3329 Data.html
34− E2MM.html
3530 English.html
36− GServer.html
37− MakeMakefile.html
38− ParallelEach.html
39− SshDirPublisher.html
40− SshFilePublisher.html
41− SshFreshDirPublisher.html
42− YAML/DBM.html)
31+ Fcntl.html
32+ Kconv.html
33+ NKF.html
34+ OLEProperty.html
35+ OptParse.html
36+ UnicodeNormalize.html)
4337
44− options[:skip_patterns] = [
45− /\AComplex/,
38+ options[:skip_patterns] += [
39+ /\Alib\//,
40+ /\ADEBUGGER__/,
4641 /\AException2MessageMapper/,
4742 /\AJSON\/Ext/,
4843 /\AGem/,
4944 /\AHTTP/i,
5045 /\AIRB/,
46+ /\AMakeMakefile/i,
5147 /\AMiniTest/i,
52− /\ANet\/(?!HTTP)/,
5348 /\ANQXML/,
5449 /\AOpenSSL/,
5550 /\AOptionParser\//,
51+ /\APrettyPrint/,
5652 /\APride/,
53+ /\AProfiler__/,
5754 /\APsych\//,
5855 /\ARacc/,
5956 /\ARake/,
@@ -65,6 +62,7 @@ module Docs · 5 unmodified lines
6562 /\ASocket\//,
6663 /\ATest/,
6764 /\AWEBrick/,
65+ /win32/i,
6866 /\AXML/,
6967 /\AXMP/]
7068