rdoc 2.2.1 → 2.3.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 (95) hide show
  1. data.tar.gz.sig +2 -0
  2. data/.document +4 -0
  3. data/History.txt +35 -0
  4. data/Manifest.txt +36 -15
  5. data/README.txt +11 -27
  6. data/Rakefile +3 -0
  7. data/lib/rdoc.rb +1 -1
  8. data/lib/rdoc/cache.rb +32 -0
  9. data/lib/rdoc/code_objects.rb +121 -59
  10. data/lib/rdoc/generator.rb +196 -133
  11. data/lib/rdoc/generator/darkfish.rb +471 -0
  12. data/lib/rdoc/generator/html.rb +71 -60
  13. data/lib/rdoc/generator/html/html.rb +115 -115
  14. data/lib/rdoc/generator/html/one_page_html.rb +56 -56
  15. data/lib/rdoc/generator/ri.rb +2 -0
  16. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  17. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +302 -0
  18. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +114 -0
  19. data/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  20. data/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  21. data/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  22. data/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  23. data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  24. data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  25. data/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  26. data/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  27. data/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  28. data/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  29. data/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  30. data/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  31. data/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  32. data/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  33. data/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  34. data/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  35. data/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  36. data/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  37. data/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  38. data/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  39. data/lib/rdoc/generator/template/darkfish/index.rhtml +57 -0
  40. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +116 -0
  41. data/lib/rdoc/generator/template/darkfish/js/jquery.js +32 -0
  42. data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +114 -0
  43. data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +10 -0
  44. data/lib/rdoc/generator/template/darkfish/rdoc.css +696 -0
  45. data/lib/rdoc/generator/xml.rb +19 -12
  46. data/lib/rdoc/generator/xml/rdf.rb +50 -50
  47. data/lib/rdoc/generator/xml/xml.rb +58 -58
  48. data/lib/rdoc/known_classes.rb +0 -1
  49. data/lib/rdoc/markup/preprocess.rb +4 -3
  50. data/lib/rdoc/markup/to_html.rb +4 -1
  51. data/lib/rdoc/markup/to_html_crossref.rb +28 -31
  52. data/lib/rdoc/options.rb +25 -20
  53. data/lib/rdoc/parser.rb +10 -2
  54. data/lib/rdoc/parser/c.rb +38 -29
  55. data/lib/rdoc/parser/f95.rb +32 -32
  56. data/lib/rdoc/parser/ruby.rb +5 -2
  57. data/lib/rdoc/parser/simple.rb +1 -0
  58. data/lib/rdoc/rdoc.rb +99 -47
  59. data/lib/rdoc/ri/cache.rb +6 -6
  60. data/lib/rdoc/ri/display.rb +22 -75
  61. data/lib/rdoc/ri/driver.rb +237 -78
  62. data/lib/rdoc/stats.rb +91 -28
  63. data/lib/rdoc/template.rb +6 -2
  64. data/test/test.ja.rdoc +8 -0
  65. data/test/test.ja.txt +8 -0
  66. data/test/test_attribute_manager.rb +9 -6
  67. data/test/test_rdoc_markup.rb +4 -2
  68. data/test/test_rdoc_markup_attribute_manager.rb +13 -3
  69. data/test/test_rdoc_markup_to_html.rb +18 -2
  70. data/test/test_rdoc_markup_to_html_crossref.rb +186 -249
  71. data/test/test_rdoc_parser.rb +17 -1
  72. data/test/test_rdoc_parser_c.rb +65 -10
  73. data/test/test_rdoc_parser_perl.rb +4 -2
  74. data/test/test_rdoc_parser_ruby.rb +6 -4
  75. data/test/test_rdoc_ri_attribute_formatter.rb +4 -2
  76. data/test/test_rdoc_ri_default_display.rb +8 -4
  77. data/test/test_rdoc_ri_driver.rb +4 -2
  78. data/test/test_rdoc_ri_formatter.rb +6 -4
  79. data/test/test_rdoc_ri_overstrike_formatter.rb +4 -2
  80. metadata +84 -33
  81. metadata.gz.sig +0 -0
  82. data/lib/rdoc/generator/chm.rb +0 -113
  83. data/lib/rdoc/generator/chm/chm.rb +0 -100
  84. data/lib/rdoc/generator/html/frameless.rb +0 -92
  85. data/lib/rdoc/generator/html/hefss.rb +0 -150
  86. data/lib/rdoc/generator/html/kilmer.rb +0 -151
  87. data/lib/rdoc/generator/html/kilmerfactory.rb +0 -427
  88. data/lib/rdoc/generator/texinfo.rb +0 -81
  89. data/lib/rdoc/generator/texinfo/class.texinfo.erb +0 -44
  90. data/lib/rdoc/generator/texinfo/file.texinfo.erb +0 -6
  91. data/lib/rdoc/generator/texinfo/method.texinfo.erb +0 -6
  92. data/lib/rdoc/generator/texinfo/texinfo.erb +0 -28
  93. data/test/rdoc_markup_to_html_crossref_reference.rb +0 -31
  94. data/test/test_rdoc_info_formatting.rb +0 -175
  95. data/test/test_rdoc_info_sections.rb +0 -136
