rdoc 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rdoc might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/.autotest +14 -0
- data/History.txt +27 -0
- data/Manifest.txt +29 -9
- data/Rakefile +2 -0
- data/bin/rdoc +13 -2
- data/lib/rdoc.rb +11 -3
- data/lib/rdoc/alias.rb +54 -0
- data/lib/rdoc/anon_class.rb +10 -0
- data/lib/rdoc/any_method.rb +190 -0
- data/lib/rdoc/attr.rb +79 -0
- data/lib/rdoc/cache.rb +11 -2
- data/lib/rdoc/class_module.rb +87 -0
- data/lib/rdoc/code_object.rb +152 -0
- data/lib/rdoc/code_objects.rb +18 -1118
- data/lib/rdoc/constant.rb +36 -0
- data/lib/rdoc/context.rb +712 -0
- data/lib/rdoc/diagram.rb +8 -8
- data/lib/rdoc/generator.rb +3 -1140
- data/lib/rdoc/generator/darkfish.rb +107 -133
- data/lib/rdoc/generator/markup.rb +194 -0
- data/lib/rdoc/generator/ri.rb +4 -2
- data/lib/rdoc/generator/template/darkfish/classpage.rhtml +92 -113
- data/lib/rdoc/generator/template/darkfish/filepage.rhtml +33 -35
- data/lib/rdoc/generator/template/darkfish/index.rhtml +22 -15
- data/lib/rdoc/ghost_method.rb +8 -0
- data/lib/rdoc/include.rb +39 -0
- data/lib/rdoc/markup/attribute_manager.rb +46 -0
- data/lib/rdoc/markup/formatter.rb +11 -0
- data/lib/rdoc/markup/fragments.rb +42 -2
- data/lib/rdoc/markup/inline.rb +29 -4
- data/lib/rdoc/markup/lines.rb +4 -0
- data/lib/rdoc/markup/preprocess.rb +4 -0
- data/lib/rdoc/markup/to_flow.rb +27 -1
- data/lib/rdoc/markup/to_html.rb +33 -33
- data/lib/rdoc/markup/to_html_crossref.rb +4 -11
- data/lib/rdoc/markup/to_latex.rb +31 -31
- data/lib/rdoc/markup/to_test.rb +3 -0
- data/lib/rdoc/markup/to_texinfo.rb +18 -14
- data/lib/rdoc/meta_method.rb +8 -0
- data/lib/rdoc/normal_class.rb +18 -0
- data/lib/rdoc/normal_module.rb +34 -0
- data/lib/rdoc/options.rb +26 -159
- data/lib/rdoc/parser/c.rb +16 -8
- data/lib/rdoc/parser/ruby.rb +16 -10
- data/lib/rdoc/parser/simple.rb +1 -1
- data/lib/rdoc/rdoc.rb +50 -34
- data/lib/rdoc/require.rb +32 -0
- data/lib/rdoc/ri/descriptions.rb +1 -1
- data/lib/rdoc/ri/driver.rb +4 -4
- data/lib/rdoc/ri/formatter.rb +70 -32
- data/lib/rdoc/single_class.rb +8 -0
- data/lib/rdoc/top_level.rb +232 -0
- data/test/test_rdoc_any_method.rb +10 -0
- data/test/test_rdoc_code_object.rb +80 -0
- data/test/test_rdoc_constant.rb +15 -0
- data/test/test_rdoc_context.rb +250 -0
- data/test/test_rdoc_include.rb +17 -0
- data/test/test_rdoc_markup.rb +13 -2
- data/test/test_rdoc_markup_to_html.rb +22 -0
- data/test/test_rdoc_markup_to_html_crossref.rb +50 -115
- data/test/test_rdoc_normal_module.rb +26 -0
- data/test/test_rdoc_parser_c.rb +33 -0
- data/test/test_rdoc_parser_ruby.rb +54 -36
- data/test/test_rdoc_require.rb +25 -0
- data/test/test_rdoc_ri_default_display.rb +2 -1
- data/test/test_rdoc_ri_html_formatter.rb +141 -0
- data/test/test_rdoc_top_level.rb +85 -0
- data/test/xref_data.rb +46 -0
- data/test/xref_test_case.rb +48 -0
- metadata +42 -13
- metadata.gz.sig +0 -0
- data/lib/rdoc/generator/html.rb +0 -456
- data/lib/rdoc/generator/html/common.rb +0 -24
- data/lib/rdoc/generator/html/html.rb +0 -769
- data/lib/rdoc/generator/html/one_page_html.rb +0 -122
- data/lib/rdoc/generator/xml.rb +0 -124
- data/lib/rdoc/generator/xml/rdf.rb +0 -113
- data/lib/rdoc/generator/xml/xml.rb +0 -123
- data/lib/rdoc/parser/f95.rb +0 -1835
- data/lib/rdoc/template.rb +0 -68
data/lib/rdoc/markup/lines.rb
CHANGED
@@ -7,6 +7,10 @@ require 'rdoc/markup'
|
|
7
7
|
|
8
8
|
class RDoc::Markup::PreProcess
|
9
9
|
|
10
|
+
##
|
11
|
+
# Creates a new pre-processor for +input_file_name+ that will look for
|
12
|
+
# included files in +include_path+
|
13
|
+
|
10
14
|
def initialize(input_file_name, include_path)
|
11
15
|
@input_file_name = input_file_name
|
12
16
|
@include_path = include_path
|
data/lib/rdoc/markup/to_flow.rb
CHANGED
@@ -6,9 +6,25 @@ require 'cgi'
|
|
6
6
|
class RDoc::Markup
|
7
7
|
|
8
8
|
module Flow
|
9
|
+
|
10
|
+
##
|
11
|
+
# Paragraph
|
12
|
+
|
9
13
|
P = Struct.new(:body)
|
14
|
+
|
15
|
+
##
|
16
|
+
# Verbatim
|
17
|
+
|
10
18
|
VERB = Struct.new(:body)
|
19
|
+
|
20
|
+
##
|
21
|
+
# Horizontal rule
|
22
|
+
|
11
23
|
RULE = Struct.new(:width)
|
24
|
+
|
25
|
+
##
|
26
|
+
# List
|
27
|
+
|
12
28
|
class LIST
|
13
29
|
attr_reader :type, :contents
|
14
30
|
def initialize(type)
|
@@ -19,11 +35,21 @@ class RDoc::Markup
|
|
19
35
|
@contents << stuff
|
20
36
|
end
|
21
37
|
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# List item
|
41
|
+
|
22
42
|
LI = Struct.new(:label, :body)
|
43
|
+
|
44
|
+
##
|
45
|
+
# Heading
|
46
|
+
|
23
47
|
H = Struct.new(:level, :text)
|
48
|
+
|
24
49
|
end
|
25
50
|
|
26
51
|
class ToFlow < RDoc::Markup::Formatter
|
52
|
+
|
27
53
|
LIST_TYPE_TO_HTML = {
|
28
54
|
:BULLET => [ "<ul>", "</ul>" ],
|
29
55
|
:NUMBER => [ "<ol>", "</ol>" ],
|
@@ -70,7 +96,7 @@ class RDoc::Markup
|
|
70
96
|
end
|
71
97
|
|
72
98
|
##
|
73
|
-
#
|
99
|
+
# :section: Visitor
|
74
100
|
|
75
101
|
def start_accepting
|
76
102
|
@res = []
|
data/lib/rdoc/markup/to_html.rb
CHANGED
@@ -116,14 +116,14 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|
116
116
|
end
|
117
117
|
|
118
118
|
##
|
119
|
-
# are we currently inside
|
119
|
+
# are we currently inside tt tags?
|
120
120
|
|
121
121
|
def in_tt?
|
122
122
|
@in_tt > 0
|
123
123
|
end
|
124
124
|
|
125
125
|
##
|
126
|
-
# is +tag+ a
|
126
|
+
# is +tag+ a tt tag?
|
127
127
|
|
128
128
|
def tt?(tag)
|
129
129
|
tag.bit == @tt_bit
|
@@ -158,7 +158,37 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|
158
158
|
end
|
159
159
|
|
160
160
|
##
|
161
|
-
#
|
161
|
+
# This is a higher speed (if messier) version of wrap
|
162
|
+
|
163
|
+
def wrap(txt, line_len = 76)
|
164
|
+
res = ""
|
165
|
+
sp = 0
|
166
|
+
ep = txt.length
|
167
|
+
while sp < ep
|
168
|
+
# scan back for a space
|
169
|
+
p = sp + line_len - 1
|
170
|
+
if p >= ep
|
171
|
+
p = ep
|
172
|
+
else
|
173
|
+
while p > sp and txt[p] != ?\s
|
174
|
+
p -= 1
|
175
|
+
end
|
176
|
+
if p <= sp
|
177
|
+
p = sp + line_len
|
178
|
+
while p < ep and txt[p] != ?\s
|
179
|
+
p += 1
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
res << txt[sp...p] << "\n"
|
184
|
+
sp = p
|
185
|
+
sp += 1 while sp < ep and txt[sp] == ?\s
|
186
|
+
end
|
187
|
+
res
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# :section: Visitor
|
162
192
|
|
163
193
|
def start_accepting
|
164
194
|
@res = ""
|
@@ -219,36 +249,6 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|
219
249
|
@res << convert_heading(fragment.head_level, am.flow(fragment.txt))
|
220
250
|
end
|
221
251
|
|
222
|
-
##
|
223
|
-
# This is a higher speed (if messier) version of wrap
|
224
|
-
|
225
|
-
def wrap(txt, line_len = 76)
|
226
|
-
res = ""
|
227
|
-
sp = 0
|
228
|
-
ep = txt.length
|
229
|
-
while sp < ep
|
230
|
-
# scan back for a space
|
231
|
-
p = sp + line_len - 1
|
232
|
-
if p >= ep
|
233
|
-
p = ep
|
234
|
-
else
|
235
|
-
while p > sp and txt[p] != ?\s
|
236
|
-
p -= 1
|
237
|
-
end
|
238
|
-
if p <= sp
|
239
|
-
p = sp + line_len
|
240
|
-
while p < ep and txt[p] != ?\s
|
241
|
-
p += 1
|
242
|
-
end
|
243
|
-
end
|
244
|
-
end
|
245
|
-
res << txt[sp...p] << "\n"
|
246
|
-
sp = p
|
247
|
-
sp += 1 while sp < ep and txt[sp] == ?\s
|
248
|
-
end
|
249
|
-
res
|
250
|
-
end
|
251
|
-
|
252
252
|
private
|
253
253
|
|
254
254
|
def on_tags(res, item)
|
@@ -1,9 +1,8 @@
|
|
1
1
|
require 'rdoc/markup/to_html'
|
2
2
|
|
3
3
|
##
|
4
|
-
# Subclass of the RDoc::Markup::ToHtml class that supports looking up words
|
5
|
-
#
|
6
|
-
# comment) will be hyperlinked
|
4
|
+
# Subclass of the RDoc::Markup::ToHtml class that supports looking up words
|
5
|
+
# from a context. Those that are found will be hyperlinked.
|
7
6
|
|
8
7
|
class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
9
8
|
|
@@ -14,12 +13,6 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
|
14
13
|
# 2) There can be a '::' in front of class names to reference from the
|
15
14
|
# top-level namespace.
|
16
15
|
# 3) The method can be followed by parenthesis which may
|
17
|
-
#
|
18
|
-
# NOTE: In order to support Fortran 95 properly, the [A-Z] below
|
19
|
-
# should be changed to [A-Za-z]. This slows down rdoc significantly,
|
20
|
-
# however, and the Fortran 95 support is broken in any case due to
|
21
|
-
# the return in handle_special_CROSSREF if the token consists
|
22
|
-
# entirely of lowercase letters.
|
23
16
|
|
24
17
|
CLASS_REGEXP_STR = '\\\\?((?:\:{2})?[A-Z]\w*(?:\:\:\w+)*)'
|
25
18
|
METHOD_REGEXP_STR = '(\w+[!?=]?)(?:\([\.\w+\*\/\+\-\=\<\>]*\))?'
|
@@ -64,7 +57,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
|
64
57
|
)/x
|
65
58
|
|
66
59
|
##
|
67
|
-
# RDoc::
|
60
|
+
# RDoc::CodeObject for generating references
|
68
61
|
|
69
62
|
attr_accessor :context
|
70
63
|
|
@@ -110,7 +103,6 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
|
110
103
|
lookup = name
|
111
104
|
end
|
112
105
|
|
113
|
-
|
114
106
|
# Find class, module, or method in class or module.
|
115
107
|
#
|
116
108
|
# Do not, however, use an if/elsif/else chain to do so. Instead, test
|
@@ -143,3 +135,4 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
|
143
135
|
end
|
144
136
|
|
145
137
|
end
|
138
|
+
|
data/lib/rdoc/markup/to_latex.rb
CHANGED
@@ -87,7 +87,37 @@ class RDoc::Markup::ToLaTeX < RDoc::Markup::Formatter
|
|
87
87
|
end
|
88
88
|
|
89
89
|
##
|
90
|
-
#
|
90
|
+
# This is a higher speed (if messier) version of wrap
|
91
|
+
|
92
|
+
def wrap(txt, line_len = 76)
|
93
|
+
res = ""
|
94
|
+
sp = 0
|
95
|
+
ep = txt.length
|
96
|
+
while sp < ep
|
97
|
+
# scan back for a space
|
98
|
+
p = sp + line_len - 1
|
99
|
+
if p >= ep
|
100
|
+
p = ep
|
101
|
+
else
|
102
|
+
while p > sp and txt[p] != ?\s
|
103
|
+
p -= 1
|
104
|
+
end
|
105
|
+
if p <= sp
|
106
|
+
p = sp + line_len
|
107
|
+
while p < ep and txt[p] != ?\s
|
108
|
+
p += 1
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
res << txt[sp...p] << "\n"
|
113
|
+
sp = p
|
114
|
+
sp += 1 while sp < ep and txt[sp] == ?\s
|
115
|
+
end
|
116
|
+
res
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# :section: Visitor
|
91
121
|
|
92
122
|
def start_accepting
|
93
123
|
@res = ""
|
@@ -144,36 +174,6 @@ class RDoc::Markup::ToLaTeX < RDoc::Markup::Formatter
|
|
144
174
|
@res << convert_heading(fragment.head_level, am.flow(fragment.txt))
|
145
175
|
end
|
146
176
|
|
147
|
-
##
|
148
|
-
# This is a higher speed (if messier) version of wrap
|
149
|
-
|
150
|
-
def wrap(txt, line_len = 76)
|
151
|
-
res = ""
|
152
|
-
sp = 0
|
153
|
-
ep = txt.length
|
154
|
-
while sp < ep
|
155
|
-
# scan back for a space
|
156
|
-
p = sp + line_len - 1
|
157
|
-
if p >= ep
|
158
|
-
p = ep
|
159
|
-
else
|
160
|
-
while p > sp and txt[p] != ?\s
|
161
|
-
p -= 1
|
162
|
-
end
|
163
|
-
if p <= sp
|
164
|
-
p = sp + line_len
|
165
|
-
while p < ep and txt[p] != ?\s
|
166
|
-
p += 1
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
res << txt[sp...p] << "\n"
|
171
|
-
sp = p
|
172
|
-
sp += 1 while sp < ep and txt[sp] == ?\s
|
173
|
-
end
|
174
|
-
res
|
175
|
-
end
|
176
|
-
|
177
177
|
private
|
178
178
|
|
179
179
|
def on_tags(res, item)
|
data/lib/rdoc/markup/to_test.rb
CHANGED
@@ -9,9 +9,25 @@ require 'rdoc/markup/formatter'
|
|
9
9
|
# Convert SimpleMarkup to basic TexInfo format
|
10
10
|
#
|
11
11
|
# TODO: WTF is AttributeManager for?
|
12
|
-
|
12
|
+
|
13
13
|
class RDoc::Markup::ToTexInfo < RDoc::Markup::Formatter
|
14
14
|
|
15
|
+
def format(text)
|
16
|
+
text.txt.
|
17
|
+
gsub(/@/, "@@").
|
18
|
+
gsub(/\{/, "@{").
|
19
|
+
gsub(/\}/, "@}").
|
20
|
+
# gsub(/,/, "@,"). # technically only required in cross-refs
|
21
|
+
gsub(/\+([\w]+)\+/, "@code{\\1}").
|
22
|
+
gsub(/\<tt\>([^<]+)\<\/tt\>/, "@code{\\1}").
|
23
|
+
gsub(/\*([\w]+)\*/, "@strong{\\1}").
|
24
|
+
gsub(/\<b\>([^<]+)\<\/b\>/, "@strong{\\1}").
|
25
|
+
gsub(/_([\w]+)_/, "@emph{\\1}").
|
26
|
+
gsub(/\<em\>([^<]+)\<\/em\>/, "@emph{\\1}")
|
27
|
+
end
|
28
|
+
|
29
|
+
# :section: Visitor
|
30
|
+
|
15
31
|
def start_accepting
|
16
32
|
@text = []
|
17
33
|
end
|
@@ -53,17 +69,5 @@ class RDoc::Markup::ToTexInfo < RDoc::Markup::Formatter
|
|
53
69
|
@text << '-----'
|
54
70
|
end
|
55
71
|
|
56
|
-
def format(text)
|
57
|
-
text.txt.
|
58
|
-
gsub(/@/, "@@").
|
59
|
-
gsub(/\{/, "@{").
|
60
|
-
gsub(/\}/, "@}").
|
61
|
-
# gsub(/,/, "@,"). # technically only required in cross-refs
|
62
|
-
gsub(/\+([\w]+)\+/, "@code{\\1}").
|
63
|
-
gsub(/\<tt\>([^<]+)\<\/tt\>/, "@code{\\1}").
|
64
|
-
gsub(/\*([\w]+)\*/, "@strong{\\1}").
|
65
|
-
gsub(/\<b\>([^<]+)\<\/b\>/, "@strong{\\1}").
|
66
|
-
gsub(/_([\w]+)_/, "@emph{\\1}").
|
67
|
-
gsub(/\<em\>([^<]+)\<\/em\>/, "@emph{\\1}")
|
68
|
-
end
|
69
72
|
end
|
73
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rdoc/class_module'
|
2
|
+
|
3
|
+
##
|
4
|
+
# A normal class, neither singleton nor anonymous
|
5
|
+
|
6
|
+
class RDoc::NormalClass < RDoc::ClassModule
|
7
|
+
|
8
|
+
def inspect # :nodoc:
|
9
|
+
superclass = @superclass ? " < #{@superclass}" : nil
|
10
|
+
"<%s:0x%x class %s%s includes: %p attributes: %p methods: %p aliases: %p>" % [
|
11
|
+
self.class, object_id,
|
12
|
+
full_name, superclass, @includes, @attributes, @method_list, @aliases
|
13
|
+
]
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rdoc/class_module'
|
2
|
+
|
3
|
+
##
|
4
|
+
# A normal module, like NormalClass
|
5
|
+
|
6
|
+
class RDoc::NormalModule < RDoc::ClassModule
|
7
|
+
|
8
|
+
##
|
9
|
+
# Appends +comment+ to the current comment, but separated by a rule
|
10
|
+
|
11
|
+
def comment=(comment)
|
12
|
+
return if comment.empty?
|
13
|
+
comment = @comment << "\n# ---\n" << comment unless @comment.empty?
|
14
|
+
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def inspect # :nodoc:
|
19
|
+
"#<%s:0x%x module %s includes: %p attributes: %p methods: %p aliases: %p>" % [
|
20
|
+
self.class, object_id,
|
21
|
+
full_name, @includes, @attributes, @method_list, @aliases
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# This is a module, returns true
|
27
|
+
|
28
|
+
def module?
|
29
|
+
true
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
|
data/lib/rdoc/options.rb
CHANGED
@@ -7,21 +7,11 @@ require 'rdoc/ri/paths'
|
|
7
7
|
|
8
8
|
class RDoc::Options
|
9
9
|
|
10
|
-
##
|
11
|
-
# Should the output be placed into a single file?
|
12
|
-
|
13
|
-
attr_reader :all_one_file
|
14
|
-
|
15
10
|
##
|
16
11
|
# Character-set
|
17
12
|
|
18
13
|
attr_reader :charset
|
19
14
|
|
20
|
-
##
|
21
|
-
# URL of stylesheet
|
22
|
-
|
23
|
-
attr_reader :css
|
24
|
-
|
25
15
|
##
|
26
16
|
# Should diagrams be drawn?
|
27
17
|
|
@@ -32,16 +22,6 @@ class RDoc::Options
|
|
32
22
|
|
33
23
|
attr_accessor :exclude
|
34
24
|
|
35
|
-
##
|
36
|
-
# Additional attr_... style method flags
|
37
|
-
|
38
|
-
attr_reader :extra_accessor_flags
|
39
|
-
|
40
|
-
##
|
41
|
-
# Pattern for additional attr_... style methods
|
42
|
-
|
43
|
-
attr_accessor :extra_accessors
|
44
|
-
|
45
25
|
##
|
46
26
|
# Should we draw fileboxes in diagrams?
|
47
27
|
|
@@ -77,11 +57,6 @@ class RDoc::Options
|
|
77
57
|
|
78
58
|
attr_reader :include_line_numbers
|
79
59
|
|
80
|
-
##
|
81
|
-
# Should source code be included inline, or displayed in a popup
|
82
|
-
|
83
|
-
attr_accessor :inline_source
|
84
|
-
|
85
60
|
##
|
86
61
|
# Name of the file, class or module to display in the initial index page (if
|
87
62
|
# not specified the first file we encounter is used)
|
@@ -98,16 +73,6 @@ class RDoc::Options
|
|
98
73
|
|
99
74
|
attr_accessor :op_dir
|
100
75
|
|
101
|
-
##
|
102
|
-
# The name to use for the output
|
103
|
-
|
104
|
-
attr_accessor :op_name
|
105
|
-
|
106
|
-
##
|
107
|
-
# Are we promiscuous about showing module contents across multiple files?
|
108
|
-
|
109
|
-
attr_reader :promiscuous
|
110
|
-
|
111
76
|
##
|
112
77
|
# Array of directories to search for files to satisfy an :include:
|
113
78
|
|
@@ -134,11 +99,9 @@ class RDoc::Options
|
|
134
99
|
attr_reader :template
|
135
100
|
|
136
101
|
##
|
137
|
-
#
|
138
|
-
#--
|
139
|
-
# HACK around dependencies in lib/rdoc/generator/html.rb
|
102
|
+
# Number of threads to parse with
|
140
103
|
|
141
|
-
attr_accessor :
|
104
|
+
attr_accessor :threads
|
142
105
|
|
143
106
|
##
|
144
107
|
# Documentation title
|
@@ -157,8 +120,7 @@ class RDoc::Options
|
|
157
120
|
|
158
121
|
def initialize # :nodoc:
|
159
122
|
require 'rdoc/rdoc'
|
160
|
-
@op_dir =
|
161
|
-
@op_name = nil
|
123
|
+
@op_dir = 'doc'
|
162
124
|
@show_all = false
|
163
125
|
@main_page = nil
|
164
126
|
@merge = false
|
@@ -168,21 +130,20 @@ class RDoc::Options
|
|
168
130
|
@rdoc_include = []
|
169
131
|
@title = nil
|
170
132
|
@template = nil
|
171
|
-
@
|
133
|
+
@threads = if RUBY_PLATFORM == 'java' then
|
134
|
+
Java::java::lang::Runtime.getRuntime.availableProcessors * 2
|
135
|
+
else
|
136
|
+
2
|
137
|
+
end
|
172
138
|
@diagram = false
|
173
139
|
@fileboxes = false
|
174
140
|
@show_hash = false
|
175
141
|
@image_format = 'png'
|
176
|
-
@inline_source = false
|
177
|
-
@all_one_file = false
|
178
142
|
@tab_width = 8
|
179
143
|
@include_line_numbers = false
|
180
|
-
@
|
181
|
-
@promiscuous = false
|
182
|
-
@force_update = false
|
144
|
+
@force_update = true
|
183
145
|
@verbosity = 1
|
184
146
|
|
185
|
-
@css = nil
|
186
147
|
@webcvs = nil
|
187
148
|
|
188
149
|
@charset = 'utf-8'
|
@@ -192,8 +153,6 @@ class RDoc::Options
|
|
192
153
|
# Parse command line options.
|
193
154
|
|
194
155
|
def parse(argv)
|
195
|
-
accessors = []
|
196
|
-
|
197
156
|
opts = OptionParser.new do |opt|
|
198
157
|
opt.program_name = File.basename $0
|
199
158
|
opt.version = RDoc::VERSION
|
@@ -211,47 +170,15 @@ Usage: #{opt.program_name} [options] [names...]
|
|
211
170
|
How RDoc generates output depends on the output formatter being used, and on
|
212
171
|
the options you give.
|
213
172
|
|
214
|
-
- Darkfish
|
215
|
-
|
216
|
-
- HTML output is normally produced into a number of separate files
|
217
|
-
(one per class, module, and file, along with various indices).
|
218
|
-
These files will appear in the directory given by the --op
|
219
|
-
option (doc/ by default).
|
173
|
+
- Darkfish creates frameless HTML output by Michael Granger.
|
220
174
|
|
221
|
-
-
|
222
|
-
--opname option is given, the output will instead be written
|
223
|
-
to a file with that name in the output directory.
|
224
|
-
|
225
|
-
- .chm files (Windows help files) are written in the --op directory.
|
226
|
-
If an --opname parameter is present, that name is used, otherwise
|
227
|
-
the file will be called rdoc.chm.
|
175
|
+
- ri creates ri data files
|
228
176
|
EOF
|
229
177
|
|
230
178
|
opt.separator nil
|
231
179
|
opt.separator "Options:"
|
232
180
|
opt.separator nil
|
233
181
|
|
234
|
-
opt.on("--accessor=ACCESSORS", "-A", Array,
|
235
|
-
"A comma separated list of additional class",
|
236
|
-
"methods that should be treated like",
|
237
|
-
"'attr_reader' and friends.",
|
238
|
-
" ",
|
239
|
-
"Option may be repeated.",
|
240
|
-
" ",
|
241
|
-
"Each accessorname may have '=text'",
|
242
|
-
"appended, in which case that text appears",
|
243
|
-
"where the r/w/rw appears for normal.",
|
244
|
-
"accessors") do |value|
|
245
|
-
value.each do |accessor|
|
246
|
-
if accessor =~ /^(\w+)(=(.*))?$/
|
247
|
-
accessors << $1
|
248
|
-
@extra_accessor_flags[$1] = $3
|
249
|
-
end
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
opt.separator nil
|
254
|
-
|
255
182
|
opt.on("--all", "-a",
|
256
183
|
"Include all methods (not just public) in",
|
257
184
|
"the output.") do |value|
|
@@ -360,14 +287,6 @@ Usage: #{opt.program_name} [options] [names...]
|
|
360
287
|
|
361
288
|
opt.separator nil
|
362
289
|
|
363
|
-
opt.on("--inline-source", "-S",
|
364
|
-
"Show method source code inline, rather than",
|
365
|
-
"via a popup link.") do |value|
|
366
|
-
@inline_source = value
|
367
|
-
end
|
368
|
-
|
369
|
-
opt.separator nil
|
370
|
-
|
371
290
|
opt.on("--line-numbers", "-N",
|
372
291
|
"Include line numbers in the source code.") do |value|
|
373
292
|
@include_line_numbers = value
|
@@ -391,52 +310,18 @@ Usage: #{opt.program_name} [options] [names...]
|
|
391
310
|
|
392
311
|
opt.separator nil
|
393
312
|
|
394
|
-
opt.on("--
|
395
|
-
"Put all the output into a single file.") do |value|
|
396
|
-
@all_one_file = value
|
397
|
-
@inline_source = value if value
|
398
|
-
@template = 'one_page_html'
|
399
|
-
end
|
400
|
-
|
401
|
-
opt.separator nil
|
402
|
-
|
403
|
-
opt.on("--op=DIR", "-o",
|
313
|
+
opt.on("--output=DIR", "--op", "-o",
|
404
314
|
"Set the output directory.") do |value|
|
405
315
|
@op_dir = value
|
406
316
|
end
|
407
317
|
|
408
318
|
opt.separator nil
|
409
319
|
|
410
|
-
opt.on("--opname=NAME", "-n",
|
411
|
-
"Set the NAME of the output. Has no effect",
|
412
|
-
"for HTML.") do |value|
|
413
|
-
@op_name = value
|
414
|
-
end
|
415
|
-
|
416
|
-
opt.separator nil
|
417
|
-
|
418
|
-
opt.on("--promiscuous", "-p",
|
419
|
-
"When documenting a file that contains a",
|
420
|
-
"module or class also defined in other",
|
421
|
-
"files, show all stuff for that module or",
|
422
|
-
"class in each files page. By default, only",
|
423
|
-
"show stuff defined in that particular file.") do |value|
|
424
|
-
@promiscuous = value
|
425
|
-
end
|
426
|
-
|
427
|
-
opt.separator nil
|
428
|
-
|
429
320
|
opt.on("--quiet", "-q",
|
430
321
|
"Don't show progress as we parse.") do |value|
|
431
322
|
@verbosity = 0
|
432
323
|
end
|
433
324
|
|
434
|
-
opt.on("--verbose", "-v",
|
435
|
-
"Display extra progress as we parse.") do |value|
|
436
|
-
@verbosity = 2
|
437
|
-
end
|
438
|
-
|
439
|
-
|
440
325
|
opt.separator nil
|
441
326
|
|
442
327
|
opt.on("--ri", "-r",
|
@@ -464,20 +349,6 @@ Usage: #{opt.program_name} [options] [names...]
|
|
464
349
|
|
465
350
|
opt.separator nil
|
466
351
|
|
467
|
-
opt.on("--ri-system", "-Y",
|
468
|
-
"Generate output for use by `ri`. The files",
|
469
|
-
"are stored in a site-wide directory,",
|
470
|
-
"making them accessible to others, so",
|
471
|
-
"special privileges are needed. This",
|
472
|
-
"option is intended to be used during Ruby",
|
473
|
-
"installation.") do |value|
|
474
|
-
@generator_name = "ri"
|
475
|
-
@op_dir = RDoc::RI::Paths::SYSDIR
|
476
|
-
setup_generator
|
477
|
-
end
|
478
|
-
|
479
|
-
opt.separator nil
|
480
|
-
|
481
352
|
opt.on("--show-hash", "-H",
|
482
353
|
"A name of the form #name in a comment is a",
|
483
354
|
"possible hyperlink to an instance method",
|
@@ -488,13 +359,6 @@ Usage: #{opt.program_name} [options] [names...]
|
|
488
359
|
|
489
360
|
opt.separator nil
|
490
361
|
|
491
|
-
opt.on("--style=URL", "-s",
|
492
|
-
"Specifies the URL of a separate stylesheet.") do |value|
|
493
|
-
@css = value
|
494
|
-
end
|
495
|
-
|
496
|
-
opt.separator nil
|
497
|
-
|
498
362
|
opt.on("--tab-width=WIDTH", "-w", OptionParser::DecimalInteger,
|
499
363
|
"Set the width of tab characters.") do |value|
|
500
364
|
@tab_width = value
|
@@ -510,6 +374,13 @@ Usage: #{opt.program_name} [options] [names...]
|
|
510
374
|
|
511
375
|
opt.separator nil
|
512
376
|
|
377
|
+
opt.on("--threads=THREADS", Integer,
|
378
|
+
"Number of threads to parse with.") do |threads|
|
379
|
+
@threads = threads
|
380
|
+
end
|
381
|
+
|
382
|
+
opt.separator nil
|
383
|
+
|
513
384
|
opt.on("--title=TITLE", "-t",
|
514
385
|
"Set TITLE as the title for HTML output.") do |value|
|
515
386
|
@title = value
|
@@ -517,6 +388,13 @@ Usage: #{opt.program_name} [options] [names...]
|
|
517
388
|
|
518
389
|
opt.separator nil
|
519
390
|
|
391
|
+
opt.on("--verbose", "-v",
|
392
|
+
"Display extra progress as we parse.") do |value|
|
393
|
+
@verbosity = 2
|
394
|
+
end
|
395
|
+
|
396
|
+
opt.separator nil
|
397
|
+
|
520
398
|
opt.on("--webcvs=URL", "-W",
|
521
399
|
"Specify a URL for linking to a web frontend",
|
522
400
|
"to CVS. If the URL contains a '\%s', the",
|
@@ -548,12 +426,6 @@ Usage: #{opt.program_name} [options] [names...]
|
|
548
426
|
|
549
427
|
@template ||= @generator_name
|
550
428
|
|
551
|
-
# Generate a regexp from the accessors
|
552
|
-
unless accessors.empty? then
|
553
|
-
re = '^(' + accessors.map { |a| Regexp.quote a }.join('|') + ')$'
|
554
|
-
@extra_accessors = Regexp.new re
|
555
|
-
end
|
556
|
-
|
557
429
|
rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
|
558
430
|
puts opts
|
559
431
|
puts
|
@@ -591,11 +463,6 @@ Usage: #{opt.program_name} [options] [names...]
|
|
591
463
|
unless @generator then
|
592
464
|
raise OptionParser::InvalidArgument, "Invalid output formatter"
|
593
465
|
end
|
594
|
-
|
595
|
-
if @generator_name == "xml" then
|
596
|
-
@all_one_file = true
|
597
|
-
@inline_source = true
|
598
|
-
end
|
599
466
|
end
|
600
467
|
|
601
468
|
# Check that the right version of 'dot' is available. Unfortunately this
|