rdoc 6.7.0 → 6.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/ExampleMarkdown.md +2 -0
  3. data/ExampleRDoc.rdoc +2 -0
  4. data/History.rdoc +64 -62
  5. data/LICENSE.rdoc +2 -0
  6. data/README.rdoc +13 -0
  7. data/RI.md +842 -0
  8. data/TODO.rdoc +8 -7
  9. data/lib/rdoc/{alias.rb → code_object/alias.rb} +3 -10
  10. data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +7 -12
  11. data/lib/rdoc/{attr.rb → code_object/attr.rb} +4 -7
  12. data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +107 -20
  13. data/lib/rdoc/{constant.rb → code_object/constant.rb} +1 -1
  14. data/lib/rdoc/{context → code_object/context}/section.rb +10 -68
  15. data/lib/rdoc/{context.rb → code_object/context.rb} +4 -46
  16. data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +19 -27
  17. data/lib/rdoc/{require.rb → code_object/require.rb} +1 -1
  18. data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +10 -28
  19. data/lib/rdoc/code_object.rb +6 -32
  20. data/lib/rdoc/comment.rb +12 -5
  21. data/lib/rdoc/generator/darkfish.rb +121 -95
  22. data/lib/rdoc/generator/json_index.rb +1 -17
  23. data/lib/rdoc/generator/markup.rb +2 -2
  24. data/lib/rdoc/generator/pot/message_extractor.rb +3 -3
  25. data/lib/rdoc/generator/pot/po_entry.rb +1 -1
  26. data/lib/rdoc/generator/pot.rb +0 -5
  27. data/lib/rdoc/generator/template/darkfish/_head.rhtml +23 -0
  28. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -29
  29. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
  30. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +20 -11
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +3 -8
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  34. data/lib/rdoc/generator/template/darkfish/class.rhtml +84 -43
  35. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +391 -397
  36. data/lib/rdoc/generator/template/darkfish/index.rhtml +11 -10
  37. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +24 -1
  38. data/lib/rdoc/generator/template/darkfish/page.rhtml +5 -5
  39. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +10 -8
  40. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +5 -2
  41. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +11 -0
  42. data/lib/rdoc/markdown.kpeg +8 -6
  43. data/lib/rdoc/markdown.rb +55 -32
  44. data/lib/rdoc/markup/attribute_manager.rb +2 -2
  45. data/lib/rdoc/markup/formatter.rb +19 -12
  46. data/lib/rdoc/markup/heading.rb +7 -1
  47. data/lib/rdoc/markup/pre_process.rb +26 -6
  48. data/lib/rdoc/markup/to_bs.rb +1 -1
  49. data/lib/rdoc/markup/to_html.rb +7 -2
  50. data/lib/rdoc/markup/to_html_crossref.rb +63 -12
  51. data/lib/rdoc/markup/to_rdoc.rb +5 -5
  52. data/lib/rdoc/markup.rb +18 -13
  53. data/lib/rdoc/options.rb +90 -12
  54. data/lib/rdoc/parser/c.rb +30 -9
  55. data/lib/rdoc/parser/changelog.rb +5 -4
  56. data/lib/rdoc/parser/prism_ruby.rb +1092 -0
  57. data/lib/rdoc/parser/ripper_state_lex.rb +7 -305
  58. data/lib/rdoc/parser/ruby.rb +23 -17
  59. data/lib/rdoc/parser/simple.rb +1 -1
  60. data/lib/rdoc/parser.rb +5 -4
  61. data/lib/rdoc/rd/block_parser.rb +3 -3
  62. data/lib/rdoc/rd/inline_parser.rb +3 -3
  63. data/lib/rdoc/rdoc.rb +9 -21
  64. data/lib/rdoc/ri/driver.rb +85 -32
  65. data/lib/rdoc/rubygems_hook.rb +91 -15
  66. data/lib/rdoc/servlet.rb +8 -7
  67. data/lib/rdoc/stats.rb +2 -2
  68. data/lib/rdoc/store.rb +21 -13
  69. data/lib/rdoc/task.rb +2 -3
  70. data/lib/rdoc/text.rb +2 -2
  71. data/lib/rdoc/tom_doc.rb +1 -7
  72. data/lib/rdoc/version.rb +1 -1
  73. data/lib/rdoc.rb +22 -24
  74. data/lib/rubygems_plugin.rb +23 -0
  75. metadata +27 -28
  76. data/RI.rdoc +0 -57
  77. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  78. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  79. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
  80. data/lib/rdoc/generator/template/json_index/.document +0 -1
  81. /data/lib/rdoc/{anon_class.rb → code_object/anon_class.rb} +0 -0
  82. /data/lib/rdoc/{extend.rb → code_object/extend.rb} +0 -0
  83. /data/lib/rdoc/{ghost_method.rb → code_object/ghost_method.rb} +0 -0
  84. /data/lib/rdoc/{include.rb → code_object/include.rb} +0 -0
  85. /data/lib/rdoc/{meta_method.rb → code_object/meta_method.rb} +0 -0
  86. /data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +0 -0
  87. /data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +0 -0
  88. /data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +0 -0
  89. /data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +0 -0