@@ -3,6 +3,7 @@ require 'rdoc'
3
3
  require 'rdoc/options'
4
4
  require 'rdoc/markup/to_html_crossref'
5
5
  require 'rdoc/template'
6
+ require 'rdoc/cache'
6
7
 
7
8
  module RDoc::Generator
8
9
 
@@ -127,28 +128,41 @@ module RDoc::Generator
127
128
  # * a complete list of all hyperlinkable terms (file, class, module, and
128
129
  # method names)
129
130
 
130
- def self.build_indices(toplevels, options)
131
+ def self.build_indices(toplevels, options, template_cache = nil)
131
132
  files = []
132
133
  classes = []
134
+ template_cache ||= RDoc::Cache.instance
135
+
136
+ file_dir = if defined? options.generator::FILE_DIR then
137
+ options.generator::FILE_DIR
138
+ else
139
+ RDoc::Generator::FILE_DIR
140
+ end
133
141
 
134
142
  toplevels.each do |toplevel|
135
- files << RDoc::Generator::File.new(toplevel, options,
136
- RDoc::Generator::FILE_DIR)
143
+ files << RDoc::Generator::File.new(template_cache, toplevel, options,
144
+ file_dir)
137
145
  end
138
146
 
147
+ class_dir = if defined? options.generator::CLASS_DIR then
148
+ options.generator::CLASS_DIR
149
+ else
150
+ RDoc::Generator::CLASS_DIR
151
+ end
152
+
139
153
  RDoc::TopLevel.all_classes_and_modules.each do |cls|
140
- build_class_list(classes, options, cls, files[0],
141
- RDoc::Generator::CLASS_DIR)
154
+ build_class_list(template_cache, classes, options, cls, files[0],
155
+ class_dir)
142
156
  end
143
157
 
144
158
  return files, classes
145
159
  end
146
160
 
147
- def self.build_class_list(classes, options, from, html_file, class_dir)
148
- classes << RDoc::Generator::Class.new(from, html_file, class_dir, options)
161
+ def self.build_class_list(template_cache, classes, options, from, html_file, class_dir)
162
+ classes << RDoc::Generator::Class.new(template_cache, from, html_file, class_dir, options)
149
163
 
150
164
  from.each_classmodule do |mod|
151
- build_class_list(classes, options, mod, html_file, class_dir)
165
+ build_class_list(template_cache, classes, options, mod, html_file, class_dir)
152
166
  end
153
167
  end
154
168
 
@@ -214,8 +228,8 @@ module RDoc::Generator
214
228
 
215
229
  @methods.sort.map do |meth|
216
230
  {
217
- "name" => CGI.escapeHTML(meth.name),
218
- "aref" => "##{meth.aref}"
231
+ :name => CGI.escapeHTML(meth.name),
232
+ :aref => "##{meth.aref}"
219
233
  }
220
234
  end
221
235
  end
@@ -229,12 +243,12 @@ module RDoc::Generator
229
243
  next unless al.section == section
230
244
 
231
245
  res = {
232
- 'old_name' => al.old_name,
233
- 'new_name' => al.new_name,
246
+ :old_name => al.old_name,
247
+ :new_name => al.new_name,
234
248
  }
235
249
 
236
250
  if al.comment and not al.comment.empty? then
