rdoc 4.0.1 → 4.1.0.preview.3
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.autotest +1 -3
- data/{DEVELOPERS.rdoc → CONTRIBUTING.rdoc} +28 -3
- data/ExampleMarkdown.md +37 -0
- data/ExampleRDoc.rdoc +208 -0
- data/History.rdoc +81 -0
- data/Manifest.txt +11 -2
- data/README.rdoc +5 -5
- data/Rakefile +34 -4
- data/lib/rdoc.rb +4 -3
- data/lib/rdoc/any_method.rb +48 -4
- data/lib/rdoc/class_module.rb +16 -2
- data/lib/rdoc/code_object.rb +85 -24
- data/lib/rdoc/comment.rb +0 -3
- data/lib/rdoc/constant.rb +9 -1
- data/lib/rdoc/context.rb +20 -2
- data/lib/rdoc/cross_reference.rb +1 -1
- data/lib/rdoc/extend.rb +4 -112
- data/lib/rdoc/generator/darkfish.rb +46 -7
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +14 -8
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +4 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +3 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +4 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +3 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +9 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +12 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +5 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +6 -7
- data/lib/rdoc/generator/template/darkfish/class.rhtml +36 -41
- data/lib/rdoc/generator/template/darkfish/fonts.css +167 -0
- data/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +11 -7
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +0 -15
- data/lib/rdoc/generator/template/darkfish/js/search.js +12 -4
- data/lib/rdoc/generator/template/darkfish/page.rhtml +9 -9
- data/lib/rdoc/generator/template/darkfish/rdoc.css +226 -241
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +13 -6
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +17 -14
- data/lib/rdoc/include.rb +4 -114
- data/lib/rdoc/known_classes.rb +1 -0
- data/lib/rdoc/markdown.kpeg +126 -117
- data/lib/rdoc/markdown.rb +404 -389
- data/lib/rdoc/markdown/literals_1_8.kpeg +1 -1
- data/lib/rdoc/markdown/literals_1_8.rb +15 -12
- data/lib/rdoc/markdown/literals_1_9.kpeg +1 -1
- data/lib/rdoc/markdown/literals_1_9.rb +15 -12
- data/lib/rdoc/markup.rb +10 -13
- data/lib/rdoc/markup/attribute_manager.rb +3 -2
- data/lib/rdoc/markup/formatter.rb +3 -3
- data/lib/rdoc/markup/heading.rb +13 -0
- data/lib/rdoc/markup/parser.rb +10 -3
- data/lib/rdoc/markup/pre_process.rb +1 -1
- data/lib/rdoc/markup/to_html.rb +46 -31
- data/lib/rdoc/markup/to_html_crossref.rb +3 -0
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
- data/lib/rdoc/markup/to_markdown.rb +7 -5
- data/lib/rdoc/markup/verbatim.rb +1 -1
- data/lib/rdoc/method_attr.rb +13 -1
- data/lib/rdoc/mixin.rb +120 -0
- data/lib/rdoc/normal_class.rb +4 -0
- data/lib/rdoc/normal_module.rb +4 -0
- data/lib/rdoc/options.rb +42 -8
- data/lib/rdoc/parser.rb +4 -2
- data/lib/rdoc/parser/c.rb +13 -7
- data/lib/rdoc/parser/ruby.rb +683 -480
- data/lib/rdoc/rdoc.rb +4 -3
- data/lib/rdoc/ri/driver.rb +174 -103
- data/lib/rdoc/ri/paths.rb +6 -6
- data/lib/rdoc/ruby_lex.rb +125 -102
- data/lib/rdoc/ruby_token.rb +41 -40
- data/lib/rdoc/servlet.rb +16 -6
- data/lib/rdoc/stats.rb +61 -48
- data/lib/rdoc/store.rb +5 -3
- data/lib/rdoc/test_case.rb +39 -0
- data/lib/rdoc/tom_doc.rb +28 -4
- data/lib/rdoc/top_level.rb +2 -2
- data/test/test_rdoc_any_method.rb +104 -1
- data/test/test_rdoc_class_module.rb +9 -15
- data/test/test_rdoc_code_object.rb +133 -8
- data/test/test_rdoc_context.rb +17 -0
- data/test/test_rdoc_context_section.rb +0 -7
- data/test/test_rdoc_cross_reference.rb +4 -3
- data/test/test_rdoc_generator_darkfish.rb +61 -19
- data/test/test_rdoc_generator_json_index.rb +0 -11
- data/test/test_rdoc_generator_ri.rb +0 -8
- data/test/test_rdoc_markdown.rb +15 -12
- data/test/test_rdoc_markdown_test.rb +0 -7
- data/test/test_rdoc_markup_attribute_manager.rb +121 -0
- data/test/test_rdoc_markup_document.rb +0 -7
- data/test/test_rdoc_markup_formatter.rb +29 -3
- data/test/test_rdoc_markup_heading.rb +9 -0
- data/test/test_rdoc_markup_parser.rb +0 -7
- data/test/test_rdoc_markup_pre_process.rb +15 -3
- data/test/test_rdoc_markup_raw.rb +0 -7
- data/test/test_rdoc_markup_to_html.rb +50 -8
- data/test/test_rdoc_markup_to_html_crossref.rb +7 -0
- data/test/test_rdoc_markup_to_html_snippet.rb +4 -4
- data/test/test_rdoc_markup_to_markdown.rb +6 -0
- data/test/test_rdoc_method_attr.rb +8 -0
- data/test/test_rdoc_normal_class.rb +5 -0
- data/test/test_rdoc_normal_module.rb +5 -0
- data/test/test_rdoc_options.rb +61 -22
- data/test/test_rdoc_parser.rb +10 -0
- data/test/test_rdoc_parser_c.rb +17 -5
- data/test/test_rdoc_parser_changelog.rb +0 -7
- data/test/test_rdoc_parser_rd.rb +0 -7
- data/test/test_rdoc_parser_ruby.rb +305 -28
- data/test/test_rdoc_rd_block_parser.rb +0 -8
- data/test/test_rdoc_rd_inline_parser.rb +0 -1
- data/test/test_rdoc_rdoc.rb +27 -1
- data/test/test_rdoc_ri_driver.rb +19 -7
- data/test/test_rdoc_ruby_lex.rb +116 -9
- data/test/test_rdoc_rubygems_hook.rb +1 -1
- data/test/test_rdoc_servlet.rb +44 -6
- data/test/test_rdoc_stats.rb +161 -141
- data/test/test_rdoc_store.rb +11 -19
- data/test/test_rdoc_text.rb +0 -7
- data/test/test_rdoc_tom_doc.rb +44 -16
- data/test/xref_test_case.rb +2 -0
- metadata +28 -27
- metadata.gz.sig +0 -0
- data/test/test_attribute_manager.rb +0 -120
data/lib/rdoc/ruby_token.rb
CHANGED
@@ -276,50 +276,50 @@ module RDoc::RubyToken
|
|
276
276
|
end
|
277
277
|
|
278
278
|
TokenDefinitions = [
|
279
|
-
[:TkCLASS, TkKW, "class", EXPR_CLASS],
|
280
|
-
[:TkMODULE, TkKW, "module", EXPR_BEG],
|
281
|
-
[:TkDEF, TkKW, "def", EXPR_FNAME],
|
282
|
-
[:TkUNDEF, TkKW, "undef", EXPR_FNAME],
|
283
|
-
[:TkBEGIN, TkKW, "begin", EXPR_BEG],
|
284
|
-
[:TkRESCUE, TkKW, "rescue", EXPR_MID],
|
285
|
-
[:TkENSURE, TkKW, "ensure", EXPR_BEG],
|
286
|
-
[:TkEND, TkKW, "end", EXPR_END],
|
287
|
-
[:TkIF, TkKW, "if", EXPR_BEG, :TkIF_MOD],
|
288
|
-
[:TkUNLESS, TkKW, "unless", EXPR_BEG, :TkUNLESS_MOD],
|
289
|
-
[:TkTHEN, TkKW, "then", EXPR_BEG],
|
290
|
-
[:TkELSIF, TkKW, "elsif", EXPR_BEG],
|
291
|
-
[:TkELSE, TkKW, "else", EXPR_BEG],
|
292
|
-
[:TkCASE, TkKW, "case", EXPR_BEG],
|
293
|
-
[:TkWHEN, TkKW, "when", EXPR_BEG],
|
294
|
-
[:TkWHILE, TkKW, "while", EXPR_BEG, :TkWHILE_MOD],
|
295
|
-
[:TkUNTIL, TkKW, "until", EXPR_BEG, :TkUNTIL_MOD],
|
296
|
-
[:TkFOR, TkKW, "for", EXPR_BEG],
|
297
|
-
[:TkBREAK, TkKW, "break", EXPR_MID],
|
298
|
-
[:TkNEXT, TkKW, "next", EXPR_END],
|
299
|
-
[:TkREDO, TkKW, "redo", EXPR_END],
|
300
|
-
[:TkRETRY, TkKW, "retry", EXPR_END],
|
301
|
-
[:TkIN, TkKW, "in", EXPR_BEG],
|
302
|
-
[:TkDO, TkKW, "do", EXPR_BEG],
|
303
|
-
[:TkRETURN, TkKW, "return", EXPR_MID],
|
304
|
-
[:TkYIELD, TkKW, "yield", EXPR_END],
|
305
|
-
[:TkSUPER, TkKW, "super", EXPR_END],
|
306
|
-
[:TkSELF, TkKW, "self", EXPR_END],
|
307
|
-
[:TkNIL, TkKW, "nil", EXPR_END],
|
308
|
-
[:TkTRUE, TkKW, "true", EXPR_END],
|
309
|
-
[:TkFALSE, TkKW, "false", EXPR_END],
|
310
|
-
[:TkAND, TkKW, "and", EXPR_BEG],
|
311
|
-
[:TkOR, TkKW, "or", EXPR_BEG],
|
312
|
-
[:TkNOT, TkKW, "not", EXPR_BEG],
|
279
|
+
[:TkCLASS, TkKW, "class", :EXPR_CLASS],
|
280
|
+
[:TkMODULE, TkKW, "module", :EXPR_BEG],
|
281
|
+
[:TkDEF, TkKW, "def", :EXPR_FNAME],
|
282
|
+
[:TkUNDEF, TkKW, "undef", :EXPR_FNAME],
|
283
|
+
[:TkBEGIN, TkKW, "begin", :EXPR_BEG],
|
284
|
+
[:TkRESCUE, TkKW, "rescue", :EXPR_MID],
|
285
|
+
[:TkENSURE, TkKW, "ensure", :EXPR_BEG],
|
286
|
+
[:TkEND, TkKW, "end", :EXPR_END],
|
287
|
+
[:TkIF, TkKW, "if", :EXPR_BEG, :TkIF_MOD],
|
288
|
+
[:TkUNLESS, TkKW, "unless", :EXPR_BEG, :TkUNLESS_MOD],
|
289
|
+
[:TkTHEN, TkKW, "then", :EXPR_BEG],
|
290
|
+
[:TkELSIF, TkKW, "elsif", :EXPR_BEG],
|
291
|
+
[:TkELSE, TkKW, "else", :EXPR_BEG],
|
292
|
+
[:TkCASE, TkKW, "case", :EXPR_BEG],
|
293
|
+
[:TkWHEN, TkKW, "when", :EXPR_BEG],
|
294
|
+
[:TkWHILE, TkKW, "while", :EXPR_BEG, :TkWHILE_MOD],
|
295
|
+
[:TkUNTIL, TkKW, "until", :EXPR_BEG, :TkUNTIL_MOD],
|
296
|
+
[:TkFOR, TkKW, "for", :EXPR_BEG],
|
297
|
+
[:TkBREAK, TkKW, "break", :EXPR_MID],
|
298
|
+
[:TkNEXT, TkKW, "next", :EXPR_END],
|
299
|
+
[:TkREDO, TkKW, "redo", :EXPR_END],
|
300
|
+
[:TkRETRY, TkKW, "retry", :EXPR_END],
|
301
|
+
[:TkIN, TkKW, "in", :EXPR_BEG],
|
302
|
+
[:TkDO, TkKW, "do", :EXPR_BEG],
|
303
|
+
[:TkRETURN, TkKW, "return", :EXPR_MID],
|
304
|
+
[:TkYIELD, TkKW, "yield", :EXPR_END],
|
305
|
+
[:TkSUPER, TkKW, "super", :EXPR_END],
|
306
|
+
[:TkSELF, TkKW, "self", :EXPR_END],
|
307
|
+
[:TkNIL, TkKW, "nil", :EXPR_END],
|
308
|
+
[:TkTRUE, TkKW, "true", :EXPR_END],
|
309
|
+
[:TkFALSE, TkKW, "false", :EXPR_END],
|
310
|
+
[:TkAND, TkKW, "and", :EXPR_BEG],
|
311
|
+
[:TkOR, TkKW, "or", :EXPR_BEG],
|
312
|
+
[:TkNOT, TkKW, "not", :EXPR_BEG],
|
313
313
|
[:TkIF_MOD, TkKW],
|
314
314
|
[:TkUNLESS_MOD, TkKW],
|
315
315
|
[:TkWHILE_MOD, TkKW],
|
316
316
|
[:TkUNTIL_MOD, TkKW],
|
317
|
-
[:TkALIAS, TkKW, "alias", EXPR_FNAME],
|
318
|
-
[:TkDEFINED, TkKW, "defined?", EXPR_END],
|
319
|
-
[:TklBEGIN, TkKW, "BEGIN", EXPR_END],
|
320
|
-
[:TklEND, TkKW, "END", EXPR_END],
|
321
|
-
[:Tk__LINE__, TkKW, "__LINE__", EXPR_END],
|
322
|
-
[:Tk__FILE__, TkKW, "__FILE__", EXPR_END],
|
317
|
+
[:TkALIAS, TkKW, "alias", :EXPR_FNAME],
|
318
|
+
[:TkDEFINED, TkKW, "defined?", :EXPR_END],
|
319
|
+
[:TklBEGIN, TkKW, "BEGIN", :EXPR_END],
|
320
|
+
[:TklEND, TkKW, "END", :EXPR_END],
|
321
|
+
[:Tk__LINE__, TkKW, "__LINE__", :EXPR_END],
|
322
|
+
[:Tk__FILE__, TkKW, "__FILE__", :EXPR_END],
|
323
323
|
|
324
324
|
[:TkIDENTIFIER, TkId],
|
325
325
|
[:TkFID, TkId],
|
@@ -335,6 +335,7 @@ module RDoc::RubyToken
|
|
335
335
|
[:TkXSTRING, TkVal],
|
336
336
|
[:TkREGEXP, TkVal],
|
337
337
|
[:TkSYMBOL, TkVal],
|
338
|
+
[:TkCHAR, TkVal],
|
338
339
|
|
339
340
|
[:TkDSTRING, TkNode],
|
340
341
|
[:TkDXSTRING, TkNode],
|
data/lib/rdoc/servlet.rb
CHANGED
@@ -124,6 +124,10 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
124
124
|
else
|
125
125
|
show_documentation req, res
|
126
126
|
end
|
127
|
+
rescue WEBrick::HTTPStatus::NotFound => e
|
128
|
+
generator = generator_for RDoc::Store.new
|
129
|
+
|
130
|
+
not_found generator, req, res, e.message
|
127
131
|
rescue WEBrick::HTTPStatus::Status
|
128
132
|
raise
|
129
133
|
rescue => e
|
@@ -300,8 +304,9 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
300
304
|
##
|
301
305
|
# Returns a 404 page built by +generator+ for +req+ on +res+.
|
302
306
|
|
303
|
-
def not_found generator, req, res
|
304
|
-
|
307
|
+
def not_found generator, req, res, message = nil
|
308
|
+
message ||= "The page <kbd>#{ERB::Util.h req.path}</kbd> was not found"
|
309
|
+
res.body = generator.generate_servlet_not_found message
|
305
310
|
res.status = 404
|
306
311
|
end
|
307
312
|
|
@@ -419,11 +424,16 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
419
424
|
source_name == dir[%r%/([^/]*)/ri$%, 1]
|
420
425
|
end
|
421
426
|
|
422
|
-
raise
|
423
|
-
"
|
424
|
-
|
427
|
+
raise WEBrick::HTTPStatus::NotFound,
|
428
|
+
"Could not find gem \"#{source_name}\". Are you sure you installed it?" unless ri_dir
|
429
|
+
|
430
|
+
store = RDoc::Store.new ri_dir, type
|
431
|
+
|
432
|
+
return store if File.exist? store.cache_path
|
433
|
+
|
434
|
+
raise WEBrick::HTTPStatus::NotFound,
|
435
|
+
"Could not find documentation for \"#{source_name}\". Please run `gem rdoc --ri gem_name`"
|
425
436
|
|
426
|
-
RDoc::Store.new ri_dir, type
|
427
437
|
end
|
428
438
|
end
|
429
439
|
|
data/lib/rdoc/stats.rb
CHANGED
@@ -187,12 +187,12 @@ class RDoc::Stats
|
|
187
187
|
# A report that says you did a great job!
|
188
188
|
|
189
189
|
def great_job
|
190
|
-
report =
|
191
|
-
|
192
|
-
report <<
|
193
|
-
report << 'Great Job!'
|
190
|
+
report = RDoc::Markup::Document.new
|
191
|
+
|
192
|
+
report << RDoc::Markup::Paragraph.new('100% documentation!')
|
193
|
+
report << RDoc::Markup::Paragraph.new('Great Job!')
|
194
194
|
|
195
|
-
report
|
195
|
+
report
|
196
196
|
end
|
197
197
|
|
198
198
|
##
|
@@ -217,8 +217,6 @@ class RDoc::Stats
|
|
217
217
|
extend RDoc::Text
|
218
218
|
end
|
219
219
|
|
220
|
-
report = []
|
221
|
-
|
222
220
|
if @coverage_level.zero? then
|
223
221
|
calculate
|
224
222
|
|
@@ -227,14 +225,20 @@ class RDoc::Stats
|
|
227
225
|
|
228
226
|
ucm = @store.unique_classes_and_modules
|
229
227
|
|
228
|
+
report = RDoc::Markup::Document.new
|
229
|
+
report << RDoc::Markup::Paragraph.new('The following items are not documented:')
|
230
|
+
report << RDoc::Markup::BlankLine.new
|
231
|
+
|
230
232
|
ucm.sort.each do |cm|
|
231
|
-
|
233
|
+
body = report_class_module(cm) {
|
232
234
|
[
|
233
235
|
report_constants(cm),
|
234
236
|
report_attributes(cm),
|
235
237
|
report_methods(cm),
|
236
238
|
].compact
|
237
239
|
}
|
240
|
+
|
241
|
+
report << body if body
|
238
242
|
end
|
239
243
|
|
240
244
|
if @coverage_level > 0 then
|
@@ -243,10 +247,7 @@ class RDoc::Stats
|
|
243
247
|
return great_job if @num_items == @doc_items
|
244
248
|
end
|
245
249
|
|
246
|
-
report
|
247
|
-
report.unshift 'The following items are not documented:'
|
248
|
-
|
249
|
-
report.join "\n"
|
250
|
+
report
|
250
251
|
end
|
251
252
|
|
252
253
|
##
|
@@ -260,7 +261,8 @@ class RDoc::Stats
|
|
260
261
|
cm.each_attribute do |attr|
|
261
262
|
next if attr.documented?
|
262
263
|
line = attr.line ? ":#{attr.line}" : nil
|
263
|
-
report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}"
|
264
|
+
report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}\n"
|
265
|
+
report << "\n"
|
264
266
|
end
|
265
267
|
|
266
268
|
report
|
@@ -273,38 +275,47 @@ class RDoc::Stats
|
|
273
275
|
return if cm.fully_documented? and @coverage_level.zero?
|
274
276
|
return unless cm.display?
|
275
277
|
|
276
|
-
report =
|
278
|
+
report = RDoc::Markup::Document.new
|
277
279
|
|
278
280
|
if cm.in_files.empty? then
|
279
|
-
report << "#
|
280
|
-
report << "
|
281
|
-
report << "# It probably came from another project. I'm sorry I'm holding it against you."
|
282
|
-
report << nil
|
281
|
+
report << RDoc::Markup::Paragraph.new("#{cm.definition} is referenced but empty.")
|
282
|
+
report << RDoc::Markup::Paragraph.new("It probably came from another project. I'm sorry I'm holding it against you.")
|
283
283
|
|
284
284
|
return report
|
285
285
|
elsif cm.documented? then
|
286
286
|
documented = true
|
287
|
-
|
287
|
+
klass = RDoc::Markup::Verbatim.new("#{cm.definition} # is documented\n")
|
288
288
|
else
|
289
|
-
report << '
|
289
|
+
report << RDoc::Markup::Paragraph.new('In files:')
|
290
|
+
|
291
|
+
list = RDoc::Markup::List.new :BULLET
|
290
292
|
|
291
293
|
cm.in_files.each do |file|
|
292
|
-
|
294
|
+
para = RDoc::Markup::Paragraph.new file.full_name
|
295
|
+
list << RDoc::Markup::ListItem.new(nil, para)
|
293
296
|
end
|
294
297
|
|
295
|
-
report <<
|
298
|
+
report << list
|
299
|
+
report << RDoc::Markup::BlankLine.new
|
296
300
|
|
297
|
-
|
301
|
+
klass = RDoc::Markup::Verbatim.new("#{cm.definition}\n")
|
298
302
|
end
|
299
303
|
|
304
|
+
klass << "\n"
|
305
|
+
|
300
306
|
body = yield.flatten # HACK remove #flatten
|
301
307
|
|
302
|
-
|
308
|
+
if body.empty? then
|
309
|
+
return if documented
|
310
|
+
|
311
|
+
klass.parts.pop
|
312
|
+
else
|
313
|
+
klass.parts.concat body
|
314
|
+
end
|
303
315
|
|
304
|
-
|
316
|
+
klass << "end\n"
|
305
317
|
|
306
|
-
report <<
|
307
|
-
report << nil
|
318
|
+
report << klass
|
308
319
|
|
309
320
|
report
|
310
321
|
end
|
@@ -323,8 +334,9 @@ class RDoc::Stats
|
|
323
334
|
next if constant.documented? || constant.is_alias_for
|
324
335
|
|
325
336
|
line = constant.line ? ":#{constant.line}" : line
|
326
|
-
report << " # in file #{constant.file.full_name}#{line}"
|
327
|
-
report << " #{constant.name} = nil"
|
337
|
+
report << " # in file #{constant.file.full_name}#{line}\n"
|
338
|
+
report << " #{constant.name} = nil\n"
|
339
|
+
report << "\n"
|
328
340
|
end
|
329
341
|
|
330
342
|
report
|
@@ -350,7 +362,7 @@ class RDoc::Stats
|
|
350
362
|
@undoc_params += undoc.length
|
351
363
|
|
352
364
|
undoc = undoc.map do |param| "+#{param}+" end
|
353
|
-
param_report = " # #{undoc.join ', '} is not documented"
|
365
|
+
param_report = " # #{undoc.join ', '} is not documented\n"
|
354
366
|
end
|
355
367
|
end
|
356
368
|
|
@@ -359,10 +371,10 @@ class RDoc::Stats
|
|
359
371
|
line = method.line ? ":#{method.line}" : nil
|
360
372
|
scope = method.singleton ? 'self.' : nil
|
361
373
|
|
362
|
-
report << " # in file #{method.file.full_name}#{line}"
|
374
|
+
report << " # in file #{method.file.full_name}#{line}\n"
|
363
375
|
report << param_report if param_report
|
364
|
-
report << " def #{scope}#{method.name}#{method.params}; end"
|
365
|
-
report <<
|
376
|
+
report << " def #{scope}#{method.name}#{method.params}; end\n"
|
377
|
+
report << "\n"
|
366
378
|
end
|
367
379
|
|
368
380
|
report
|
@@ -385,35 +397,36 @@ class RDoc::Stats
|
|
385
397
|
@undoc_params,
|
386
398
|
].max.to_s.length
|
387
399
|
|
388
|
-
report =
|
389
|
-
|
400
|
+
report = RDoc::Markup::Verbatim.new
|
401
|
+
|
402
|
+
report << "Files: %*d\n" % [num_width, @num_files]
|
390
403
|
|
391
|
-
report <<
|
404
|
+
report << "\n"
|
392
405
|
|
393
|
-
report <<
|
406
|
+
report << "Classes: %*d (%*d undocumented)\n" % [
|
394
407
|
num_width, @num_classes, undoc_width, @undoc_classes]
|
395
|
-
report <<
|
408
|
+
report << "Modules: %*d (%*d undocumented)\n" % [
|
396
409
|
num_width, @num_modules, undoc_width, @undoc_modules]
|
397
|
-
report <<
|
410
|
+
report << "Constants: %*d (%*d undocumented)\n" % [
|
398
411
|
num_width, @num_constants, undoc_width, @undoc_constants]
|
399
|
-
report <<
|
412
|
+
report << "Attributes: %*d (%*d undocumented)\n" % [
|
400
413
|
num_width, @num_attributes, undoc_width, @undoc_attributes]
|
401
|
-
report <<
|
414
|
+
report << "Methods: %*d (%*d undocumented)\n" % [
|
402
415
|
num_width, @num_methods, undoc_width, @undoc_methods]
|
403
|
-
report <<
|
416
|
+
report << "Parameters: %*d (%*d undocumented)\n" % [
|
404
417
|
num_width, @num_params, undoc_width, @undoc_params] if
|
405
418
|
@coverage_level > 0
|
406
419
|
|
407
|
-
report <<
|
420
|
+
report << "\n"
|
408
421
|
|
409
|
-
report <<
|
422
|
+
report << "Total: %*d (%*d undocumented)\n" % [
|
410
423
|
num_width, @num_items, undoc_width, @undoc_items]
|
411
424
|
|
412
|
-
report <<
|
413
|
-
report <<
|
414
|
-
report <<
|
425
|
+
report << "%6.2f%% documented\n" % percent_doc
|
426
|
+
report << "\n"
|
427
|
+
report << "Elapsed: %0.1fs\n" % (Time.now - @start)
|
415
428
|
|
416
|
-
|
429
|
+
RDoc::Markup::Document.new report
|
417
430
|
end
|
418
431
|
|
419
432
|
##
|
data/lib/rdoc/store.rb
CHANGED
@@ -305,8 +305,10 @@ class RDoc::Store
|
|
305
305
|
# cache included modules before they are removed from the documentation
|
306
306
|
all_classes_and_modules.each { |cm| cm.ancestors }
|
307
307
|
|
308
|
-
|
309
|
-
|
308
|
+
unless min_visibility == :nodoc then
|
309
|
+
remove_nodoc @classes_hash
|
310
|
+
remove_nodoc @modules_hash
|
311
|
+
end
|
310
312
|
|
311
313
|
@unique_classes = find_unique @classes_hash
|
312
314
|
@unique_modules = find_unique @modules_hash
|
@@ -661,7 +663,7 @@ class RDoc::Store
|
|
661
663
|
end
|
662
664
|
|
663
665
|
##
|
664
|
-
# Converts the variable => ClassModule map +variables+ from a C parser into
|
666
|
+
# Converts the variable => ClassModule map +variables+ from a C parser into
|
665
667
|
# a variable => class name map.
|
666
668
|
|
667
669
|
def make_variable_map variables
|
data/lib/rdoc/test_case.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
|
3
|
+
begin
|
4
|
+
gem 'minitest', '~> 4.0' unless defined?(Test::Unit)
|
5
|
+
rescue NoMethodError
|
6
|
+
# for ruby tests
|
7
|
+
end
|
8
|
+
|
2
9
|
require 'minitest/autorun'
|
3
10
|
require 'minitest/benchmark' if ENV['BENCHMARK']
|
4
11
|
|
@@ -45,6 +52,7 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
|
|
45
52
|
|
46
53
|
@rdoc = RDoc::RDoc.new
|
47
54
|
@rdoc.store = @store
|
55
|
+
@rdoc.options = RDoc::Options.new
|
48
56
|
|
49
57
|
g = Object.new
|
50
58
|
def g.class_dir() end
|
@@ -52,6 +60,27 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
|
|
52
60
|
@rdoc.generator = g
|
53
61
|
end
|
54
62
|
|
63
|
+
##
|
64
|
+
# Asserts +path+ is a file
|
65
|
+
|
66
|
+
def assert_file path
|
67
|
+
assert File.file?(path), "#{path} is not a file"
|
68
|
+
end
|
69
|
+
|
70
|
+
##
|
71
|
+
# Asserts +path+ is a directory
|
72
|
+
|
73
|
+
def assert_directory path
|
74
|
+
assert File.directory?(path), "#{path} is not a directory"
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# Refutes +path+ exists
|
79
|
+
|
80
|
+
def refute_file path
|
81
|
+
refute File.exist?(path), "#{path} exists"
|
82
|
+
end
|
83
|
+
|
55
84
|
##
|
56
85
|
# Shortcut for RDoc::Markup::BlankLine.new
|
57
86
|
|
@@ -109,6 +138,16 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
|
|
109
138
|
@RM::List.new type, *items
|
110
139
|
end
|
111
140
|
|
141
|
+
##
|
142
|
+
# Enables pretty-print output
|
143
|
+
|
144
|
+
def mu_pp obj # :nodoc:
|
145
|
+
s = ''
|
146
|
+
s = PP.pp obj, s
|
147
|
+
s = s.force_encoding Encoding.default_external if defined? Encoding
|
148
|
+
s.chomp
|
149
|
+
end
|
150
|
+
|
112
151
|
##
|
113
152
|
# Shortcut for RDoc::Markup::Paragraph.new with +contents+
|
114
153
|
|
data/lib/rdoc/tom_doc.rb
CHANGED
@@ -129,7 +129,8 @@ class RDoc::TomDoc < RDoc::Markup::Parser
|
|
129
129
|
def initialize
|
130
130
|
super
|
131
131
|
|
132
|
-
@section
|
132
|
+
@section = nil
|
133
|
+
@seen_returns = false
|
133
134
|
end
|
134
135
|
|
135
136
|
# Internal: Builds a heading from the token stream
|
@@ -147,7 +148,7 @@ class RDoc::TomDoc < RDoc::Markup::Parser
|
|
147
148
|
end
|
148
149
|
|
149
150
|
# Internal: Builds a verbatim from the token stream. A verbatim in the
|
150
|
-
# Examples section will be marked as in
|
151
|
+
# Examples section will be marked as in Ruby format.
|
151
152
|
#
|
152
153
|
# margin - The indentation from the margin for lines that belong to this
|
153
154
|
# verbatim section.
|
@@ -176,9 +177,17 @@ class RDoc::TomDoc < RDoc::Markup::Parser
|
|
176
177
|
until @tokens.empty? do
|
177
178
|
type, data, = get
|
178
179
|
|
179
|
-
|
180
|
+
case type
|
181
|
+
when :TEXT then
|
182
|
+
@section = 'Returns' if data =~ /\AReturns/
|
183
|
+
|
180
184
|
paragraph << data
|
181
|
-
|
185
|
+
when :NEWLINE then
|
186
|
+
if :TEXT == peek_token[0] then
|
187
|
+
paragraph << ' '
|
188
|
+
else
|
189
|
+
break
|
190
|
+
end
|
182
191
|
else
|
183
192
|
unget
|
184
193
|
break
|
@@ -190,6 +199,21 @@ class RDoc::TomDoc < RDoc::Markup::Parser
|
|
190
199
|
paragraph
|
191
200
|
end
|
192
201
|
|
202
|
+
##
|
203
|
+
# Detects a section change to "Returns" and adds a heading
|
204
|
+
|
205
|
+
def parse_text parent, indent # :nodoc:
|
206
|
+
paragraph = build_paragraph indent
|
207
|
+
|
208
|
+
if false == @seen_returns and 'Returns' == @section then
|
209
|
+
@seen_returns = true
|
210
|
+
parent << RDoc::Markup::Heading.new(3, 'Returns')
|
211
|
+
parent << RDoc::Markup::BlankLine.new
|
212
|
+
end
|
213
|
+
|
214
|
+
parent << paragraph
|
215
|
+
end
|
216
|
+
|
193
217
|
# Internal: Turns text into an Array of tokens
|
194
218
|
#
|
195
219
|
# text - A String containing TomDoc-format text.
|