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
@@ -311,18 +311,21 @@ class RDoc::Parser::C < RDoc::Parser
311
311
  meth_obj.start_collecting_tokens
312
312
  meth_obj.add_token RDoc::RubyToken::Token.new(1,1).set_text(body_text)
313
313
  meth_obj.comment = mangle_comment comment
314
- when %r{((?>/\*.*?\*/\s*))^\s*\#\s*define\s+#{meth_name}\s+(\w+)}m
314
+ when %r{((?>/\*.*?\*/\s*))^\s*(\#\s*define\s+#{meth_name}\s+(\w+))}m
315
315
  comment = $1
316
- find_body(class_name, $2, meth_obj, body, true)
317
- find_modifiers(comment, meth_obj)
318
- meth_obj.comment = mangle_comment(comment) + meth_obj.comment
316
+ body_text = $2
317
+ find_body class_name, $3, meth_obj, body, true
318
+ find_modifiers comment, meth_obj
319
+
320
+ meth_obj.start_collecting_tokens
321
+ meth_obj.add_token RDoc::RubyToken::Token.new(1,1).set_text(body_text)
322
+ meth_obj.comment = mangle_comment(comment) + meth_obj.comment.to_s
319
323
  when %r{^\s*\#\s*define\s+#{meth_name}\s+(\w+)}m
320
324
  unless find_body(class_name, $1, meth_obj, body, true)
321
325
  warn "No definition for #{meth_name}" unless @options.quiet
322
326
  return false
323
327
  end
324
328
  else
325
-
326
329
  # No body, but might still have an override comment
327
330
  comment = find_override_comment(class_name, meth_obj.name)
328
331
 
@@ -342,7 +345,7 @@ class RDoc::Parser::C < RDoc::Parser
342
345
  if raw_name =~ /^rb_m/
343
346
  container = @top_level.add_module RDoc::NormalModule, name
344
347
  else
345
- container = @top_level.add_class RDoc::NormalClass, name, nil
348
+ container = @top_level.add_class RDoc::NormalClass, name
346
349
  end
347
350
 
348
351
  container.record_location @top_level
@@ -488,7 +491,12 @@ class RDoc::Parser::C < RDoc::Parser
488
491
  end
489
492
 
490
493
  if class_mod == "class" then
491
- full_name = enclosure.full_name.to_s + "::#{class_name}"
494
+ full_name = if RDoc::ClassModule === enclosure then
495
+ enclosure.full_name + "::#{class_name}"
496
+ else
497
+ class_name
498
+ end
499
+
492
500
  if @content =~ %r{Document-class:\s+#{full_name}\s*<\s+([:,\w]+)} then
493
501
  parent_name = $1
494
502
  end
@@ -499,7 +507,7 @@ class RDoc::Parser::C < RDoc::Parser
499
507
  @stats.add_module cm
500
508
  end
501
509
 
502
- cm.record_location enclosure.toplevel
510
+ cm.record_location enclosure.top_level
503
511
 
504
512
  find_class_comment cm.full_name, cm
505
513
 
@@ -1803,8 +1803,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1803
1803
  when "attr_writer" then rw = "W"
1804
1804
  when "attr_accessor" then rw = "RW"
1805
1805
  else
1806
- rw = @options.extra_accessor_flags[tk.name]
1807
- rw = '?' if rw.nil?
1806
+ rw = '?'
1808
1807
  end
1809
1808
 
1810
1809
  for name in args
@@ -1995,7 +1994,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
1995
1994
  indent = TkSPACE.new 1, 1
1996
1995
  indent.set_text " " * column
1997
1996
 
1998
- position_comment = TkCOMMENT.new(line_no, 1, "# File #{@top_level.file_absolute_name}, line #{line_no}")
1997
+ position_comment = TkCOMMENT.new(line_no, 1, "# File #{@top_level.absolute_name}, line #{line_no}")
1999
1998
  meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
2000
1999
 
2001
2000
  meth.params = ''
@@ -2049,7 +2048,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2049
2048
  remove_token_listener self
2050
2049
  return
2051
2050
  else
2052
- warn "#{container.toplevel.file_relative_name}:#{name_t.line_no} unknown name token #{name_t.inspect} for meta-method '#{tk.name}'"
2051
+ warn "unknown name token #{name_t.inspect} for meta-method '#{tk.name}'"
2053
2052
  name = 'unknown'
2054
2053
  end
2055
2054
  end
@@ -2065,7 +2064,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2065
2064
  indent = TkSPACE.new 1, 1
2066
2065
  indent.set_text " " * column
2067
2066
 
2068
- position_comment = TkCOMMENT.new(line_no, 1, "# File #{@top_level.file_absolute_name}, line #{line_no}")
2067
+ position_comment = TkCOMMENT.new(line_no, 1, "# File #{@top_level.absolute_name}, line #{line_no}")
2069
2068
  meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
2070
2069
  meth.add_tokens @token_stream
2071
2070
 
@@ -2150,7 +2149,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2150
2149
  container.record_location @top_level
2151
2150
  end
2152
2151
  else
2153
- # warn("Unexpected token '#{name_t2.inspect}'")
2152
+ warn "unexpected method name token #{name_t2.inspect}"
2154
2153
  # break
2155
2154
  skip_method(container)
2156
2155
  return
@@ -2163,6 +2162,13 @@ class RDoc::Parser::Ruby < RDoc::Parser
2163
2162
  back_tk.reverse_each do |token|
2164
2163
  unget_tk token
2165
2164
  end
2165
+
2166
+ unless name_t.respond_to? :name then
2167
+ warn "unexpected method name token #{name_t.inspect}"
2168
+ skip_method container
2169
+ return
2170
+ end
2171
+
2166
2172
  name = name_t.name
2167
2173
 
2168
2174
  meth = RDoc::AnyMethod.new get_tkread, name
@@ -2177,7 +2183,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2177
2183
  indent = TkSPACE.new 1, 1
2178
2184
  indent.set_text " " * column
2179
2185
 
2180
- token = TkCOMMENT.new(line_no, 1, "# File #{@top_level.file_absolute_name}, line #{line_no}")
2186
+ token = TkCOMMENT.new(line_no, 1, "# File #{@top_level.absolute_name}, line #{line_no}")
2181
2187
  meth.add_tokens [token, NEWLINE_TOKEN, indent]
2182
2188
  meth.add_tokens @token_stream
2183
2189
 
@@ -2437,7 +2443,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2437
2443
  keep_comment = true
2438
2444
  when 'attr' then
2439
2445
  parse_attr container, single, tk, comment
2440
- when /^attr_(reader|writer|accessor)$/, @options.extra_accessors then
2446
+ when /^attr_(reader|writer|accessor)$/ then
2441
2447
  parse_attr_accessor container, single, tk, comment
2442
2448
  when 'alias_method' then
2443
2449
  if container.document_self then
@@ -2536,7 +2542,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2536
2542
  end
2537
2543
  end
2538
2544
 
2539
- def parse_toplevel_statements(container)
2545
+ def parse_top_level_statements(container)
2540
2546
  comment = collect_first_comment
2541
2547
  look_for_directives_in(container, comment)
2542
2548
  container.comment = comment unless comment.empty?
@@ -2706,7 +2712,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
2706
2712
  catch(:eof) do
2707
2713
  catch(:enddoc) do
2708
2714
  begin
2709
- parse_toplevel_statements(@top_level)
2715
+ parse_top_level_statements(@top_level)
2710
2716
  rescue Exception => e
2711
2717
  $stderr.puts <<-EOF
2712
2718
 
@@ -23,7 +23,7 @@ class RDoc::Parser::Simple < RDoc::Parser
23
23
  end
24
24
 
25
25
  ##
26
- # Extract the file contents and attach them to the toplevel as a comment
26
+ # Extract the file contents and attach them to the TopLevel as a comment
27
27
 
28
28
  def scan
29
29
  @top_level.comment = remove_private_comments(@content)
@@ -6,7 +6,6 @@ require 'rdoc/parser'
6
6
  require 'rdoc/parser/simple'
7
7
  require 'rdoc/parser/ruby'
8
8
  require 'rdoc/parser/c'
9
- require 'rdoc/parser/f95'
10
9
  require 'rdoc/parser/perl'
11
10
 
12
11
  require 'rdoc/stats'
@@ -33,6 +32,16 @@ module RDoc
33
32
 
34
33
  class RDoc
35
34
 
35
+ ##
36
+ # Generator instance used for creating output
37
+
38
+ attr_accessor :generator
39
+
40
+ ##
41
+ # RDoc options
42
+
43
+ attr_reader :options
44
+
36
45
  ##
37
46
  # Accessor for statistics. Available after each call to parse_files
38
47
 
@@ -51,7 +60,23 @@ module RDoc
51
60
  GENERATORS[name] = klass
52
61
  end
53
62
 
63
+ ##
64
+ # Active RDoc::RDoc instance
65
+
66
+ def self.current
67
+ @current
68
+ end
69
+
70
+ ##
71
+ # Sets the active RDoc::RDoc instance
72
+
73
+ def self.current=(rdoc)
74
+ @current = rdoc
75
+ end
76
+
54
77
  def initialize
78
+ @generator = nil
79
+ @options = nil
55
80
  @stats = nil
56
81
  end
57
82
 
@@ -68,9 +93,10 @@ module RDoc
68
93
  # we may clobber some manually generated documentation
69
94
 
70
95
  def setup_output_dir(op_dir, force)
71
- flag_file = output_flag_file(op_dir)
72
- if File.exist?(op_dir)
73
- unless File.directory?(op_dir)
96
+ flag_file = output_flag_file op_dir
97
+
98
+ if File.exist? op_dir then
99
+ unless File.directory? op_dir then
74
100
  error "'#{op_dir}' exists, and is not a directory"
75
101
  end
76
102
  begin
@@ -94,14 +120,14 @@ module RDoc
94
120
  # Update the flag file in an output directory.
95
121
 
96
122
  def update_output_dir(op_dir, time)
97
- File.open(output_flag_file(op_dir), "w") {|f| f.puts time.rfc2822 }
123
+ File.open(output_flag_file(op_dir), "w") { |f| f.puts time.rfc2822 }
98
124
  end
99
125
 
100
126
  ##
101
127
  # Return the path name of the flag file in an output directory.
102
128
 
103
129
  def output_flag_file(op_dir)
104
- File.join(op_dir, "created.rid")
130
+ File.join op_dir, "created.rid"
105
131
  end
106
132
 
107
133
  ##
@@ -119,6 +145,7 @@ module RDoc
119
145
  candidates = Dir.glob(File.join(in_dir, patt))
120
146
  result.concat(normalized_file_list(options, candidates))
121
147
  end
148
+
122
149
  result
123
150
  end
124
151
 
@@ -188,17 +215,17 @@ module RDoc
188
215
 
189
216
  return [] if file_list.empty?
190
217
 
191
- jobs = SizedQueue.new(number_of_threads * 3)
218
+ jobs = SizedQueue.new(@options.threads * 3)
192
219
  workers = []
193
220
  file_info = []
194
221
  file_info_lock = Mutex.new
195
222
 
196
223
  Thread.abort_on_exception = true
197
224
  @stats = Stats.new(file_list.size, options.verbosity)
198
- @stats.begin_adding(number_of_threads)
225
+ @stats.begin_adding @options.threads
199
226
 
200
227
  # Create worker threads.
201
- number_of_threads.times do
228
+ @options.threads.times do
202
229
  thread = Thread.new do
203
230
  while (filename = jobs.pop)
204
231
  @stats.add_file(filename)
@@ -248,16 +275,12 @@ module RDoc
248
275
  # Throws: RDoc::Error on error
249
276
 
250
277
  def document(argv)
251
- TopLevel::reset
278
+ TopLevel.reset
252
279
 
253
280
  @options = Options.new
254
281
  @options.parse argv
255
282
 
256
- @last_created = nil
257
-
258
- unless @options.all_one_file then
259
- @last_created = setup_output_dir @options.op_dir, @options.force_update
260
- end
283
+ @last_created = setup_output_dir @options.op_dir, @options.force_update
261
284
 
262
285
  start_time = Time.now
263
286
 
@@ -268,23 +291,27 @@ module RDoc
268
291
  if file_info.empty?
269
292
  $stderr.puts "\nNo newer files." unless @options.quiet
270
293
  else
271
- generator = @options.generator
294
+ gen_klass = @options.generator
272
295
 
273
- $stderr.puts "\nGenerating #{generator.name.sub(/^.*::/, '')}..." unless
274
- @options.quiet
296
+ unless @options.quiet then
297
+ $stderr.puts "\nGenerating #{gen_klass.name.sub(/^.*::/, '')}..."
298
+ end
275
299
 
276
- @gen = generator.for @options
300
+ @generator = gen_klass.for @options
277
301
 
278
302
  pwd = Dir.pwd
279
303
 
280
- Dir.chdir @options.op_dir unless @options.all_one_file
304
+ Dir.chdir @options.op_dir
281
305
 
282
306
  begin
307
+ self.class.current = self
308
+
283
309
  Diagram.new(file_info, @options).draw if @options.diagram
284
- @gen.generate(file_info)
285
- update_output_dir(".", start_time)
310
+ @generator.generate file_info
311
+ update_output_dir ".", start_time
286
312
  ensure
287
- Dir.chdir(pwd)
313
+ self.class.current = nil
314
+ Dir.chdir pwd
288
315
  end
289
316
  end
290
317
 
@@ -296,15 +323,6 @@ module RDoc
296
323
 
297
324
  private
298
325
 
299
- def number_of_threads
300
- @@number_of_threads ||=
301
- if RUBY_PLATFORM == "java"
302
- Java::java::lang::Runtime.getRuntime.availableProcessors * 2
303
- else
304
- 2
305
- end
306
- end
307
-
308
326
  def read_file_contents(filename)
309
327
  content = if RUBY_VERSION >= '1.9' then
310
328
  File.open(filename, "r:ascii-8bit") { |f| f.read }
@@ -339,7 +357,5 @@ end
339
357
 
340
358
  # require built-in generators after discovery in case they've been replaced
341
359
  require 'rdoc/generator/darkfish'
342
- require 'rdoc/generator/html'
343
360
  require 'rdoc/generator/ri'
344
- require 'rdoc/generator/xml'
345
361
 
@@ -0,0 +1,32 @@
1
+ require 'rdoc/code_object'
2
+
3
+ ##
4
+ # A file loaded by \#require
5
+
6
+ class RDoc::Require < RDoc::CodeObject
7
+
8
+ ##
9
+ # Name of the required file
10
+
11
+ attr_accessor :name
12
+
13
+ ##
14
+ # Creates a new Require that loads +name+ with +comment+
15
+
16
+ def initialize(name, comment)
17
+ super()
18
+ @name = name.gsub(/'|"/, "") #'
19
+ self.comment = comment
20
+ end
21
+
22
+ def inspect # :nodoc:
23
+ "#<%s:0x%x require '%s' in %s>" % [
24
+ self.class,
25
+ object_id,
26
+ @name,
27
+ parent_file_name,
28
+ ]
29
+ end
30
+
31
+ end
32
+
@@ -129,7 +129,7 @@ class RDoc::RI::ClassDescription < RDoc::RI::ModuleDescription
129
129
  attr_accessor :superclass
130
130
 
131
131
  def display_name
132
- "Class"
132
+ "Class"
133
133
  end
134
134
 
135
135
  def superclass_string
@@ -607,7 +607,7 @@ Options may also be set in the 'RI' environment variable.
607
607
  def expand_klass(klass)
608
608
  klass.split('::').inject '' do |expanded, klass_part|
609
609
  expanded << '::' unless expanded.empty?
610
- expanded << klass_part
610
+ short = expanded << klass_part
611
611
 
612
612
  subset = class_cache.keys.select do |klass|
613
613
  klass =~ /^#{expanded}[^:]*$/
@@ -615,11 +615,11 @@ Options may also be set in the 'RI' environment variable.
615
615
 
616
616
  abbrevs = Abbrev.abbrev subset
617
617
 
618
- expanded = abbrevs[expanded].dup
618
+ expanded = abbrevs[short]
619
619
 
620
- raise NotFoundError, expanded unless expanded
620
+ raise NotFoundError, short unless expanded
621
621
 
622
- expanded
622
+ expanded.dup
623
623
  end
624
624
  end
625
625
 
@@ -443,88 +443,126 @@ end
443
443
 
444
444
  class RDoc::RI::HtmlFormatter < RDoc::RI::AttributeFormatter
445
445
 
446
- def write_attribute_text(prefix, line)
447
- curr_attr = 0
448
- line.each do |achar|
449
- attr = achar.attr
450
- if achar.attr != curr_attr
451
- update_attributes(curr_attr, achar.attr)
452
- curr_attr = achar.attr
453
- end
454
- @output.print(escape(achar.char))
455
- end
456
- update_attributes(curr_attr, 0) unless curr_attr.zero?
457
- end
446
+ ##
447
+ # We depend on HTML4-conforming user agents to ignore an empty p element
458
448
 
459
- def draw_line(label=nil)
460
- if label != nil
461
- bold_print(label)
462
- end
463
- @output.puts("<hr>")
449
+ def blankline
450
+ @output.puts '<p />'
464
451
  end
465
452
 
466
- def bold_print(txt)
467
- tag("b") { txt }
468
- end
453
+ ##
454
+ # Emboldens +text+
469
455
 
470
- def blankline()
471
- @output.puts("<p>")
456
+ def bold_print(text)
457
+ tag("b") { text }
472
458
  end
473
459
 
460
+ ##
461
+ # Outputs a forced line break element
462
+
474
463
  def break_to_newline
475
- @output.puts("<br>")
464
+ @output.puts '<br />'
476
465
  end
477
466
 
467
+ ##
468
+ # Outputs heading elements for +text+ with +level+ up to 4. Ignores
469
+ # +indent+.
470
+
478
471
  def display_heading(text, level, indent)
479
472
  level = 4 if level > 4
480
473
  tag("h#{level}") { text }
481
474
  @output.puts
482
475
  end
483
476
 
477
+ ##
478
+ # Outputs +list+ which is displayed as follows:
479
+ #
480
+ # BULLET:: unordered list
481
+ # NUMBER:: ordered list
482
+ # LABELED:: definition list
483
+ # NOTE:: table
484
+
484
485
  def display_list(list)
485
486
  case list.type
486
487
  when :BULLET then
487
488
  list_type = "ul"
488
- prefixer = proc { |ignored| "<li>" }
489
+ prefixer = proc { |ignored| '<li>' }
490
+ suffix = '</li>'
489
491
 
490
492
  when :NUMBER, :UPPERALPHA, :LOWERALPHA then
491
493
  list_type = "ol"
492
- prefixer = proc { |ignored| "<li>" }
494
+ prefixer = proc { |ignored| '<li>' }
495
+ suffix = '</li>'
493
496
 
494
497
  when :LABELED then
495
498
  list_type = "dl"
496
499
  prefixer = proc do |li|
497
- "<dt><b>" + escape(li.label) + "</b><dd>"
500
+ "<dt><b>#{escape li.label}</b></dt><dd>"
498
501
  end
502
+ suffix = '</dd>'
499
503
 
500
504
  when :NOTE then
501
505
  list_type = "table"
502
506
  prefixer = proc do |li|
503
507
  %{<tr valign="top"><td>#{li.label.gsub(/ /, '&nbsp;')}</td><td>}
504
508
  end
509
+ suffix = '</td></tr>'
505
510
  else
506
511
  fail "unknown list type"
507
512
  end
508
513
 
509
514
  @output.print "<#{list_type}>"
515
+
510
516
  list.contents.each do |item|
511
517
  if item.kind_of? RDoc::Markup::Flow::LI
512
- prefix = prefixer.call(item)
518
+ prefix = prefixer.call item
513
519
  @output.print prefix
514
- display_flow_item(item, prefix)
520
+ display_flow_item item, prefix
521
+ @output.print suffix
515
522
  else
516
- display_flow_item(item)
523
+ display_flow_item item
517
524
  end
518
525
  end
526
+
519
527
  @output.print "</#{list_type}>"
520
528
  end
521
529
 
530
+ ##
531
+ # Outputs a preformatted section for +item+. +prefix+ is ignored.
532
+
522
533
  def display_verbatim_flow_item(item, prefix=@indent)
523
- @output.print("<pre>")
534
+ @output.print '<pre>'
535
+
524
536
  item.body.split(/\n/).each do |line|
525
- @output.puts conv_html(line)
537
+ @output.puts escape(line)
538
+ end
539
+
540
+ @output.puts '</pre>'
541
+ end
542
+
543
+ ##
544
+ # Outputs a horizontal rule element, optionally labeled above with +label+ in
545
+ # bold.
546
+
547
+ def draw_line(label = nil)
548
+ bold_print label if label
549
+
550
+ @output.puts "<hr />"
551
+ end
552
+
553
+ def write_attribute_text(prefix, line)
554
+ curr_attr = 0
555
+
556
+ line.each do |achar|
557
+ attr = achar.attr
558
+ if achar.attr != curr_attr then
559
+ update_attributes curr_attr, achar.attr
560
+ curr_attr = achar.attr
561
+ end
562
+ @output.print escape(achar.char)
526
563
  end
527
- @output.puts("</pre>")
564
+
565
+ update_attributes curr_attr, 0 unless curr_attr.zero?
528
566
  end
529
567
 
530
568
  private