237
- res['desc'] = markup al.comment, true
251
+ res[:desc] = markup al.comment, true
238
252
  end
239
253
 
240
254
  res
@@ -249,12 +263,12 @@ module RDoc::Generator
249
263
  next unless co.section == section
250
264
 
251
265
  res = {
252
- 'name' => co.name,
253
- 'value' => CGI.escapeHTML(co.value)
266
+ :name => co.name,
267
+ :value => CGI.escapeHTML(co.value)
254
268
  }
255
269
 
256
270
  if co.comment and not co.comment.empty? then
257
- res['desc'] = markup co.comment, true
271
+ res[:desc] = markup co.comment, true
258
272
  end
259
273
 
260
274
  res
@@ -303,9 +317,9 @@ module RDoc::Generator
303
317
  h_name = CGI.escapeHTML(i.name)
304
318
  if ref and ref.document_self
305
319
  path = url(ref.path)
306
- res << { "name" => h_name, "aref" => path }
320
+ res << { :name => h_name, :aref => path }
307
321
  else
308
- res << { "name" => h_name }
322
+ res << { :name => h_name }
309
323
  end
310
324
  end
311
325
  res
@@ -333,38 +347,38 @@ module RDoc::Generator
333
347
  row = {}
334
348
 
335
349
  if m.call_seq then
336
- row["callseq"] = m.call_seq.gsub(/->/, '&rarr;')
350
+ row[:callseq] = m.call_seq.gsub(/->/, '&rarr;')
337
351
  else
338
- row["name"] = CGI.escapeHTML(m.name)
339
- row["params"] = m.params
352
+ row[:name] = CGI.escapeHTML(m.name)
353
+ row[:params] = m.params
340
354
  end
341
355
 
342
356
  desc = m.description.strip
343
- row["m_desc"] = desc unless desc.empty?
344
- row["aref"] = m.aref
345
- row["visibility"] = m.visibility.to_s
357
+ row[:m_desc] = desc unless desc.empty?
358
+ row[:aref] = m.aref
359
+ row[:visibility] = m.visibility.to_s
346
360
 
347
361
  alias_names = []
348
362
 
349
363
  m.aliases.each do |other|
350
364
  if other.viewer then # won't be if the alias is private
351
365
  alias_names << {
352
- 'name' => other.name,
353
- 'aref' => other.viewer.as_href(path)
366
+ :name => other.name,
367
+ :aref => other.viewer.as_href(path)
354
368
  }
355
369
  end
356
370
  end
357
371
 
358
- row["aka"] = alias_names unless alias_names.empty?
372
+ row[:aka] = alias_names unless alias_names.empty?
359
373
 
360
374
  if @options.inline_source then
361
375
  code = m.source_code
362
- row["sourcecode"] = code if code
376
+ row[:sourcecode] = code if code
363
377
  else
364
378
  code = m.src_url
365
379
  if code then
366
- row["codeurl"] = code
367
- row["imgurl"] = m.img_url
380
+ row[:codeurl] = code
381
+ row[:imgurl] = m.img_url
368
382
  end
369
383
  end
370
384
 
@@ -373,9 +387,9 @@ module RDoc::Generator
373
387
 
374
388
  if res.size > 0 then
375
389
  outer << {
376
- "type" => vis.to_s.capitalize,
377
- "category" => singleton ? "Class" : "Instance",
378
- "methods" => res
390
+ :type => vis.to_s.capitalize,
391
+ :category => singleton ? "Class" : "Instance",
392
+ :methods => res
379
393
  }
380
394
  end
381
395
  end
@@ -464,13 +478,13 @@ module RDoc::Generator
464
478
  @context.sections.each do |section|
465
479
  if section.title then
466
480
  toc << {
467
- 'secname' => section.title,
468
- 'href' => section.sequence
481
+ :secname => section.title,
482
+ :href => section.sequence
469
483
  }
470
484
  end
471
485
  end
472
486
 
473
- @values['toc'] = toc unless toc.empty?
487
+ @values[:toc] = toc unless toc.empty?
474
488
  end
475
489
 
476
490
  end
@@ -484,9 +498,10 @@ module RDoc::Generator
484
498
  attr_reader :path
485
499
  attr_reader :values
486
500
 