@@ -79,6 +79,7 @@ class RDoc::RI::Driver
79
79
  options[:interactive] = false
80
80
  options[:profile] = false
81
81
  options[:show_all] = false
82
+ options[:expand_refs] = true
82
83
  options[:use_stdout] = !$stdout.tty?
83
84
  options[:width] = 72
84
85
 
@@ -110,10 +111,6 @@ class RDoc::RI::Driver
110
111
  options = default_options
111
112
 
112
113
  opts = OptionParser.new do |opt|
113
- opt.accept File do |file,|
114
- File.readable?(file) and not File.directory?(file) and file
115
- end
116
-
117
114
  opt.program_name = File.basename $0
118
115
  opt.version = RDoc::VERSION
119
116
  opt.release = nil
@@ -249,6 +246,12 @@ or the PAGER environment variable.
249
246
 
250
247
  opt.separator nil
251
248
 
249
+ opt.on("--[no-]expand-refs", "Expand rdoc-refs at the end of output") do |value|
250
+ options[:expand_refs] = value
251
+ end
252
+
253
+ opt.separator nil
254
+
252
255
  opt.on("--help", "-h",
253
256
  "Show help and exit.") do
254
257
  puts opts
@@ -345,9 +348,17 @@ or the PAGER environment variable.
345
348
 
346
349
  opt.separator nil
347
350
 
348
- opt.on("--dump=CACHE", File,
351
+ opt.on("--dump=CACHE",
349
352
  "Dump data from an ri cache or data file.") do |value|
350
- options[:dump_path] = value
353
+ unless File.readable?(value)
354
+ abort "#{value.inspect} is not readable"
355
+ end
356
+
357
+ if File.directory?(value)
358
+ abort "#{value.inspect} is a directory"
359
+ end
360
+
361
+ options[:dump_path] = File.new(value)
351
362
  end
352
363
  end
353
364
 
@@ -409,7 +420,7 @@ or the PAGER environment variable.
409
420
  *options[:extra_doc_dirs]) do |path, type|
410
421
  @doc_dirs << path
411
422
 
412
- store = RDoc::RI::Store.new path, type
423
+ store = RDoc::RI::Store.new(RDoc::Options.new, path: path, type: type)
413
424
  store.load_cache
414
425
  @stores << store
415
426
  end
@@ -421,6 +432,7 @@ or the PAGER environment variable.
421
432
  @use_stdout = options[:use_stdout]
422
433
  @show_all = options[:show_all]
423
434
  @width = options[:width]
435
+ @expand_refs = options[:expand_refs]
424
436
  end
425
437
 
426
438
  ##
@@ -506,7 +518,7 @@ or the PAGER environment variable.
506
518
  with.each do |incl|
507
519
  out << RDoc::Markup::Paragraph.new(incl.name)
508
520
  out << RDoc::Markup::BlankLine.new
509
- out << incl.comment
521
+ out << incl.comment.parse
510
522
  end
511
523
 
512
524
  unless wout.empty? then
@@ -530,7 +542,7 @@ or the PAGER environment variable.
530
542
 
531
543
  if include.comment then
532
544
  out << RDoc::Markup::BlankLine.new
533
- out << include.comment
545
+ out << include.comment.parse
534
546
  end
535
547
  end
536
548
 
@@ -545,11 +557,8 @@ or the PAGER environment variable.
545
557
  # Looks up the method +name+ and adds it to +out+
