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.

Files changed (81) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +14 -0
  3. data/History.txt +27 -0
  4. data/Manifest.txt +29 -9
  5. data/Rakefile +2 -0
  6. data/bin/rdoc +13 -2
  7. data/lib/rdoc.rb +11 -3
  8. data/lib/rdoc/alias.rb +54 -0
  9. data/lib/rdoc/anon_class.rb +10 -0
  10. data/lib/rdoc/any_method.rb +190 -0
  11. data/lib/rdoc/attr.rb +79 -0
  12. data/lib/rdoc/cache.rb +11 -2
  13. data/lib/rdoc/class_module.rb +87 -0
  14. data/lib/rdoc/code_object.rb +152 -0
  15. data/lib/rdoc/code_objects.rb +18 -1118
  16. data/lib/rdoc/constant.rb +36 -0
  17. data/lib/rdoc/context.rb +712 -0
  18. data/lib/rdoc/diagram.rb +8 -8
  19. data/lib/rdoc/generator.rb +3 -1140
  20. data/lib/rdoc/generator/darkfish.rb +107 -133
  21. data/lib/rdoc/generator/markup.rb +194 -0
  22. data/lib/rdoc/generator/ri.rb +4 -2
  23. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +92 -113
  24. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +33 -35
  25. data/lib/rdoc/generator/template/darkfish/index.rhtml +22 -15
  26. data/lib/rdoc/ghost_method.rb +8 -0
  27. data/lib/rdoc/include.rb +39 -0
  28. data/lib/rdoc/markup/attribute_manager.rb +46 -0
  29. data/lib/rdoc/markup/formatter.rb +11 -0
  30. data/lib/rdoc/markup/fragments.rb +42 -2
  31. data/lib/rdoc/markup/inline.rb +29 -4
  32. data/lib/rdoc/markup/lines.rb +4 -0
  33. data/lib/rdoc/markup/preprocess.rb +4 -0
  34. data/lib/rdoc/markup/to_flow.rb +27 -1
  35. data/lib/rdoc/markup/to_html.rb +33 -33
  36. data/lib/rdoc/markup/to_html_crossref.rb +4 -11
  37. data/lib/rdoc/markup/to_latex.rb +31 -31
  38. data/lib/rdoc/markup/to_test.rb +3 -0
  39. data/lib/rdoc/markup/to_texinfo.rb +18 -14
  40. data/lib/rdoc/meta_method.rb +8 -0
  41. data/lib/rdoc/normal_class.rb +18 -0
  42. data/lib/rdoc/normal_module.rb +34 -0
  43. data/lib/rdoc/options.rb +26 -159
  44. data/lib/rdoc/parser/c.rb +16 -8
  45. data/lib/rdoc/parser/ruby.rb +16 -10
  46. data/lib/rdoc/parser/simple.rb +1 -1
  47. data/lib/rdoc/rdoc.rb +50 -34
  48. data/lib/rdoc/require.rb +32 -0
  49. data/lib/rdoc/ri/descriptions.rb +1 -1
  50. data/lib/rdoc/ri/driver.rb +4 -4
  51. data/lib/rdoc/ri/formatter.rb +70 -32
  52. data/lib/rdoc/single_class.rb +8 -0
  53. data/lib/rdoc/top_level.rb +232 -0
  54. data/test/test_rdoc_any_method.rb +10 -0
  55. data/test/test_rdoc_code_object.rb +80 -0
  56. data/test/test_rdoc_constant.rb +15 -0
  57. data/test/test_rdoc_context.rb +250 -0
  58. data/test/test_rdoc_include.rb +17 -0
  59. data/test/test_rdoc_markup.rb +13 -2
  60. data/test/test_rdoc_markup_to_html.rb +22 -0
  61. data/test/test_rdoc_markup_to_html_crossref.rb +50 -115
  62. data/test/test_rdoc_normal_module.rb +26 -0
  63. data/test/test_rdoc_parser_c.rb +33 -0
  64. data/test/test_rdoc_parser_ruby.rb +54 -36
  65. data/test/test_rdoc_require.rb +25 -0
  66. data/test/test_rdoc_ri_default_display.rb +2 -1
  67. data/test/test_rdoc_ri_html_formatter.rb +141 -0
  68. data/test/test_rdoc_top_level.rb +85 -0
  69. data/test/xref_data.rb +46 -0
  70. data/test/xref_test_case.rb +48 -0
  71. metadata +42 -13
  72. metadata.gz.sig +0 -0
  73. data/lib/rdoc/generator/html.rb +0 -456
  74. data/lib/rdoc/generator/html/common.rb +0 -24
  75. data/lib/rdoc/generator/html/html.rb +0 -769
  76. data/lib/rdoc/generator/html/one_page_html.rb +0 -122
  77. data/lib/rdoc/generator/xml.rb +0 -124
  78. data/lib/rdoc/generator/xml/rdf.rb +0 -113
  79. data/lib/rdoc/generator/xml/xml.rb +0 -123
  80. data/lib/rdoc/parser/f95.rb +0 -1835
  81. data/lib/rdoc/template.rb +0 -68