487
- def initialize(context, html_file, prefix, options)
501
+ def initialize(template_cache, context, html_file, prefix, options)
488
502
  super context, options
489
503
 
504
+ @template_cache = template_cache
490
505
  @html_file = html_file
491
506
  @html_class = self
492
507
  @is_module = context.module?
@@ -514,7 +529,9 @@ module RDoc::Generator
514
529
 
515
530
  path.gsub!(/<<\s*(\w*)/, 'from-\1') if path['<<']
516
531
 
517
- ::File.join(prefix, path.split("::")) + ".html"
532
+ path = [prefix] + path.split('::')
533
+
534
+ ::File.join(*path.compact) + ".html"
518
535
  end
519
536
 
520
537
  def name
@@ -532,56 +549,57 @@ module RDoc::Generator
532
549
  def write_on(f, file_list, class_list, method_list, overrides = {})
533
550
  value_hash
534
551
 
535
- @values['file_list'] = file_list
536
- @values['class_list'] = class_list
537
- @values['method_list'] = method_list
552
+ @values[:file_list] = file_list
553
+ @values[:class_list] = class_list
554
+ @values[:method_list] = method_list
538
555
 
539
556
  @values.update overrides
540
557
 
541
- template = RDoc::TemplatePage.new(@template::BODY,
542
- @template::CLASS_PAGE,
543
- @template::METHOD_LIST)
544
-
545
- template.write_html_on(f, @values)
558
+ template_page = @template_cache.cache(@template) do
559
+ RDoc::TemplatePage.new(@template::BODY,
560
+ @template::CLASS_PAGE,
561
+ @template::METHOD_LIST)
562
+ end
563
+ template_page.write_html_on(f, @values)
546
564
  end
547
565
 
548
566
  def value_hash
549
567
  class_attribute_values
550
568
  add_table_of_sections
551
569
 
552
- @values["charset"] = @options.charset
553
- @values["style_url"] = style_url(path, @options.css)
570
+ @values[:charset] = @options.charset
571
+ @values[:style_url] = style_url(path, @options.css)
554
572
 
555
573
  d = markup(@context.comment)
556
- @values["description"] = d unless d.empty?
574
+ @values[:description] = d unless d.empty?
557
575
 
558
576
  ml = build_method_summary_list @path
559
- @values["methods"] = ml unless ml.empty?
577
+ @values[:methods] = ml unless ml.empty?
560
578
 
561
579
  il = build_include_list @context
562
- @values["includes"] = il unless il.empty?
580
+ @values[:includes] = il unless il.empty?
563
581
 
564
- @values["sections"] = @context.sections.map do |section|
582
+ @values[:sections] = @context.sections.map do |section|
565
583
  secdata = {
566
- "sectitle" => section.title,
567
- "secsequence" => section.sequence,
568
- "seccomment" => markup(section.comment),
584
+ :sectitle => section.title,
585
+ :secsequence => section.sequence,
586
+ :seccomment => markup(section.comment),
569
587
  }
570
588
 
571
589
  al = build_alias_summary_list section
572
- secdata["aliases"] = al unless al.empty?
590
+ secdata[:aliases] = al unless al.empty?
573
591
 
574
592
  co = build_constants_summary_list section
575
- secdata["constants"] = co unless co.empty?
593
+ secdata[:constants] = co unless co.empty?
576
594
 
577
595
  al = build_attribute_list section
578
- secdata["attributes"] = al unless al.empty?
596
+ secdata[:attributes] = al unless al.empty?
579
597
 
580
598
  cl = build_class_list 0, @context, section
581
- secdata["classlist"] = cl unless cl.empty?
599
+ secdata[:classlist] = cl unless cl.empty?
582
600
 
583
601
  mdl = build_method_detail_list section
584
- secdata["method_list"] = mdl unless mdl.empty?
602
+ secdata[:method_list] = mdl unless mdl.empty?
585
603
 
586
604
  secdata
587
605
  end
@@ -597,13 +615,13 @@ module RDoc::Generator
597
615
  @options.show_all then
598
616
 
599
617
  entry = {
600
- "name" => CGI.escapeHTML(att.name),
601
- "rw" => att.rw,
602
- "a_desc" => markup(att.comment, true)
618
+ :name => CGI.escapeHTML(att.name),
619
+ :rw => att.rw,
620
+ :a_desc => markup(att.comment, true)
603
621
  }