546
558
 
547
559
  def add_method out, name
548
- filtered = lookup_method name
549
-
550
- method_out = method_document name, filtered
551
-
552
- out.concat method_out.parts
560
+ filtered = lookup_method name
561
+ method_document out, name, filtered
553
562
  end
554
563
 
555
564
  ##
@@ -641,18 +650,19 @@ or the PAGER environment variable.
641
650
 
642
651
  add_also_in out, also_in
643
652
 
653
+ expand_rdoc_refs_at_the_bottom(out)
644
654
  out
645
655
  end
646
656
 
647
657
  ##
648
658
  # Adds the class +comment+ to +out+.
649
659
 
650
- def class_document_comment out, comment # :nodoc:
651
- unless comment.empty? then
660
+ def class_document_comment out, document # :nodoc:
661
+ unless document.empty? then
652
662
  out << RDoc::Markup::Rule.new(1)
653
663
 
654
- if comment.merged? then
655
- parts = comment.parts
664
+ if document.merged? then
665
+ parts = document.parts
656
666
  parts = parts.zip [RDoc::Markup::BlankLine.new] * parts.length
657
667
  parts.flatten!
658
668
  parts.pop
@@ -677,7 +687,7 @@ or the PAGER environment variable.
677
687
  constants = klass.constants.sort_by { |constant| constant.name }
678
688
 
