rdoc 3.12.2 → 4.0.0.preview2
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.
- checksums.yaml +6 -6
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.autotest +3 -2
- data/DEVELOPERS.rdoc +53 -0
- data/History.rdoc +159 -25
- data/LEGAL.rdoc +12 -0
- data/Manifest.txt +56 -3
- data/README.rdoc +87 -19
- data/Rakefile +11 -2
- data/TODO.rdoc +20 -13
- data/bin/rdoc +4 -0
- data/lib/gauntlet_rdoc.rb +1 -1
- data/lib/rdoc.rb +32 -71
- data/lib/rdoc/any_method.rb +75 -21
- data/lib/rdoc/attr.rb +49 -10
- data/lib/rdoc/class_module.rb +182 -32
- data/lib/rdoc/code_object.rb +54 -12
- data/lib/rdoc/comment.rb +8 -1
- data/lib/rdoc/constant.rb +100 -6
- data/lib/rdoc/context.rb +93 -41
- data/lib/rdoc/context/section.rb +143 -28
- data/lib/rdoc/cross_reference.rb +58 -50
- data/lib/rdoc/encoding.rb +34 -29
- data/lib/rdoc/erb_partial.rb +18 -0
- data/lib/rdoc/extend.rb +117 -0
- data/lib/rdoc/generator.rb +11 -6
- data/lib/rdoc/generator/darkfish.rb +250 -62
- data/lib/rdoc/generator/json_index.rb +20 -12
- data/lib/rdoc/generator/markup.rb +10 -12
- data/lib/rdoc/generator/ri.rb +7 -60
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +16 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +14 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +13 -0
- data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -1
- data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -9
- data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -0
- data/lib/rdoc/generator/template/darkfish/rdoc.css +31 -0
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +18 -0
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +37 -0
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
- data/lib/rdoc/include.rb +12 -3
- data/lib/rdoc/markdown.kpeg +1186 -0
- data/lib/rdoc/markdown.rb +16336 -0
- data/lib/rdoc/markdown/entities.rb +2128 -0
- data/lib/rdoc/markdown/literals_1_8.kpeg +18 -0
- data/lib/rdoc/markdown/literals_1_8.rb +454 -0
- data/lib/rdoc/markdown/literals_1_9.kpeg +22 -0
- data/lib/rdoc/markdown/literals_1_9.rb +417 -0
- data/lib/rdoc/markup.rb +69 -10
- data/lib/rdoc/markup/attr_changer.rb +2 -5
- data/lib/rdoc/markup/attribute_manager.rb +23 -14
- data/lib/rdoc/markup/attributes.rb +70 -0
- data/lib/rdoc/markup/block_quote.rb +14 -0
- data/lib/rdoc/markup/document.rb +20 -4
- data/lib/rdoc/markup/formatter.rb +17 -6
- data/lib/rdoc/markup/formatter_test_case.rb +93 -24
- data/lib/rdoc/markup/hard_break.rb +31 -0
- data/lib/rdoc/markup/heading.rb +1 -1
- data/lib/rdoc/markup/indented_paragraph.rb +14 -0
- data/lib/rdoc/markup/list.rb +23 -4
- data/lib/rdoc/markup/list_item.rb +17 -4
- data/lib/rdoc/markup/paragraph.rb +14 -0
- data/lib/rdoc/markup/parser.rb +107 -60
- data/lib/rdoc/markup/raw.rb +4 -4
- data/lib/rdoc/markup/special.rb +3 -3
- data/lib/rdoc/markup/to_ansi.rb +7 -1
- data/lib/rdoc/markup/to_html.rb +42 -14
- data/lib/rdoc/markup/to_html_crossref.rb +10 -9
- data/lib/rdoc/markup/to_html_snippet.rb +20 -4
- data/lib/rdoc/markup/to_joined_paragraph.rb +68 -0
- data/lib/rdoc/markup/to_label.rb +20 -1
- data/lib/rdoc/markup/to_markdown.rb +134 -0
- data/lib/rdoc/markup/to_rdoc.rb +36 -5
- data/lib/rdoc/markup/to_table_of_contents.rb +6 -1
- data/lib/rdoc/markup/to_tt_only.rb +11 -2
- data/lib/rdoc/markup/verbatim.rb +19 -0
- data/lib/rdoc/method_attr.rb +33 -19
- data/lib/rdoc/normal_class.rb +26 -7
- data/lib/rdoc/normal_module.rb +10 -5
- data/lib/rdoc/options.rb +95 -21
- data/lib/rdoc/parser.rb +6 -2
- data/lib/rdoc/parser/c.rb +212 -97
- data/lib/rdoc/parser/markdown.rb +23 -0
- data/lib/rdoc/parser/ruby.rb +115 -35
- data/lib/rdoc/parser/ruby_tools.rb +8 -3
- data/lib/rdoc/rd.rb +8 -4
- data/lib/rdoc/rd/block_parser.rb +1 -1
- data/lib/rdoc/rd/block_parser.ry +1 -1
- data/lib/rdoc/rdoc.rb +45 -21
- data/lib/rdoc/ri/driver.rb +322 -76
- data/lib/rdoc/ri/paths.rb +90 -31
- data/lib/rdoc/ri/store.rb +2 -353
- data/lib/rdoc/ruby_lex.rb +5 -21
- data/lib/rdoc/ruby_token.rb +2 -3
- data/lib/rdoc/rubygems_hook.rb +21 -9
- data/lib/rdoc/servlet.rb +302 -0
- data/lib/rdoc/stats.rb +28 -20
- data/lib/rdoc/store.rb +881 -0
- data/lib/rdoc/task.rb +2 -1
- data/lib/rdoc/test_case.rb +103 -1
- data/lib/rdoc/text.rb +5 -4
- data/lib/rdoc/tom_doc.rb +17 -16
- data/lib/rdoc/top_level.rb +43 -285
- data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +21 -0
- data/test/MarkdownTest_1.0.3/Auto links.text +13 -0
- data/test/MarkdownTest_1.0.3/Backslash escapes.text +120 -0
- data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +11 -0
- data/test/MarkdownTest_1.0.3/Code Blocks.text +14 -0
- data/test/MarkdownTest_1.0.3/Code Spans.text +6 -0
- data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +8 -0
- data/test/MarkdownTest_1.0.3/Horizontal rules.text +67 -0
- data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +15 -0
- data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +69 -0
- data/test/MarkdownTest_1.0.3/Inline HTML comments.text +13 -0
- data/test/MarkdownTest_1.0.3/Links, inline style.text +12 -0
- data/test/MarkdownTest_1.0.3/Links, reference style.text +71 -0
- data/test/MarkdownTest_1.0.3/Links, shortcut references.text +20 -0
- data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +7 -0
- data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +306 -0
- data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +888 -0
- data/test/MarkdownTest_1.0.3/Nested blockquotes.text +5 -0
- data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +131 -0
- data/test/MarkdownTest_1.0.3/Strong and em together.text +7 -0
- data/test/MarkdownTest_1.0.3/Tabs.text +21 -0
- data/test/MarkdownTest_1.0.3/Tidyness.text +5 -0
- data/test/test_attribute_manager.rb +7 -4
- data/test/test_rdoc_any_method.rb +84 -13
- data/test/test_rdoc_attr.rb +59 -9
- data/test/test_rdoc_class_module.rb +670 -73
- data/test/test_rdoc_code_object.rb +21 -1
- data/test/test_rdoc_comment.rb +1 -1
- data/test/test_rdoc_constant.rb +132 -0
- data/test/test_rdoc_context.rb +84 -18
- data/test/test_rdoc_context_section.rb +99 -15
- data/test/test_rdoc_cross_reference.rb +1 -1
- data/test/test_rdoc_encoding.rb +17 -1
- data/test/test_rdoc_extend.rb +94 -0
- data/test/test_rdoc_generator_darkfish.rb +45 -19
- data/test/test_rdoc_generator_json_index.rb +27 -7
- data/test/test_rdoc_generator_markup.rb +3 -3
- data/test/test_rdoc_generator_ri.rb +11 -9
- data/test/test_rdoc_include.rb +12 -0
- data/test/test_rdoc_markdown.rb +977 -0
- data/test/test_rdoc_markdown_test.rb +1891 -0
- data/test/test_rdoc_markup.rb +1 -1
- data/test/test_rdoc_markup_attribute_manager.rb +2 -2
- data/test/test_rdoc_markup_attributes.rb +39 -0
- data/test/test_rdoc_markup_document.rb +16 -1
- data/test/test_rdoc_markup_formatter.rb +7 -4
- data/test/test_rdoc_markup_hard_break.rb +31 -0
- data/test/test_rdoc_markup_indented_paragraph.rb +14 -0
- data/test/test_rdoc_markup_paragraph.rb +15 -1
- data/test/test_rdoc_markup_parser.rb +152 -89
- data/test/test_rdoc_markup_to_ansi.rb +23 -2
- data/test/test_rdoc_markup_to_bs.rb +24 -0
- data/test/test_rdoc_markup_to_html.rb +50 -19
- data/test/test_rdoc_markup_to_html_crossref.rb +23 -5
- data/test/test_rdoc_markup_to_html_snippet.rb +49 -8
- data/test/test_rdoc_markup_to_joined_paragraph.rb +32 -0
- data/test/test_rdoc_markup_to_label.rb +63 -1
- data/test/test_rdoc_markup_to_markdown.rb +352 -0
- data/test/test_rdoc_markup_to_rdoc.rb +22 -2
- data/test/test_rdoc_markup_to_table_of_contents.rb +44 -39
- data/test/test_rdoc_markup_to_tt_only.rb +20 -0
- data/test/test_rdoc_markup_verbatim.rb +13 -0
- data/test/test_rdoc_method_attr.rb +5 -0
- data/test/test_rdoc_normal_class.rb +24 -5
- data/test/test_rdoc_normal_module.rb +1 -1
- data/test/test_rdoc_options.rb +21 -6
- data/test/test_rdoc_parser.rb +24 -0
- data/test/test_rdoc_parser_c.rb +151 -26
- data/test/test_rdoc_parser_markdown.rb +55 -0
- data/test/test_rdoc_parser_rd.rb +2 -2
- data/test/test_rdoc_parser_ruby.rb +468 -109
- data/test/test_rdoc_parser_simple.rb +2 -2
- data/test/test_rdoc_rd_block_parser.rb +0 -4
- data/test/test_rdoc_rdoc.rb +110 -22
- data/test/test_rdoc_ri_driver.rb +415 -80
- data/test/test_rdoc_ri_paths.rb +122 -13
- data/test/test_rdoc_ruby_lex.rb +5 -61
- data/test/test_rdoc_ruby_token.rb +19 -0
- data/test/test_rdoc_rubygems_hook.rb +64 -43
- data/test/test_rdoc_servlet.rb +429 -0
- data/test/test_rdoc_stats.rb +83 -24
- data/test/{test_rdoc_ri_store.rb → test_rdoc_store.rb} +395 -22
- data/test/test_rdoc_task.rb +2 -2
- data/test/test_rdoc_text.rb +37 -11
- data/test/test_rdoc_tom_doc.rb +59 -62
- data/test/test_rdoc_top_level.rb +71 -113
- data/test/xref_test_case.rb +7 -9
- metadata +122 -39
- metadata.gz.sig +0 -0
- data/CVE-2013-0256.rdoc +0 -49
- data/lib/rdoc/markup/attribute.rb +0 -51
data/lib/rdoc/markup/to_rdoc.rb
CHANGED
@@ -42,7 +42,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
|
42
42
|
# Creates a new formatter that will output (mostly) \RDoc markup
|
43
43
|
|
44
44
|
def initialize markup = nil
|
45
|
-
super
|
45
|
+
super nil, markup
|
46
46
|
|
47
47
|
@markup.add_special(/\\\S/, :SUPPRESSED_CROSSREF)
|
48
48
|
@width = 78
|
@@ -57,6 +57,8 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
|
57
57
|
@headings[4] = ['==== ', '']
|
58
58
|
@headings[5] = ['===== ', '']
|
59
59
|
@headings[6] = ['====== ', '']
|
60
|
+
|
61
|
+
@hard_break = "\n"
|
60
62
|
end
|
61
63
|
|
62
64
|
##
|
@@ -75,6 +77,21 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
|
75
77
|
@res << "\n"
|
76
78
|
end
|
77
79
|
|
80
|
+
##
|
81
|
+
# Adds +paragraph+ to the output
|
82
|
+
|
83
|
+
def accept_block_quote block_quote
|
84
|
+
@indent += 2
|
85
|
+
|
86
|
+
block_quote.parts.each do |part|
|
87
|
+
@prefix = '> '
|
88
|
+
|
89
|
+
part.accept self
|
90
|
+
end
|
91
|
+
|
92
|
+
@indent -= 2
|
93
|
+
end
|
94
|
+
|
78
95
|
##
|
79
96
|
# Adds +heading+ to the output
|
80
97
|
|
@@ -127,10 +144,15 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
|
127
144
|
|
128
145
|
case type
|
129
146
|
when :NOTE, :LABEL then
|
130
|
-
|
147
|
+
bullets = Array(list_item.label).map do |label|
|
148
|
+
attributes(label).strip
|
149
|
+
end.join "\n"
|
150
|
+
|
151
|
+
bullets << ":\n" unless bullets.empty?
|
152
|
+
|
131
153
|
@prefix = ' ' * @indent
|
132
154
|
@indent += 2
|
133
|
-
@prefix <<
|
155
|
+
@prefix << bullets + (' ' * @indent)
|
134
156
|
else
|
135
157
|
bullet = type == :BULLET ? '*' : @list_index.last.to_s + '.'
|
136
158
|
@prefix = (' ' * @indent) + bullet.ljust(bullet.length + 1)
|
@@ -170,7 +192,8 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
|
170
192
|
# Adds +paragraph+ to the output
|
171
193
|
|
172
194
|
def accept_paragraph paragraph
|
173
|
-
|
195
|
+
text = paragraph.text @hard_break
|
196
|
+
wrap attributes text
|
174
197
|
end
|
175
198
|
|
176
199
|
##
|
@@ -178,7 +201,8 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
|
178
201
|
|
179
202
|
def accept_indented_paragraph paragraph
|
180
203
|
@indent += paragraph.indent
|
181
|
-
|
204
|
+
text = paragraph.text @hard_break
|
205
|
+
wrap attributes text
|
182
206
|
@indent -= paragraph.indent
|
183
207
|
end
|
184
208
|
|
@@ -236,6 +260,13 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
|
|
236
260
|
text
|
237
261
|
end
|
238
262
|
|
263
|
+
##
|
264
|
+
# Adds a newline to the output
|
265
|
+
|
266
|
+
def handle_special_HARD_BREAK special
|
267
|
+
"\n"
|
268
|
+
end
|
269
|
+
|
239
270
|
##
|
240
271
|
# Prepares the visitor for text generation
|
241
272
|
|
@@ -7,7 +7,7 @@ class RDoc::Markup::ToTableOfContents < RDoc::Markup::Formatter
|
|
7
7
|
@to_toc = nil
|
8
8
|
|
9
9
|
##
|
10
|
-
# Singleton for
|
10
|
+
# Singleton for table-of-contents generation
|
11
11
|
|
12
12
|
def self.to_toc
|
13
13
|
@to_toc ||= new
|
@@ -18,6 +18,10 @@ class RDoc::Markup::ToTableOfContents < RDoc::Markup::Formatter
|
|
18
18
|
|
19
19
|
attr_reader :res
|
20
20
|
|
21
|
+
def initialize # :nodoc:
|
22
|
+
super nil
|
23
|
+
end
|
24
|
+
|
21
25
|
##
|
22
26
|
# Adds +heading+ to the table of contents
|
23
27
|
|
@@ -40,6 +44,7 @@ class RDoc::Markup::ToTableOfContents < RDoc::Markup::Formatter
|
|
40
44
|
end
|
41
45
|
|
42
46
|
# :stopdoc:
|
47
|
+
alias accept_block_quote ignore
|
43
48
|
alias accept_raw ignore
|
44
49
|
alias accept_rule ignore
|
45
50
|
alias accept_blank_line ignore
|
@@ -18,11 +18,18 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
|
|
18
18
|
# Creates a new tt-only formatter.
|
19
19
|
|
20
20
|
def initialize markup = nil
|
21
|
-
super
|
21
|
+
super nil, markup
|
22
22
|
|
23
23
|
add_tag :TT, nil, nil
|
24
24
|
end
|
25
25
|
|
26
|
+
##
|
27
|
+
# Adds tts from +block_quote+ to the output
|
28
|
+
|
29
|
+
def accept_block_quote block_quote
|
30
|
+
tt_sections block_quote.text
|
31
|
+
end
|
32
|
+
|
26
33
|
##
|
27
34
|
# Pops the list type for +list+ from #list_type
|
28
35
|
|
@@ -43,7 +50,9 @@ class RDoc::Markup::ToTtOnly < RDoc::Markup::Formatter
|
|
43
50
|
def accept_list_item_start list_item
|
44
51
|
case @list_type.last
|
45
52
|
when :NOTE, :LABEL then
|
46
|
-
|
53
|
+
Array(list_item.label).map do |label|
|
54
|
+
tt_sections label
|
55
|
+
end.flatten
|
47
56
|
end
|
48
57
|
end
|
49
58
|
|
data/lib/rdoc/markup/verbatim.rb
CHANGED
@@ -14,6 +14,10 @@ class RDoc::Markup::Verbatim < RDoc::Markup::Raw
|
|
14
14
|
@format = nil
|
15
15
|
end
|
16
16
|
|
17
|
+
def == other # :nodoc:
|
18
|
+
super and @format == other.format
|
19
|
+
end
|
20
|
+
|
17
21
|
##
|
18
22
|
# Calls #accept_verbatim on +visitor+
|
19
23
|
|
@@ -45,6 +49,21 @@ class RDoc::Markup::Verbatim < RDoc::Markup::Raw
|
|
45
49
|
@parts = parts
|
46
50
|
end
|
47
51
|
|
52
|
+
def pretty_print q # :nodoc:
|
53
|
+
self.class.name =~ /.*::(\w{1,4})/i
|
54
|
+
|
55
|
+
q.group 2, "[#{$1.downcase}: ", ']' do
|
56
|
+
if @format then
|
57
|
+
q.text "format: #{@format}"
|
58
|
+
q.breakable
|
59
|
+
end
|
60
|
+
|
61
|
+
q.seplist @parts do |part|
|
62
|
+
q.pp part
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
48
67
|
##
|
49
68
|
# Is this verbatim section ruby code?
|
50
69
|
|
data/lib/rdoc/method_attr.rb
CHANGED
@@ -98,7 +98,12 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
|
98
98
|
# Order by #singleton then #name
|
99
99
|
|
100
100
|
def <=>(other)
|
101
|
-
[@singleton ? 0 : 1,
|
101
|
+
[ @singleton ? 0 : 1, name] <=>
|
102
|
+
[other.singleton ? 0 : 1, other.name]
|
103
|
+
end
|
104
|
+
|
105
|
+
def == other # :nodoc:
|
106
|
+
super or self.class == other.class and full_name == other.full_name
|
102
107
|
end
|
103
108
|
|
104
109
|
##
|
@@ -133,6 +138,15 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
|
133
138
|
@see
|
134
139
|
end
|
135
140
|
|
141
|
+
##
|
142
|
+
# Sets the store for this class or module and its contained code objects.
|
143
|
+
|
144
|
+
def store= store
|
145
|
+
super
|
146
|
+
|
147
|
+
@file = @store.add_file @file.full_name if @file
|
148
|
+
end
|
149
|
+
|
136
150
|
def find_see # :nodoc:
|
137
151
|
return nil if singleton || is_alias_for
|
138
152
|
|
@@ -149,7 +163,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
|
149
163
|
return nil unless parent.respond_to? :ancestors
|
150
164
|
|
151
165
|
searched = parent.ancestors
|
152
|
-
kernel =
|
166
|
+
kernel = @store.modules_hash['Kernel']
|
153
167
|
|
154
168
|
searched << kernel if kernel &&
|
155
169
|
parent != kernel && !searched.include?(kernel)
|
@@ -171,10 +185,10 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
|
171
185
|
# Abstract method. Contexts in their building phase call this
|
172
186
|
# to register a new alias for this known method/attribute.
|
173
187
|
#
|
174
|
-
# - creates a new AnyMethod/Attribute
|
175
|
-
# - adds +self+ as
|
176
|
-
# - adds
|
177
|
-
# - adds
|
188
|
+
# - creates a new AnyMethod/Attribute named <tt>an_alias.new_name</tt>;
|
189
|
+
# - adds +self+ as an alias for the new method or attribute
|
190
|
+
# - adds the method or attribute to #aliases
|
191
|
+
# - adds the method or attribute to +context+.
|
178
192
|
|
179
193
|
def add_alias(an_alias, context)
|
180
194
|
raise NotImplementedError
|
@@ -271,6 +285,18 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
|
271
285
|
@full_name ||= "#{parent_name}#{pretty_name}"
|
272
286
|
end
|
273
287
|
|
288
|
+
def inspect # :nodoc:
|
289
|
+
alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
|
290
|
+
visibility = self.visibility
|
291
|
+
visibility = "forced #{visibility}" if force_documentation
|
292
|
+
"#<%s:0x%x %s (%s)%s>" % [
|
293
|
+
self.class, object_id,
|
294
|
+
full_name,
|
295
|
+
visibility,
|
296
|
+
alias_for,
|
297
|
+
]
|
298
|
+
end
|
299
|
+
|
274
300
|
##
|
275
301
|
# '::' for a class method/attribute, '#' for an instance method.
|
276
302
|
|
@@ -306,7 +332,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
|
306
332
|
end
|
307
333
|
|
308
334
|
##
|
309
|
-
# Path to this method
|
335
|
+
# Path to this method for use with HTML generator output.
|
310
336
|
|
311
337
|
def path
|
312
338
|
"#{@parent.path}##{aref}"
|
@@ -344,18 +370,6 @@ class RDoc::MethodAttr < RDoc::CodeObject
|
|
344
370
|
end
|
345
371
|
end
|
346
372
|
|
347
|
-
def inspect # :nodoc:
|
348
|
-
alias_for = @is_alias_for ? " (alias for #{@is_alias_for.name})" : nil
|
349
|
-
visibility = self.visibility
|
350
|
-
visibility = "forced #{visibility}" if force_documentation
|
351
|
-
"#<%s:0x%x %s (%s)%s>" % [
|
352
|
-
self.class, object_id,
|
353
|
-
full_name,
|
354
|
-
visibility,
|
355
|
-
alias_for,
|
356
|
-
]
|
357
|
-
end
|
358
|
-
|
359
373
|
##
|
360
374
|
# Used by RDoc::Generator::JsonIndex to create a record for the search
|
361
375
|
# engine.
|
data/lib/rdoc/normal_class.rb
CHANGED
@@ -4,10 +4,20 @@
|
|
4
4
|
class RDoc::NormalClass < RDoc::ClassModule
|
5
5
|
|
6
6
|
##
|
7
|
-
#
|
7
|
+
# The ancestors of this class including modules. Unlike Module#ancestors,
|
8
|
+
# this class is not included in the result. The result will contain both
|
9
|
+
# RDoc::ClassModules and Strings.
|
8
10
|
|
9
11
|
def ancestors
|
10
|
-
|
12
|
+
if String === superclass then
|
13
|
+
super << superclass
|
14
|
+
elsif superclass then
|
15
|
+
ancestors = super
|
16
|
+
ancestors << superclass
|
17
|
+
ancestors.concat superclass.ancestors
|
18
|
+
else
|
19
|
+
super
|
20
|
+
end
|
11
21
|
end
|
12
22
|
|
13
23
|
##
|
@@ -17,11 +27,15 @@ class RDoc::NormalClass < RDoc::ClassModule
|
|
17
27
|
"class #{full_name}"
|
18
28
|
end
|
19
29
|
|
30
|
+
def direct_ancestors
|
31
|
+
superclass ? super + [superclass] : super
|
32
|
+
end
|
33
|
+
|
20
34
|
def inspect # :nodoc:
|
21
35
|
superclass = @superclass ? " < #{@superclass}" : nil
|
22
|
-
"<%s:0x%x class %s%s includes: %p attributes: %p methods: %p aliases: %p>" % [
|
36
|
+
"<%s:0x%x class %s%s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
|
23
37
|
self.class, object_id,
|
24
|
-
full_name, superclass, @includes, @attributes, @method_list, @aliases
|
38
|
+
full_name, superclass, @includes, @extends, @attributes, @method_list, @aliases
|
25
39
|
]
|
26
40
|
end
|
27
41
|
|
@@ -43,20 +57,25 @@ class RDoc::NormalClass < RDoc::ClassModule
|
|
43
57
|
q.breakable
|
44
58
|
q.seplist @includes do |inc| q.pp inc end
|
45
59
|
|
60
|
+
q.breakable
|
61
|
+
q.text "constants:"
|
62
|
+
q.breakable
|
63
|
+
q.seplist @constants do |const| q.pp const end
|
64
|
+
|
46
65
|
q.breakable
|
47
66
|
q.text "attributes:"
|
48
67
|
q.breakable
|
49
|
-
q.seplist @attributes do |
|
68
|
+
q.seplist @attributes do |attr| q.pp attr end
|
50
69
|
|
51
70
|
q.breakable
|
52
71
|
q.text "methods:"
|
53
72
|
q.breakable
|
54
|
-
q.seplist @method_list do |
|
73
|
+
q.seplist @method_list do |meth| q.pp meth end
|
55
74
|
|
56
75
|
q.breakable
|
57
76
|
q.text "aliases:"
|
58
77
|
q.breakable
|
59
|
-
q.seplist @aliases do |
|
78
|
+
q.seplist @aliases do |aliaz| q.pp aliaz end
|
60
79
|
|
61
80
|
q.breakable
|
62
81
|
q.text "comment:"
|
data/lib/rdoc/normal_module.rb
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
class RDoc::NormalModule < RDoc::ClassModule
|
5
5
|
|
6
6
|
def inspect # :nodoc:
|
7
|
-
"#<%s:0x%x module %s includes: %p attributes: %p methods: %p aliases: %p>" % [
|
7
|
+
"#<%s:0x%x module %s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
|
8
8
|
self.class, object_id,
|
9
|
-
full_name, @includes, @attributes, @method_list, @aliases
|
9
|
+
full_name, @includes, @extends, @attributes, @method_list, @aliases
|
10
10
|
]
|
11
11
|
end
|
12
12
|
|
@@ -32,19 +32,24 @@ class RDoc::NormalModule < RDoc::ClassModule
|
|
32
32
|
q.seplist @includes do |inc| q.pp inc end
|
33
33
|
q.breakable
|
34
34
|
|
35
|
+
q.breakable
|
36
|
+
q.text "constants:"
|
37
|
+
q.breakable
|
38
|
+
q.seplist @constants do |const| q.pp const end
|
39
|
+
|
35
40
|
q.text "attributes:"
|
36
41
|
q.breakable
|
37
|
-
q.seplist @attributes do |
|
42
|
+
q.seplist @attributes do |attr| q.pp attr end
|
38
43
|
q.breakable
|
39
44
|
|
40
45
|
q.text "methods:"
|
41
46
|
q.breakable
|
42
|
-
q.seplist @method_list do |
|
47
|
+
q.seplist @method_list do |meth| q.pp meth end
|
43
48
|
q.breakable
|
44
49
|
|
45
50
|
q.text "aliases:"
|
46
51
|
q.breakable
|
47
|
-
q.seplist @aliases do |
|
52
|
+
q.seplist @aliases do |aliaz| q.pp aliaz end
|
48
53
|
q.breakable
|
49
54
|
|
50
55
|
q.text "comment:"
|
data/lib/rdoc/options.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'optparse'
|
2
|
+
require 'pathname'
|
2
3
|
|
3
4
|
##
|
4
5
|
# RDoc::Options handles the parsing and storage of options
|
@@ -25,6 +26,38 @@ require 'optparse'
|
|
25
26
|
# * +--quiet+
|
26
27
|
# * +--template+
|
27
28
|
# * +--verbose+
|
29
|
+
#
|
30
|
+
# == Custom Options
|
31
|
+
#
|
32
|
+
# Generators can hook into RDoc::Options to add generator-specific command
|
33
|
+
# line options.
|
34
|
+
#
|
35
|
+
# When <tt>--format</tt> is encountered in ARGV, RDoc calls ::setup_options on
|
36
|
+
# the generator class to add extra options to the option parser. Options for
|
37
|
+
# custom generators must occur after <tt>--format</tt>. <tt>rdoc --help</tt>
|
38
|
+
# will list options for all installed generators.
|
39
|
+
#
|
40
|
+
# Example:
|
41
|
+
#
|
42
|
+
# class RDoc::Generator::Spellcheck
|
43
|
+
# RDoc::RDoc.add_generator self
|
44
|
+
#
|
45
|
+
# def self.setup_options rdoc_options
|
46
|
+
# op = rdoc_options.option_parser
|
47
|
+
#
|
48
|
+
# op.on('--spell-dictionary DICTIONARY',
|
49
|
+
# RDoc::Options::Path) do |dictionary|
|
50
|
+
# rdoc_options.spell_dictionary = dictionary
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# == Option Validators
|
56
|
+
#
|
57
|
+
# OptionParser validators will validate and cast user input values. In
|
58
|
+
# addition to the validators that ship with OptionParser (String, Integer,
|
59
|
+
# Float, TrueClass, FalseClass, Array, Regexp, Date, Time, URI, etc.),
|
60
|
+
# RDoc::Options adds Path, PathArray and Template.
|
28
61
|
|
29
62
|
class RDoc::Options
|
30
63
|
|
@@ -63,6 +96,7 @@ class RDoc::Options
|
|
63
96
|
option_parser
|
64
97
|
pipe
|
65
98
|
rdoc_include
|
99
|
+
root
|
66
100
|
static_path
|
67
101
|
stylesheet_url
|
68
102
|
template
|
@@ -73,17 +107,27 @@ class RDoc::Options
|
|
73
107
|
]
|
74
108
|
|
75
109
|
##
|
76
|
-
#
|
110
|
+
# Option validator for OptionParser that matches a directory that exists on
|
111
|
+
# the filesystem.
|
112
|
+
|
113
|
+
Directory = Object.new
|
114
|
+
|
115
|
+
##
|
116
|
+
# Option validator for OptionParser that matches a file or directory that
|
117
|
+
# exists on the filesystem.
|
77
118
|
|
78
119
|
Path = Object.new
|
79
120
|
|
80
121
|
##
|
81
|
-
#
|
122
|
+
# Option validator for OptionParser that matches a comma-separated list of
|
123
|
+
# files or directories that exist on the filesystem.
|
82
124
|
|
83
125
|
PathArray = Object.new
|
84
126
|
|
85
127
|
##
|
86
|
-
#
|
128
|
+
# Option validator for OptionParser that matches a template directory for an
|
129
|
+
# installed generator that lives in
|
130
|
+
# <tt>"rdoc/generator/template/#{template_name}"</tt>
|
87
131
|
|
88
132
|
Template = Object.new
|
89
133
|
|
@@ -98,7 +142,9 @@ class RDoc::Options
|
|
98
142
|
attr_accessor :dry_run
|
99
143
|
|
100
144
|
##
|
101
|
-
#
|
145
|
+
# The output encoding. All input files will be transcoded to this encoding.
|
146
|
+
#
|
147
|
+
# The default encoding is UTF-8. This is set via --encoding.
|
102
148
|
|
103
149
|
attr_accessor :encoding
|
104
150
|
|
@@ -129,7 +175,7 @@ class RDoc::Options
|
|
129
175
|
attr_accessor :formatter
|
130
176
|
|
131
177
|
##
|
132
|
-
# Description of the output generator (set with the <tt>--
|
178
|
+
# Description of the output generator (set with the <tt>--format</tt> option)
|
133
179
|
|
134
180
|
attr_accessor :generator
|
135
181
|
|
@@ -162,8 +208,8 @@ class RDoc::Options
|
|
162
208
|
attr_accessor :main_page
|
163
209
|
|
164
210
|
##
|
165
|
-
# The default markup format. The default is 'rdoc'. '
|
166
|
-
# also built-in.
|
211
|
+
# The default markup format. The default is 'rdoc'. 'markdown', 'tomdoc'
|
212
|
+
# and 'rd' are also built-in.
|
167
213
|
|
168
214
|
attr_accessor :markup
|
169
215
|
|
@@ -192,6 +238,13 @@ class RDoc::Options
|
|
192
238
|
|
193
239
|
attr_accessor :rdoc_include
|
194
240
|
|
241
|
+
##
|
242
|
+
# Root of the source documentation will be generated for. Set this when
|
243
|
+
# building documentation outside the source directory. Defaults to the
|
244
|
+
# current directory.
|
245
|
+
|
246
|
+
attr_accessor :root
|
247
|
+
|
195
248
|
##
|
196
249
|
# Include the '#' at the front of hyperlinked instance method names
|
197
250
|
|
@@ -266,6 +319,7 @@ class RDoc::Options
|
|
266
319
|
@op_dir = nil
|
267
320
|
@pipe = false
|
268
321
|
@rdoc_include = []
|
322
|
+
@root = Pathname(Dir.pwd)
|
269
323
|
@show_hash = false
|
270
324
|
@static_path = []
|
271
325
|
@stylesheet_url = nil # TODO remove in RDoc 4
|
@@ -280,8 +334,8 @@ class RDoc::Options
|
|
280
334
|
@write_options = false
|
281
335
|
|
282
336
|
if Object.const_defined? :Encoding then
|
283
|
-
@encoding = Encoding
|
284
|
-
@charset = @encoding.
|
337
|
+
@encoding = Encoding::UTF_8
|
338
|
+
@charset = @encoding.name
|
285
339
|
else
|
286
340
|
@encoding = nil
|
287
341
|
@charset = 'UTF-8'
|
@@ -524,25 +578,33 @@ Usage: #{opt.program_name} [options] [names...]
|
|
524
578
|
end
|
525
579
|
end
|
526
580
|
|
527
|
-
opt.accept
|
581
|
+
opt.accept Directory do |directory|
|
528
582
|
directory = File.expand_path directory
|
529
583
|
|
530
|
-
raise OptionParser::InvalidArgument unless File.
|
584
|
+
raise OptionParser::InvalidArgument unless File.directory? directory
|
531
585
|
|
532
586
|
directory
|
533
587
|
end
|
534
588
|
|
535
|
-
opt.accept
|
536
|
-
|
537
|
-
|
538
|
-
|
589
|
+
opt.accept Path do |path|
|
590
|
+
path = File.expand_path path
|
591
|
+
|
592
|
+
raise OptionParser::InvalidArgument unless File.exist? path
|
593
|
+
|
594
|
+
path
|
595
|
+
end
|
596
|
+
|
597
|
+
opt.accept PathArray do |paths,|
|
598
|
+
paths = if paths then
|
599
|
+
paths.split(',').map { |d| d unless d.empty? }
|
600
|
+
end
|
539
601
|
|
540
|
-
|
541
|
-
|
602
|
+
paths.map do |path|
|
603
|
+
path = File.expand_path path
|
542
604
|
|
543
|
-
raise OptionParser::InvalidArgument unless File.exist?
|
605
|
+
raise OptionParser::InvalidArgument unless File.exist? path
|
544
606
|
|
545
|
-
|
607
|
+
path
|
546
608
|
end
|
547
609
|
end
|
548
610
|
|
@@ -554,9 +616,10 @@ Usage: #{opt.program_name} [options] [names...]
|
|
554
616
|
opt.on("--encoding=ENCODING", "-e", Encoding.list.map { |e| e.name },
|
555
617
|
"Specifies the output encoding. All files",
|
556
618
|
"read will be converted to this encoding.",
|
557
|
-
"
|
619
|
+
"The default encoding is UTF-8.",
|
620
|
+
"--encoding is preferred over --charset") do |value|
|
558
621
|
@encoding = Encoding.find value
|
559
|
-
@charset = @encoding.
|
622
|
+
@charset = @encoding.name # may not be valid value
|
560
623
|
end
|
561
624
|
|
562
625
|
opt.separator nil
|
@@ -634,6 +697,17 @@ Usage: #{opt.program_name} [options] [names...]
|
|
634
697
|
@markup = value
|
635
698
|
end
|
636
699
|
|
700
|
+
opt.separator nil
|
701
|
+
|
702
|
+
opt.on("--root=ROOT", Directory,
|
703
|
+
"Root of the source tree documentation",
|
704
|
+
"will be generated for. Set this when",
|
705
|
+
"building documentation outside the",
|
706
|
+
"source directory. Default is the",
|
707
|
+
"current directory.") do |root|
|
708
|
+
@root = Pathname(root)
|
709
|
+
end
|
710
|
+
|
637
711
|
opt.separator nil
|
638
712
|
opt.separator "Common generator options:"
|
639
713
|
opt.separator nil
|