604
622
 
605
623
  unless att.visibility == :public or att.visibility == :protected then
606
- entry["rw"] << "-"
624
+ entry[:rw] << "-"
607
625
  end
608
626
 
609
627
  entry
@@ -614,22 +632,22 @@ module RDoc::Generator
614
632
  def class_attribute_values
615
633
  h_name = CGI.escapeHTML(name)
616
634
 
617
- @values["href"] = @path
618
- @values["classmod"] = @is_module ? "Module" : "Class"
619
- @values["title"] = "#{@values['classmod']}: #{h_name} [#{@options.title}]"
635
+ @values[:href] = @path
636
+ @values[:classmod] = @is_module ? "Module" : "Class"
637
+ @values[:title] = "#{@values['classmod']}: #{h_name} [#{@options.title}]"
620
638
 
621
639
  c = @context
622
640
  c = c.parent while c and not c.diagram
623
641
 
624
642
  if c and c.diagram then
625
- @values["diagram"] = diagram_reference(c.diagram)
643
+ @values[:diagram] = diagram_reference(c.diagram)
626
644
  end
627
645
 
628
- @values["full_name"] = h_name
646
+ @values[:full_name] = h_name
629
647
 
630
648
  if not @context.module? and @context.superclass then
631
649
  parent_class = @context.superclass
632
- @values["parent"] = CGI.escapeHTML(parent_class)
650
+ @values[:parent] = CGI.escapeHTML(parent_class)
633
651
 
634
652
  if parent_name
635
653
  lookup = parent_name + "::" + parent_class
@@ -640,7 +658,7 @@ module RDoc::Generator
640
658
  parent_url = AllReferences[lookup] || AllReferences[parent_class]
641
659
 
642
660
  if parent_url and parent_url.document_self
643
- @values["par_url"] = aref_to(parent_url.path)
661
+ @values[:par_url] = aref_to(parent_url.path)
644
662
  end
645
663
  end
646
664
 
@@ -649,23 +667,49 @@ module RDoc::Generator
649
667
  res = {}
650
668
  full_path = CGI.escapeHTML(f.file_absolute_name)
651
669
 
652
- res["full_path"] = full_path
653
- res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
670
+ res[:full_path] = full_path
671
+ res[:full_path_url] = aref_to(f.viewer.path) if f.document_self
654
672
 
655
673
  if @options.webcvs
656
- res["cvsurl"] = cvs_url( @options.webcvs, full_path )
674
+ res[:cvsurl] = cvs_url( @options.webcvs, full_path )
657
675
  end
658
676
 
659
677
  files << res
660
678
  end
661
679
 
662
- @values['infiles'] = files
680
+ @values[:infiles] = files
663
681
  end
664
682
 
665
683
  def <=>(other)
666
684
  self.name <=> other.name
667
685
  end
668
686
 
687
+ def inspect
688
+ "#<#{self.class} name: #{name} path: #{@path}>"
689
+ end
690
+
691
+ def pretty_print(q)
692
+ q.group 1, "#<#{self.class} ", '>' do
693
+ q.text 'name: '
694
+ q.pp name
695
+ q.text ','
696
+ q.breakable
697
+
698
+ q.text 'path: '
699
+ q.pp @path
700
+ q.text ','
701
+ q.breakable
702
+
703
+ q.text 'values: '
704
+ q.pp @values
705
+ q.text ','
706
+ q.breakable
707
+
708
+ q.text 'methods: '
709
+ q.pp @methods
710
+ end
711
+ end
712
+
669
713
  end
670
714
 
671
715
  ##
@@ -680,10 +724,11 @@ module RDoc::Generator
680
724
  attr_reader :name
681
725
  attr_reader :values
682
726
 
683
- def initialize(context, options, file_dir)
727
+ def initialize(template_cache, context, options, file_dir)
684
728
  super context, options
685
729
 
686
730
  @values = {}
731
+ @template_cache = template_cache
687
732
 
688
733
  if options.all_one_file
689
734
  @path = filename_to_label
@@ -699,7 +744,9 @@ module RDoc::Generator
699
744
  end
700
745
 
701
746
  def http_url(file_dir)