679
689
  list.items.concat constants.map { |constant|
680
- parts = constant.comment.parts if constant.comment
690
+ parts = constant.comment.parse.parts
681
691
  parts << RDoc::Markup::Paragraph.new('[not documented]') if
682
692
  parts.empty?
683
693
 
@@ -744,7 +754,7 @@ or the PAGER environment variable.
744
754
  complete_klass name, klass, selector, method, completions
745
755
  complete_method name, klass, selector, completions
746
756
 
747
- completions.sort.uniq
757
+ completions.uniq.select {|s| s.start_with? name }.sort
748
758
  end
749
759
 
750
760
  def complete_klass name, klass, selector, method, completions # :nodoc:
@@ -779,7 +789,15 @@ or the PAGER environment variable.
779
789
  completions << "#{klass}#{selector}"
780
790
  end
781
791
 
782
- completions.concat methods
792
+ methods.each do |klass_sel_method|
793
+ match = klass_sel_method.match(/^(.+)(#|\.|::)([^#.:]+)$/)
794
+ # match[2] is `::` for class method and `#` for instance method.
795
+ # To be consistent with old completion that completes `['Foo#i', 'Foo::c']` for `Foo.`,
796
+ # `.` should be a wildcard for both `#` and `::` here.
797
+ if match && match[2] == selector || selector == '.'
798
+ completions << match[1] + selector + match[3]
799
+ end
800
+ end
783
801
  end
784
802
  end
785
803
 
@@ -820,6 +838,8 @@ or the PAGER environment variable.
820
838
 
821
839
  add_method out, name
822
840
 
841
+ expand_rdoc_refs_at_the_bottom(out)
842
+
823
843
  display out
824
844
  end
825
845
 
@@ -894,7 +914,7 @@ or the PAGER environment variable.
894
914
 
895
915
  page = store.load_page page_name
896
916
 
897
- display page.comment
917
+ display page.comment.parse
898
918
  end
899
919
 
900
920
  ##
@@ -1195,7 +1215,8 @@ or the PAGER environment variable.
1195
1215
 
1196
1216
  store.load_method klass, "#{type}#{method}"
1197
1217
  rescue RDoc::Store::MissingFileError => e
1198
- comment = RDoc::Comment.new("missing documentation at #{e.file}").parse
1218
+ comment = RDoc::Comment.new("missing documentation at #{e.file}")
1219
+ comment.parse
1199
1220
 
1200
1221
  method = RDoc::AnyMethod.new nil, name
1201
1222
  method.comment = comment
@@ -1251,9 +1272,7 @@ or the PAGER environment variable.
1251
1272
  ##
1252
1273
  # Builds a RDoc::Markup::Document from +found+, +klasses+ and +includes+
1253
1274
 
1254
- def method_document name, filtered
1255
- out = RDoc::Markup::Document.new
1256
-
1275
+ def method_document out, name, filtered
1257
1276
  out << RDoc::Markup::Heading.new(1, name)
1258
1277
  out << RDoc::Markup::BlankLine.new
1259
1278
 
@@ -1357,13 +1376,13 @@ or the PAGER environment variable.
1357
1376
  # documentable items the class is added to +also_in+ instead.
1358
1377
 
1359
1378
  def render_class out, store, klass, also_in # :nodoc:
1360
- comment = klass.comment
1379
+ document = klass.comment.parse
1361
1380
  # TODO the store's cache should always return an empty Array
1362
1381
  class_methods = store.class_methods[klass.full_name] || []
1363
1382
  instance_methods = store.instance_methods[klass.full_name] || []
1364
1383
  attributes = store.attributes[klass.full_name] || []
1365
1384
 
1366
- if comment.empty? and
1385
+ if document.empty? and
1367
1386
  instance_methods.empty? and class_methods.empty? then
1368
1387
  also_in << store
1369
1388
  return
@@ -1371,7 +1390,7 @@ or the PAGER environment variable.
1371
1390
 
1372
1391
  add_from out, store
1373
1392
 
1374
- class_document_comment out, comment
1393
+ class_document_comment out, document
1375
1394
 
1376
1395
  if class_methods or instance_methods or not klass.constants.empty? then
1377
1396
  out << RDoc::Markup::Rule.new(1)
@@ -1419,16 +1438,16 @@ or the PAGER environment variable.
1419
1438
  if alias_for
1420
1439
  unless method.comment.nil? or method.comment.empty?
1421
1440
  out << RDoc::Markup::BlankLine.new
1422
- out << method.comment
1441
+ out << method.comment.parse
1423
1442
  end
1424
1443
  out << RDoc::Markup::BlankLine.new
1425
1444
  out << RDoc::Markup::Paragraph.new("(This method is an alias for #{alias_for.full_name}.)")
1426
1445
  out << RDoc::Markup::BlankLine.new
1427
- out << alias_for.comment
1446
+ out << alias_for.comment.parse
1428
1447
  out << RDoc::Markup::BlankLine.new
1429
1448
  else
1430
1449
  out << RDoc::Markup::BlankLine.new
1431
- out << method.comment
1450
+ out << method.comment.parse
1432
1451
  out << RDoc::Markup::BlankLine.new
1433
1452
  end
1434
1453
  end
@@ -1510,4 +1529,38 @@ or the PAGER environment variable.
1510
1529
  server.start
1511
1530
  end
1512
1531
 
1532
+ RDOC_REFS_REGEXP = /\[rdoc-ref:([\w.]+)(@.*)?\]/
1533
+
1534
+ def expand_rdoc_refs_at_the_bottom(out)
1535
+ return unless @expand_refs
1536
+
1537
+ extracted_rdoc_refs = []
1538
+
1539
+ out.each do |part|
1540
+ content = if part.respond_to?(:text)
1541
+ part.text
1542
+ else
1543
+ next
1544
+ end
1545
+
1546
+ rdoc_refs = content.scan(RDOC_REFS_REGEXP).uniq.map do |file_name, _anchor|
1547
+ file_name
1548
+ end
1549
+
1550
+ extracted_rdoc_refs.concat(rdoc_refs)
1551
+ end
1552
+
1553
+ found_pages = extracted_rdoc_refs.map do |ref|
1554
+ begin
1555
+ @stores.first.load_page(ref)
1556
+ rescue RDoc::Store::MissingFileError
1557
+ end
1558
+ end.compact
1559
+
1560
+ found_pages.each do |page|
1561
+ out << RDoc::Markup::Heading.new(4, "Expanded from #{page.full_name}")
1562
+ out << RDoc::Markup::BlankLine.new
1563
+ out << page.comment.parse
1564
+ end
1565
+ end
1513
1566
  end
@@ -3,13 +3,19 @@ require 'rubygems/user_interaction'
3
3
  require 'fileutils'
4
4
  require_relative '../rdoc'
5
5
 
6
- ##
7
- # Gem::RDoc provides methods to generate RDoc and ri data for installed gems
8
- # upon gem installation.
6
+ # We define the following two similar name classes in this file:
9
7
  #
10
- # This file is automatically required by RubyGems 1.9 and newer.
8
+ # - RDoc::RubyGemsHook
9
+ # - RDoc::RubygemsHook
10
+ #
11
+ # RDoc::RubyGemsHook is the main class that has real logic.
12
+ #
13
+ # RDoc::RubygemsHook is a class that is only for
14
+ # compatibility. RDoc::RubygemsHook is used by RubyGems directly. We
15
+ # can remove this when all maintained RubyGems remove
16
+ # `rubygems/rdoc.rb`.
11
17
 
12
- class RDoc::RubygemsHook
18
+ class RDoc::RubyGemsHook
13
19
 
14
20
  include Gem::UserInteraction
15
21
  extend Gem::UserInteraction
@@ -45,7 +51,7 @@ class RDoc::RubygemsHook
45
51
  # Post installs hook that generates documentation for each specification in
46
52
  # +specs+
47
53
 
48
- def self.generation_hook installer, specs
54
+ def self.generate installer, specs
49
55
  start = Time.now
50
56
  types = installer.document
51
57
 
@@ -64,6 +70,10 @@ class RDoc::RubygemsHook
64
70
  say "Done installing documentation for #{names} after #{duration} seconds"
65
71
  end
66
72
 
73
+ def self.remove uninstaller
74
+ new(uninstaller.spec).remove
75
+ end
76
+
67
77
  ##
68
78
  # Loads the RDoc generator
69
79
 
@@ -171,20 +181,14 @@ class RDoc::RubygemsHook
171
181
  options = ::RDoc::Options.new
172
182
  options.default_title = "#{@spec.full_name} Documentation"
173
183
  options.parse args
184
+ options.quiet = !Gem.configuration.really_verbose
185
+ options.finish
174
186
  end
175
187
 
176
- options.quiet = !Gem.configuration.really_verbose
177
-
178
188
  @rdoc = new_rdoc
179
189
  @rdoc.options = options
180
190
 
181
- store = RDoc::Store.new
182
- store.encoding = options.encoding
183
- store.dry_run = options.dry_run
184
- store.main = options.main_page
185
- store.title = options.title
186
-
187
- @rdoc.store = store
191
+ @rdoc.store = RDoc::Store.new(options)
188
192
 
189
193
  say "Parsing documentation for #{@spec.full_name}"
190
194
 
@@ -246,3 +250,75 @@ class RDoc::RubygemsHook
246
250
  end
247
251
 
248
252
  end
253
+
254
+ # This class is referenced by RubyGems to create documents.
255
+ # All implementations are moved to the above RubyGemsHook.
256
+ #
257
+ # This class does nothing when this RDoc is installed as a normal gem
258
+ # or a bundled gem.
259
+ #
260
+ # This class does generate/remove documents for compatibility when
261
+ # this RDoc is installed as a default gem.
262
+ #
263
+ # We can remove this when all maintained RubyGems remove
264
+ # `rubygems/rdoc.rb`.
265
+ module RDoc
266
+ class RubygemsHook
267
+
268
+ attr_accessor :generate_rdoc, :generate_ri, :force
269
+
270
+ def self.default_gem?
271
+ !File.exist?(File.join(__dir__, "..", "rubygems_plugin.rb"))
272
+ end
273
+
274
+ def initialize(spec, generate_rdoc = false, generate_ri = true)
275
+ @spec = spec
276
+ @generate_rdoc = generate_rdoc
277
+ @generate_ri = generate_ri
278
+ @force = false
279
+ end
280
+
281
+ def generate
282
+ # Do nothing if this is NOT a default gem.
283
+ return unless self.class.default_gem?
284
+
285
+ # Generate document for compatibility if this is a default gem.
286
+ hook = RubyGemsHook.new(@spec, @generate_rdoc, @generate_ri)
287
+ hook.force = @force
288
+ hook.generate
289
+ end
290
+
291
+ def remove
292
+ # Do nothing if this is NOT a default gem.
293
+ return unless self.class.default_gem?
294
+
295
+ # Remove generated document for compatibility if this is a
296
+ # default gem.
297
+ RubyGemsHook.new(@spec).remove
298
+ end
299
+
300
+ def self.generation_hook installer, specs
301
+ # Do nothing if this is NOT a default gem.
302
+ return unless default_gem?
303
+
304
+ # Generate document for compatibility if this is a default gem.
305
+ RubyGemsHook.generate(installer, specs)
306
+ end
307
+
308
+ def self.load_rdoc
309
+ RubyGemsHook.load_rdoc
310
+ end
311
+
312
+ def self.rdoc_version
313
+ RubyGemsHook.rdoc_version
314
+ end
315
+
316
+ def rdoc_installed?
317
+ RubyGemsHook.new(@spec).rdoc_installed?
318
+ end
319
+
320
+ def ri_installed?
321
+ RubyGemsHook.new(@spec).ri_installed?
322
+ end
323
+ end
324
+ end
data/lib/rdoc/servlet.rb CHANGED
@@ -133,7 +133,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
133
133
  show_documentation req, res
134
134
  end
135
135
  rescue WEBrick::HTTPStatus::NotFound => e
136
- generator = generator_for RDoc::Store.new
136
+ generator = generator_for RDoc::Store.new(@options)
137
137
 
138
138
  not_found generator, req, res, e.message
139
139
  rescue WEBrick::HTTPStatus::Status
@@ -247,6 +247,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
247
247
  generator = RDoc::Generator::Darkfish.new store, @options
248
248
  generator.file_output = false
249
249
  generator.asset_rel_path = '..'
250
+ generator.setup
250
251
 
251
252
  rdoc = RDoc::RDoc.new
252
253
  rdoc.store = store
@@ -290,7 +291,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
290
291
  def installed_docs
291
292
  extra_counter = 0
292
293
  ri_paths.map do |path, type|
293
- store = RDoc::Store.new path, type
294
+ store = RDoc::Store.new(@options, path: path, type: type)
294
295
  exists = File.exist? store.cache_path
295
296
 
296
297
  case type
@@ -419,15 +420,15 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
419
420
  def store_for source_name
420
421
  case source_name
421
422
  when 'home' then
422
- RDoc::Store.new RDoc::RI::Paths.home_dir, :home
423
+ RDoc::Store.new(@options, path: RDoc::RI::Paths.home_dir, type: :home)
423
424
  when 'ruby' then
424
- RDoc::Store.new RDoc::RI::Paths.system_dir, :system
425
+ RDoc::Store.new(@options, path: RDoc::RI::Paths.system_dir, type: :system)
425
426
  when 'site' then
426
- RDoc::Store.new RDoc::RI::Paths.site_dir, :site
427
+ RDoc::Store.new(@options, path: RDoc::RI::Paths.site_dir, type: :site)
427
428
  when /\Aextra-(\d+)\z/ then
428
429
  index = $1.to_i - 1
429
430
  ri_dir = installed_docs[index][4]
430
- RDoc::Store.new ri_dir, :extra
431
+ RDoc::Store.new(@options, path: ri_dir, type: :extra)
431
432
  else
432
433
  ri_dir, type = ri_paths.find do |dir, dir_type|
433
434
  next unless dir_type == :gem
@@ -438,7 +439,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
438
439
  raise WEBrick::HTTPStatus::NotFound,
439
440
  "Could not find gem \"#{ERB::Util.html_escape(source_name)}\". Are you sure you installed it?" unless ri_dir
440
441
 
441
- store = RDoc::Store.new ri_dir, type
442
+ store = RDoc::Store.new(@options, path: ri_dir, type: type)
442
443
 
443
444
  return store if File.exist? store.cache_path
444
445
 
data/lib/rdoc/stats.rb CHANGED
@@ -261,7 +261,7 @@ class RDoc::Stats
261
261
 
262
262
  report = []
263
263
 
264
- cm.each_attribute do |attr|
264
+ cm.attributes.each do |attr|
265
265
  next if attr.documented?
266
266
  line = attr.line ? ":#{attr.line}" : nil
267
267
  report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}\n"
@@ -331,7 +331,7 @@ class RDoc::Stats
331
331
 
332
332
  report = []
333
333
 
334
- cm.each_constant do |constant|
334
+ cm.constants.each do |constant|
335
335
  # TODO constant aliases are listed in the summary but not reported
336
336
  # figure out what to do here
337
337
  next if constant.documented? || constant.is_alias_for
data/lib/rdoc/store.rb CHANGED
@@ -94,11 +94,7 @@ class RDoc::Store
94
94
 
95
95
  attr_accessor :path
96
96
 
97
- ##
98
- # The RDoc::RDoc driver for this parse tree. This allows classes consulting
99
- # the documentation tree to access user-set options, for example.
100
-
101
- attr_accessor :rdoc
97
+ attr_reader :options
102
98
 
103
99
  ##
104
100
  # Type of ri datastore this was loaded from. See RDoc::RI::Driver,
@@ -124,11 +120,11 @@ class RDoc::Store
124
120
  ##
125
121
  # Creates a new Store of +type+ that will load or save to +path+
126
122
 
127
- def initialize path = nil, type = nil
128
- @dry_run = false
129
- @encoding = nil
130
- @path = path
131
- @rdoc = nil
123
+ def initialize(options, path: nil, type: nil)
124
+ @options = options
125
+ @dry_run = options.dry_run
126
+ @encoding = options.encoding
127
+ @path = path || options.op_dir
132
128
  @type = type
133
129
 
134
130
  @cache = {
@@ -139,10 +135,10 @@ class RDoc::Store
139
135
  :c_singleton_class_variables => {},
140
136
  :encoding => @encoding,
141
137
  :instance_methods => {},
142
- :main => nil,
138
+ :main => options.main_page,
143
139
  :modules => [],
144
140
  :pages => [],
145
- :title => nil,
141
+ :title => options.title,
146
142
  }
147
143
 
148
144
  @classes_hash = {}
@@ -197,6 +193,18 @@ class RDoc::Store
197
193
  top_level
198
194
  end
199
195
 
196
+ ##
197
+ # Make sure any references to C variable names are resolved to the corresponding class.
198
+ #
199
+
200
+ def resolve_c_superclasses
201
+ @classes_hash.each_value do |klass|
202
+ if klass.superclass.is_a?(String) && (candidate = find_c_enclosure(klass.superclass))
203
+ klass.superclass = candidate
204
+ end
205
+ end
206
+ end
207
+
200
208
  ##
201
209
  # Sets the parser of +absolute_name+, unless it from a source code file.
202
210
 
@@ -754,7 +762,7 @@ class RDoc::Store
754
762
  save_method klass, method
755
763
  end
756
764
 
757
- klass.each_attribute do |attribute|
765
+ klass.attributes.each do |attribute|
758
766
  save_method klass, attribute
759
767
  end
760
768
  end
data/lib/rdoc/task.rb CHANGED
@@ -104,9 +104,8 @@ class RDoc::Task < Rake::TaskLib
104
104
  attr_accessor :name
105
105
 
106
106
  ##
107
- # Comment markup format. rdoc, rd and tomdoc are supported. (default is
108
- # 'rdoc')
109
-
107
+ # The markup format; one of: +rdoc+ (the default), +markdown+, +rd+, +tomdoc+.
108
+ # See {Markup Formats}[rdoc-ref:RDoc::Markup@Markup+Formats].
110
109
  attr_accessor :markup
111
110
 
112
111
  ##
data/lib/rdoc/text.rb CHANGED
@@ -99,8 +99,8 @@ module RDoc::Text
99
99
  # Requires the including class to implement #formatter
100
100
 
101
101
  def markup text
102
- if @store.rdoc.options
103
- locale = @store.rdoc.options.locale
102
+ if @store.options
103
+ locale = @store.options.locale
104
104
  else
105
105
  locale = nil
106
106
  end
data/lib/rdoc/tom_doc.rb CHANGED
@@ -3,13 +3,7 @@
3
3
 
4
4
  # A parser for TomDoc based on TomDoc 1.0.0-rc1 (02adef9b5a)
5
5
  #
6
- # The TomDoc specification can be found at:
7
- #
8
- # http://tomdoc.org
9
- #
10
- # The latest version of the TomDoc specification can be found at:
11
- #
12
- # https://github.com/mojombo/tomdoc/blob/master/tomdoc.md
6
+ # The TomDoc specification can be found at http://tomdoc.org.
13
7
  #
14
8
  # To choose TomDoc as your only default format see RDoc::Options@Saved+Options
15
9
  # for instructions on setting up a <code>.rdoc_options</code> file to store
data/lib/rdoc/version.rb CHANGED
@@ -5,6 +5,6 @@ module RDoc
5
5
  ##
6
6
  # RDoc version you are using
7
7
 
8
- VERSION = '6.7.0'
8
+ VERSION = '6.13.1'
9
9
 
10
10
  end
data/lib/rdoc.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  $DEBUG_RDOC = nil
3
3
 
4
- # :main: README.rdoc
5
-
6
4
  ##
7
5
  # RDoc produces documentation for Ruby source files by parsing the source and
8
6
  # extracting the definition for classes, modules, methods, includes and
@@ -21,7 +19,7 @@ $DEBUG_RDOC = nil
21
19
  # see RDoc::Markup and refer to <tt>rdoc --help</tt> for command line usage.
22
20
  #
23
21
  # If you want to set the default markup format see
24
- # RDoc::Markup@Supported+Formats
22
+ # RDoc::Markup@Markup+Formats
25
23
  #
26
24
  # If you want to store rdoc configuration in your gem (such as the default
27
25
  # markup format) see RDoc::Options@Saved+Options
@@ -188,26 +186,26 @@ module RDoc
188
186
  # programs: classes, modules, methods, and so on.
189
187
  autoload :CodeObject, "#{__dir__}/rdoc/code_object"
190
188
 
191
- autoload :Context, "#{__dir__}/rdoc/context"
192
- autoload :TopLevel, "#{__dir__}/rdoc/top_level"
193
-
194
- autoload :AnonClass, "#{__dir__}/rdoc/anon_class"
195
- autoload :ClassModule, "#{__dir__}/rdoc/class_module"
196
- autoload :NormalClass, "#{__dir__}/rdoc/normal_class"
197
- autoload :NormalModule, "#{__dir__}/rdoc/normal_module"
198
- autoload :SingleClass, "#{__dir__}/rdoc/single_class"
199
-
200
- autoload :Alias, "#{__dir__}/rdoc/alias"
201
- autoload :AnyMethod, "#{__dir__}/rdoc/any_method"
202
- autoload :MethodAttr, "#{__dir__}/rdoc/method_attr"
203
- autoload :GhostMethod, "#{__dir__}/rdoc/ghost_method"
204
- autoload :MetaMethod, "#{__dir__}/rdoc/meta_method"
205
- autoload :Attr, "#{__dir__}/rdoc/attr"
206
-
207
- autoload :Constant, "#{__dir__}/rdoc/constant"
208
- autoload :Mixin, "#{__dir__}/rdoc/mixin"
209
- autoload :Include, "#{__dir__}/rdoc/include"
210
- autoload :Extend, "#{__dir__}/rdoc/extend"
211
- autoload :Require, "#{__dir__}/rdoc/require"
189
+ autoload :Context, "#{__dir__}/rdoc/code_object/context"
190
+ autoload :TopLevel, "#{__dir__}/rdoc/code_object/top_level"
191
+
192
+ autoload :AnonClass, "#{__dir__}/rdoc/code_object/anon_class"
193
+ autoload :ClassModule, "#{__dir__}/rdoc/code_object/class_module"
194
+ autoload :NormalClass, "#{__dir__}/rdoc/code_object/normal_class"
195
+ autoload :NormalModule, "#{__dir__}/rdoc/code_object/normal_module"
196
+ autoload :SingleClass, "#{__dir__}/rdoc/code_object/single_class"
197
+
198
+ autoload :Alias, "#{__dir__}/rdoc/code_object/alias"
199
+ autoload :AnyMethod, "#{__dir__}/rdoc/code_object/any_method"
200
+ autoload :MethodAttr, "#{__dir__}/rdoc/code_object/method_attr"
201
+ autoload :GhostMethod, "#{__dir__}/rdoc/code_object/ghost_method"
202
+ autoload :MetaMethod, "#{__dir__}/rdoc/code_object/meta_method"
203
+ autoload :Attr, "#{__dir__}/rdoc/code_object/attr"
204
+
205
+ autoload :Constant, "#{__dir__}/rdoc/code_object/constant"
206
+ autoload :Mixin, "#{__dir__}/rdoc/code_object/mixin"
207
+ autoload :Include, "#{__dir__}/rdoc/code_object/include"
208
+ autoload :Extend, "#{__dir__}/rdoc/code_object/extend"
209
+ autoload :Require, "#{__dir__}/rdoc/code_object/require"
212
210
 
213
211
  end