@@ -0,0 +1,36 @@
1
+ require 'rdoc/code_object'
2
+
3
+ ##
4
+ # A constant
5
+
6
+ class RDoc::Constant < RDoc::CodeObject
7
+
8
+ ##
9
+ # The constant's name
10
+
11
+ attr_accessor :name
12
+
13
+ ##
14
+ # The constant's value
15
+
16
+ attr_accessor :value
17
+
18
+ ##
19
+ # Creates a new constant with +name+, +value+ and +comment+
20
+
21
+ def initialize(name, value, comment)
22
+ super()
23
+ @name = name
24
+ @value = value
25
+ self.comment = comment
26
+ end
27
+
28
+ ##
29
+ # Path to this constant
30
+
31
+ def path
32
+ "#{@parent.path}##{@name}"
33
+ end
34
+
35
+ end
36
+
@@ -0,0 +1,712 @@
1
+ require 'thread'
2
+ require 'rdoc/code_object'
3
+
4
+ ##
5
+ # A Context is something that can hold modules, classes, methods, attributes,
6
+ # aliases, requires, and includes. Classes, modules, and files are all
7
+ # Contexts.
8
+
9
+ class RDoc::Context < RDoc::CodeObject
10
+
11
+ ##
12
+ # Types of methods
13
+
14
+ TYPES = %w[class instance]
15
+
16
+ ##
17
+ # Method visibilities
18
+
19
+ VISIBILITIES = [:public, :protected, :private]
20
+
21
+ ##
22
+ # Aliased methods
23
+
24
+ attr_reader :aliases
25
+
26
+ ##
27
+ # attr* methods
28
+
29
+ attr_reader :attributes
30
+
31
+ ##
32
+ # Constants defined
33
+
34
+ attr_reader :constants
35
+
36
+ ##
37
+ # Current section of documentation
38
+
39
+ attr_reader :current_section
40
+
41
+ ##
42
+ # Files this context is found in
43
+
44
+ attr_reader :in_files
45
+
46
+ ##
47
+ # Modules this context includes
48
+
49
+ attr_reader :includes
50
+
51
+ ##
52
+ # Methods defined in this context
53
+
54
+ attr_reader :method_list
55
+
56
+ ##
57
+ # Name of this class excluding namespace. See also full_name
58
+
59
+ attr_reader :name
60
+
61
+ ##
62
+ # Files this context requires
63
+
64
+ attr_reader :requires
65
+
66
+ ##
67
+ # Sections in this context
68
+
69
+ attr_reader :sections
70
+
71
+ ##
72
+ # Aliases that haven't been resolved to a method
73
+
74
+ attr_accessor :unmatched_alias_lists
75
+
76
+ ##
77
+ # Current visibility of this context
78
+
79
+ attr_reader :visibility
80
+
81
+ ##
82
+ # A per-comment section of documentation like:
83
+ #
84
+ # # :SECTION: The title
85
+ # # The body
86
+
87
+ class Section
88
+
89
+ ##
90
+ # Section comment
91
+
92
+ attr_reader :comment
93
+
94
+ ##
95
+ # Context this Section lives in
96
+
97
+ attr_reader :parent
98
+
99
+ ##
100
+ # Section sequence number (for linking)
101
+
102
+ attr_reader :sequence
103
+
104
+ ##
105
+ # Section title
106
+
107
+ attr_reader :title
108
+
109
+ @@sequence = "SEC00000"
110
+ @@sequence_lock = Mutex.new
111
+
112
+ ##
113
+ # Creates a new section with +title+ and +comment+
114
+
115
+ def initialize(parent, title, comment)
116
+ @parent = parent
117
+ @title = title
118
+
119
+ @@sequence_lock.synchronize do
120
+ @@sequence.succ!
121
+ @sequence = @@sequence.dup
122
+ end
123
+
124
+ set_comment comment
125
+ end
126
+
127
+ ##
128
+ # Sections are equal when they have the same #sequence
129
+
130
+ def ==(other)
131
+ self.class === other and @sequence == other.sequence
132
+ end
133
+
134
+ def inspect # :nodoc:
135
+ "#<%s:0x%x %s %p>" % [
136
+ self.class, object_id,
137
+ @sequence, title
138
+ ]
139
+ end
140
+
141
+ ##
142
+ # Set the comment for this section from the original comment block If
143
+ # the first line contains :section:, strip it and use the rest.
144
+ # Otherwise remove lines up to the line containing :section:, and look
145
+ # for those lines again at the end and remove them. This lets us write
146
+ #
147
+ # # blah blah blah
148
+ # #
149
+ # # :SECTION: The title
150
+ # # The body
151
+
152
+ def set_comment(comment)
153
+ return unless comment
154
+
155
+ if comment =~ /^#[ \t]*:section:.*\n/ then
156
+ start = $`
157
+ rest = $'
158
+
159
+ if start.empty?
160
+ @comment = rest
161
+ else
162
+ @comment = rest.sub(/#{start.chomp}\Z/, '')
163
+ end
164
+ else
165
+ @comment = comment
166
+ end
167
+
168
+ @comment = nil if @comment.empty?
169
+ end
170
+
171
+ end
172
+
173
+ ##
174
+ # Creates an unnamed empty context with public visibility
175
+
176
+ def initialize
177
+ super
178
+
179
+ @in_files = []
180
+
181
+ @name ||= "unknown"
182
+ @comment ||= ""
183
+ @parent = nil
184
+ @visibility = :public
185
+
186
+ @current_section = Section.new self, nil, nil
187
+ @sections = [@current_section]
188
+
189
+ initialize_methods_etc
190
+ initialize_classes_and_modules
191
+ end
192
+
193
+ ##
194
+ # Sets the defaults for classes and modules
195
+
196
+ def initialize_classes_and_modules
197
+ @classes = {}
198
+ @modules = {}
199
+ end
200
+
201
+ ##
202
+ # Sets the defaults for methods and so-forth
203
+
204
+ def initialize_methods_etc
205
+ @method_list = []
206
+ @attributes = []
207
+ @aliases = []
208
+ @requires = []
209
+ @includes = []
210
+ @constants = []
211
+
212
+ # This Hash maps a method name to a list of unmatched aliases (aliases of
213
+ # a method not yet encountered).
214
+ @unmatched_alias_lists = {}
215
+ end
216
+
217
+ ##
218
+ # Contexts are sorted by full_name
219
+
220
+ def <=>(other)
221
+ full_name <=> other.full_name
222
+ end
223
+
224
+ ##
225
+ # Adds +an_alias+ that is automatically resolved
226
+
227
+ def add_alias(an_alias)
228
+ meth = find_instance_method_named(an_alias.old_name)
229
+
230
+ if meth then
231
+ add_alias_impl an_alias, meth
232
+ else
233
+ add_to @aliases, an_alias
234
+ unmatched_alias_list = @unmatched_alias_lists[an_alias.old_name] ||= []
235
+ unmatched_alias_list.push an_alias
236
+ end
237
+
238
+ an_alias
239
+ end
240
+
241
+ ##
242
+ # Adds +an_alias+ pointing to +meth+
243
+
244
+ def add_alias_impl(an_alias, meth)
245
+ new_meth = RDoc::AnyMethod.new an_alias.text, an_alias.new_name
246
+ new_meth.is_alias_for = meth
247
+ new_meth.singleton = meth.singleton
248
+ new_meth.params = meth.params
249
+ new_meth.comment = "Alias for \##{meth.name}"
250
+ meth.add_alias new_meth
251
+ add_method new_meth
252
+ end
253
+
254
+ ##
255
+ # Adds +attribute+
256
+
257
+ def add_attribute(attribute)
258
+ add_to @attributes, attribute
259
+ end
260
+
261
+ ##
262
+ # Adds a class named +name+ with +superclass+.
263
+ #
264
+ # Given <tt>class Container::Item</tt> RDoc assumes +Container+ is a module
265
+ # unless it later sees <tt>class Container</tt>. add_class automatically
266
+ # upgrades +name+ to a class in this case.
267
+
268
+ def add_class(class_type, name, superclass = 'Object')
269
+ klass = add_class_or_module @classes, class_type, name, superclass
270
+
271
+ # If the parser encounters Container::Item before encountering
272
+ # Container, then it assumes that Container is a module. This may not
273
+ # be the case, so remove Container from the module list if present and
274
+ # transfer any contained classes and modules to the new class.
275
+
276
+ RDoc::TopLevel.lock.synchronize do
277
+ mod = RDoc::TopLevel.modules_hash.delete klass.full_name
278
+
279
+ if mod then
280
+ klass.classes_hash.update mod.classes_hash
281
+ klass.modules_hash.update mod.modules_hash
282
+ klass.method_list.concat mod.method_list
283
+
284
+ @modules.delete klass.name
285
+ end
286
+
287
+ RDoc::TopLevel.classes_hash[klass.full_name] = klass
288
+ end
289
+
290
+ klass
291
+ end
292
+
293
+ ##
294
+ # Instantiates a +class_type+ named +name+ and adds it the modules or
295
+ # classes Hash +collection+.
296
+
297
+ def add_class_or_module(collection, class_type, name, superclass = nil)
298
+ full_name = if RDoc::TopLevel === self then # HACK
299
+ name
300
+ else
301
+ "#{self.full_name}::#{name}"
302
+ end
303
+ mod = collection[name]
304
+
305
+ if mod then
306
+ mod.superclass = superclass unless mod.module?
307
+ else
308
+ all = nil
309
+
310
+ RDoc::TopLevel.lock.synchronize do
311
+ all = if class_type == RDoc::NormalModule then
312
+ RDoc::TopLevel.modules_hash
313
+ else
314
+ RDoc::TopLevel.classes_hash
315
+ end
316
+
317
+ mod = all[full_name]
318
+ end
319
+
320
+ unless mod then
321
+ mod = class_type.new name, superclass
322
+ else
323
+ # If the class has been encountered already, check that its
324
+ # superclass has been set (it may not have been, depending on the
325
+ # context in which it was encountered).
326
+ if class_type == RDoc::NormalClass then
327
+ mod.superclass = superclass unless mod.superclass
328
+ end
329
+ end
330
+
331
+ unless @done_documenting then
332
+ RDoc::TopLevel.lock.synchronize do
333
+ all[full_name] = mod
334
+ end
335
+ collection[name] = mod
336
+ end
337
+
338
+ mod.section = @current_section
339
+ mod.parent = self
340
+ end
341
+
342
+ mod
343
+ end
344
+
345
+ ##
346
+ # Adds +constant+
347
+
348
+ def add_constant(constant)
349
+ add_to @constants, constant
350
+ end
351
+
352
+ ##
353
+ # Adds included module +include+
354
+
355
+ def add_include(include)
356
+ add_to @includes, include
357
+ end
358
+
359
+ ##
360
+ # Adds +method+
361
+
362
+ def add_method(method)
363
+ method.visibility = @visibility
364
+ add_to(@method_list, method)
365
+
366
+ unmatched_alias_list = @unmatched_alias_lists[method.name]
367
+ if unmatched_alias_list then
368
+ unmatched_alias_list.each do |unmatched_alias|
369
+ add_alias_impl unmatched_alias, method
370
+ @aliases.delete unmatched_alias
371
+ end
372
+
373
+ @unmatched_alias_lists.delete method.name
374
+ end
375
+ end
376
+
377
+ ##
378
+ # Adds a module named +name+. If RDoc already knows +name+ is a class then
379
+ # that class is returned instead. See also #add_class
380
+
381
+ def add_module(class_type, name)
382
+ return @classes[name] if @classes.key? name
383
+
384
+ add_class_or_module @modules, class_type, name, nil
385
+ end
386
+
387
+ ##
388
+ # Adds +require+ to this context's top level
389
+
390
+ def add_require(require)
391
+ if RDoc::TopLevel === self then
392
+ add_to @requires, require
393
+ else
394
+ parent.add_require require
395
+ end
396
+ end
397
+
398
+ ##
399
+ # Adds +thing+ to the collection +array+
400
+
401
+ def add_to(array, thing)
402
+ array << thing if @document_self and not @done_documenting
403
+ thing.parent = self
404
+ thing.section = @current_section
405
+ end
406
+
407
+ ##
408
+ # Array of classes in this context
409
+
410
+ def classes
411
+ @classes.values
412
+ end
413
+
414
+ ##
415
+ # All classes and modules in this namespace
416
+
417
+ def classes_and_modules
418
+ classes + modules
419
+ end
420
+
421
+ ##
422
+ # Hash of classes keyed by class name
423
+
424
+ def classes_hash
425
+ @classes
426
+ end
427
+
428
+ ##
429
+ # Is part of this thing was defined in +file+?
430
+
431
+ def defined_in?(file)
432
+ @in_files.include?(file)
433
+ end
434
+
435
+ ##
436
+ # Iterator for attributes
437
+
438
+ def each_attribute # :yields: attribute
439
+ @attributes.each {|a| yield a}
440
+ end
441
+
442
+ ##
443
+ # Iterator for classes and modules
444
+
445
+ def each_classmodule(&block) # :yields: module
446
+ classes_and_modules.sort.each(&block)
447
+ end
448
+
449
+ ##
450
+ # Iterator for constants
451
+
452
+ def each_constant # :yields: constant
453
+ @constants.each {|c| yield c}
454
+ end
455
+
456
+ ##
457
+ # Iterator for included modules
458
+
459
+ def each_include # :yields: include
460
+ @includes.each do |i| yield i end
461
+ end
462
+
463
+ ##
464
+ # Iterator for methods
465
+
466
+ def each_method # :yields: method
467
+ @method_list.sort.each {|m| yield m}
468
+ end
469
+
470
+ ##
471
+ # Finds an attribute with +name+ in this context
472
+
473
+ def find_attribute_named(name)
474
+ @attributes.find { |m| m.name == name }
475
+ end
476
+
477
+ ##
478
+ # Finds a constant with +name+ in this context
479
+
480
+ def find_constant_named(name)
481
+ @constants.find {|m| m.name == name}
482
+ end
483
+
484
+ ##
485
+ # Find a module at a higher scope
486
+
487
+ def find_enclosing_module_named(name)
488
+ parent && parent.find_module_named(name)
489
+ end
490
+
491
+ ##
492
+ # Finds a file with +name+ in this context
493
+
494
+ def find_file_named(name)
495
+ top_level.class.find_file_named(name)
496
+ end
497
+
498
+ ##
499
+ # Finds an instance method with +name+ in this context
500
+
501
+ def find_instance_method_named(name)
502
+ @method_list.find { |meth| meth.name == name && !meth.singleton }
503
+ end
504
+
505
+ ##
506
+ # Finds a method, constant, attribute, module or files named +symbol+ in
507
+ # this context
508
+
509
+ def find_local_symbol(symbol)
510
+ find_method_named(symbol) or
511
+ find_constant_named(symbol) or
512
+ find_attribute_named(symbol) or
513
+ find_module_named(symbol) or
514
+ find_file_named(symbol)
515
+ end
516
+
517
+ ##
518
+ # Finds a instance or module method with +name+ in this context
519
+
520
+ def find_method_named(name)
521
+ @method_list.find { |meth| meth.name == name }
522
+ end
523
+
524
+ ##
525
+ # Find a module with +name+ using ruby's scoping rules
526
+
527
+ def find_module_named(name)
528
+ res = @modules[name] || @classes[name]
529
+ return res if res
530
+ return self if self.name == name
531
+ find_enclosing_module_named name
532
+ end
533
+
534
+ ##
535
+ # Look up +symbol+. If +method+ is non-nil, then we assume the symbol
536
+ # references a module that contains that method.
537
+
538
+ def find_symbol(symbol, method = nil)
539
+ result = nil
540
+
541
+ case symbol
542
+ when /^::(.*)/ then
543
+ result = top_level.find_symbol($1)
544
+ when /::/ then
545
+ modules = symbol.split(/::/)
546
+
547
+ unless modules.empty? then
548
+ module_name = modules.shift
549
+ result = find_module_named(module_name)
550
+
551
+ if result then
552
+ modules.each do |name|
553
+ result = result.find_module_named name
554
+ break unless result
555
+ end
556
+ end
557
+ end
558
+
559
+ else
560
+ # if a method is specified, then we're definitely looking for
561
+ # a module, otherwise it could be any symbol
562
+ if method then
563
+ result = find_module_named symbol
564
+ else
565
+ result = find_local_symbol symbol
566
+ if result.nil? then
567
+ if symbol =~ /^[A-Z]/ then
568
+ result = parent
569
+ while result && result.name != symbol do
570
+ result = result.parent
571
+ end
572
+ end
573
+ end
574
+ end
575
+ end
576
+
577
+ if result and method then
578
+ fail unless result.respond_to? :find_local_symbol
579
+ result = result.find_local_symbol(method)
580
+ end
581
+
582
+ result
583
+ end
584
+
585
+ ##
586
+ # URL for this with a +prefix+
587
+
588
+ def http_url(prefix)
589
+ path = full_name
590
+ path = path.gsub(/<<\s*(\w*)/, 'from-\1') if path =~ /<</
591
+ path = [prefix] + path.split('::')
592
+
593
+ File.join(*path.compact) + '.html'
594
+ end
595
+
596
+ ##
597
+ # Breaks method_list into a nested hash by type (class or instance) and
598
+ # visibility (public, protected private)
599
+
600
+ def methods_by_type
601
+ methods = {}
602
+
603
+ TYPES.each do |type|
604
+ visibilities = {}
605
+ VISIBILITIES.each do |vis|
606
+ visibilities[vis] = []
607
+ end
608
+
609
+ methods[type] = visibilities
610
+ end
611
+
612
+ each_method do |method|
613
+ methods[method.type][method.visibility] << method
614
+ end
615
+
616
+ methods
617
+ end
618
+
619
+ ##
620
+ # Yields Method and Attr entries matching the list of names in +methods+.
621
+ # Attributes are only returned when +singleton+ is false.
622
+
623
+ def methods_matching(methods, singleton = false)
624
+ count = 0
625
+
626
+ @method_list.each do |m|
627
+ if methods.include? m.name and m.singleton == singleton then
628
+ yield m
629
+ count += 1
630
+ end
631
+ end
632
+
633
+ return if count == methods.size || singleton
634
+
635
+ @attributes.each do |a|
636
+ yield a if methods.include? a.name
637
+ end
638
+ end
639
+
640
+ ##
641
+ # Array of modules in this context
642
+
643
+ def modules
644
+ @modules.values
645
+ end
646
+
647
+ ##
648
+ # Hash of modules keyed by module name
649
+
650
+ def modules_hash
651
+ @modules
652
+ end
653
+
654
+ ##
655
+ # Changes the visibility for new methods to +visibility+
656
+
657
+ def ongoing_visibility=(visibility)
658
+ @visibility = visibility
659
+ end
660
+
661
+ ##
662
+ # Record which file +top_level+ is in
663
+
664
+ def record_location(top_level)
665
+ @in_files << top_level unless @in_files.include?(top_level)
666
+ end
667
+
668
+ ##
669
+ # If a class's documentation is turned off after we've started collecting
670
+ # methods etc., we need to remove the ones we have
671
+
672
+ def remove_methods_etc
673
+ initialize_methods_etc
674
+ end
675
+
676
+ ##
677
+ # Given an array +methods+ of method names, set the visibility of each to
678
+ # +visibility+
679
+
680
+ def set_visibility_for(methods, visibility, singleton = false)
681
+ methods_matching methods, singleton do |m|
682
+ m.visibility = visibility
683
+ end
684
+ end
685
+
686
+ ##
687
+ # Removes classes and modules when we see a :nodoc: all
688
+
689
+ def remove_classes_and_modules
690
+ initialize_classes_and_modules
691
+ end
692
+
693
+ ##
694
+ # Creates a new section with +title+ and +comment+
695
+
696
+ def set_current_section(title, comment)
697
+ @current_section = Section.new self, title, comment
698
+ @sections << @current_section
699
+ end
700
+
701
+ ##
702
+ # Return the TopLevel that owns us
703
+
704
+ def top_level
705
+ return @top_level if defined? @top_level
706
+ @top_level = self
707
+ @top_level = @top_level.parent until RDoc::TopLevel === @top_level
708
+ @top_level
709
+ end
710
+
711
+ end
712
+