702
- ::File.join file_dir, "#{@context.file_relative_name.tr '.', '_'}.html"
747
+ path = [file_dir, "#{@context.file_relative_name.tr '.', '_'}.html"]
748
+
749
+ ::File.join path.compact
703
750
  end
704
751
 
705
752
  def filename_to_label
@@ -720,50 +767,45 @@ module RDoc::Generator
720
767
  file_attribute_values
721
768
  add_table_of_sections
722
769
 
723
- @values["charset"] = @options.charset
724
- @values["href"] = path
725
- @values["style_url"] = style_url(path, @options.css)
770
+ @values[:charset] = @options.charset
771
+ @values[:href] = path
772
+ @values[:parser] = @context.parser
773
+ @values[:style_url] = style_url(path, @options.css)
726
774
 
727
775
  if @context.comment
728
776
  d = markup(@context.comment)
729
- @values["description"] = d if d.size > 0
777
+ @values[:description] = d if d.size > 0
730
778
  end
731
779
 
732
780
  ml = build_method_summary_list
733
- @values["methods"] = ml unless ml.empty?
781
+ @values[:methods] = ml unless ml.empty?
734
782
 
735
783
  il = build_include_list(@context)
736
- @values["includes"] = il unless il.empty?
784
+ @values[:includes] = il unless il.empty?
737
785
 
738
786
  rl = build_requires_list(@context)
739
- @values["requires"] = rl unless rl.empty?
740
-
741
- if @options.promiscuous
742
- file_context = nil
743
- else
744
- file_context = @context
745
- end
787
+ @values[:requires] = rl unless rl.empty?
746
788
 
789
+ file_context = @context unless @options.promiscuous
747
790
 
748
- @values["sections"] = @context.sections.map do |section|
749
-
791
+ @values[:sections] = @context.sections.map do |section|
750
792
  secdata = {
751
- "sectitle" => section.title,
752
- "secsequence" => section.sequence,
753
- "seccomment" => markup(section.comment)
793
+ :sectitle => section.title,
794
+ :secsequence => section.sequence,
795
+ :seccomment => markup(section.comment)
754
796
  }
755
797
 
756
798
  cl = build_class_list(0, @context, section, file_context)
757
- secdata["classlist"] = cl unless cl.empty?
799
+ secdata[:classlist] = cl unless cl.empty?
758
800
 
759
801
  mdl = build_method_detail_list(section)
760
- secdata["method_list"] = mdl unless mdl.empty?
802
+ secdata[:method_list] = mdl unless mdl.empty?
761
803
 
762
804
  al = build_alias_summary_list(section)
763
- secdata["aliases"] = al unless al.empty?
805
+ secdata[:aliases] = al unless al.empty?
764
806
 
765
807
  co = build_constants_summary_list(section)
766
- secdata["constants"] = co unless co.empty?
808
+ secdata[:constants] = co unless co.empty?
767
809
 
768
810
  secdata
769
811
  end
@@ -774,35 +816,36 @@ module RDoc::Generator
774
816
  def write_on(f, file_list, class_list, method_list, overrides = {})
775
817
  value_hash
776
818
 
777
- @values['file_list'] = file_list
778
- @values['class_list'] = class_list
779
- @values['method_list'] = method_list
819
+ @values[:file_list] = file_list
820
+ @values[:class_list] = class_list
821
+ @values[:method_list] = method_list
780
822
 
781
823
  @values.update overrides
782
824
 
783
- template = RDoc::TemplatePage.new(@template::BODY,
784
- @template::FILE_PAGE,
785
- @template::METHOD_LIST)
786
-
787
- template.write_html_on(f, @values)
825
+ template_page = @template_cache.cache(@template) do
826
+ RDoc::TemplatePage.new(@template::BODY,
827
+ @template::FILE_PAGE,
828
+ @template::METHOD_LIST)
829
+ end
830
+ template_page.write_html_on(f, @values)
788
831
  end
789
832
 
790
833
  def file_attribute_values
791
834
  full_path = @context.file_absolute_name
792
835
  short_name = ::File.basename full_path
793
836
 
794
- @values["title"] = CGI.escapeHTML("File: #{short_name} [#{@options.title}]")
837
+ @values[:title] = CGI.escapeHTML("File: #{short_name} [#{@options.title}]")
795
838
 
796
839
  if @context.diagram then
797
- @values["diagram"] = diagram_reference(@context.diagram)
840
+ @values[:diagram] = diagram_reference(@context.diagram)
798
841
  end
799
842
 
800
- @values["short_name"] = CGI.escapeHTML(short_name)
801
- @values["full_path"] = CGI.escapeHTML(full_path)
802
- @values["dtm_modified"] = @context.file_stat.mtime.to_s
843
+ @values[:short_name] = CGI.escapeHTML(short_name)
844
+ @values[:full_path] = CGI.escapeHTML(full_path)
845
+ @values[:dtm_modified] = @context.file_stat.mtime.to_s
803
846
 
804
847
  if @options.webcvs then
805
- @values["cvsurl"] = cvs_url @options.webcvs, @values["full_path"]
848
+ @values[:cvsurl] = cvs_url @options.webcvs, @values[:full_path]
806
849
  end
807
850
  end
808
851
 
@@ -810,6 +853,27 @@ module RDoc::Generator
810
853
  self.name <=> other.name
811
854
  end
812
855
 
856
+ def inspect
857
+ "#<#{self.class} name: #{@name} path: #{@path}>"
858
+ end
859
+
860
+ def pretty_print(q)
861
+ q.group 1, "#<#{self.class} ", '>' do
862
+ q.text 'name: '
863
+ q.pp @name
864
+ q.text ','
865
+ q.breakable
866
+
867
+ q.text 'path: '
868
+ q.pp @path
869
+ q.text ','
870
+ q.breakable
871
+
872
+ q.text 'values: '
873
+ q.pp @values
874
+ end
875
+ end
876
+
813
877
  end
814
878
 
815
879
  class Method
@@ -849,15 +913,16 @@ module RDoc::Generator
849
913
 
850
914
  context.viewer = self
851
915
 
852
- if (ts = @context.token_stream)
853
- @source_code = markup_code(ts)
854
- unless @options.inline_source
855
- @src_url = create_source_code_file(@source_code)
916
+ if ts = @context.token_stream then
917
+ @source_code = markup_code ts
918
+
919
+ unless @options.inline_source then
920
+ @src_url = create_source_code_file @source_code
856
921
  @img_url = RDoc::Markup::ToHtml.gen_relative_url path, 'source.png'
857
922
  end
858
923
  end
859
924
 
860
- AllReferences.add(name, self)
925
+ AllReferences.add name, self
861
926
  end
862
927
 
863
928
  ##
@@ -982,10 +1047,10 @@ module RDoc::Generator
982
1047
 
983
1048
  open file_path, 'w' do |f|
984
1049
  values = {
985
- 'title' => CGI.escapeHTML(index_name),
986
- 'code' => code_body,
987
- 'style_url' => style_url(file_path, @options.css),
988
- 'charset' => @options.charset
1050
+ :title => CGI.escapeHTML(index_name),
1051
+ :code => code_body,
1052
+ :style_url => style_url(file_path, @options.css),
1053
+ :charset => @options.charset
989
1054
  }
990
1055
  template.write_html_on(f, values)
991
1056
  end
@@ -1039,22 +1104,20 @@ module RDoc::Generator
1039
1104
  # # File xxxxx, line dddd
1040
1105
 
1041
1106
  def add_line_numbers(src)
1042
- if src =~ /\A.*, line (\d+)/
1107
+ if src =~ /\A.*, line (\d+)/ then
1043
1108
  first = $1.to_i - 1
1044
1109
  last = first + src.count("\n")
1045
1110
  size = last.to_s.length
1046
- fmt = "%#{size}d: "
1047
- is_first_line = true
1048
- line_num = first
1111
+
1112
+ line = first
1049
1113
  src.gsub!(/^/) do
1050
- if is_first_line then
1051
- is_first_line = false
1052
- res = " " * (size+2)
1053
- else
1054
- res = sprintf(fmt, line_num)
1055
- end
1114
+ res = if line == first then
1115
+ " " * (size + 2)
1116
+ else
1117
+ "%#{size}d: " % line
1118
+ end
1056
1119
 
1057
- line_num += 1
1120
+ line += 1
1058
1121
  res
1059
1122
  end
1060
1123
  end