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.
- data.tar.gz.sig +2 -0
- data/.document +4 -0
- data/History.txt +35 -0
- data/Manifest.txt +36 -15
- data/README.txt +11 -27
- data/Rakefile +3 -0
- data/lib/rdoc.rb +1 -1
- data/lib/rdoc/cache.rb +32 -0
- data/lib/rdoc/code_objects.rb +121 -59
- data/lib/rdoc/generator.rb +196 -133
- data/lib/rdoc/generator/darkfish.rb +471 -0
- data/lib/rdoc/generator/html.rb +71 -60
- data/lib/rdoc/generator/html/html.rb +115 -115
- data/lib/rdoc/generator/html/one_page_html.rb +56 -56
- data/lib/rdoc/generator/ri.rb +2 -0
- data/lib/rdoc/generator/template/darkfish/.document +0 -0
- data/lib/rdoc/generator/template/darkfish/classpage.rhtml +302 -0
- data/lib/rdoc/generator/template/darkfish/filepage.rhtml +114 -0
- data/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
- data/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
- data/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +57 -0
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +116 -0
- data/lib/rdoc/generator/template/darkfish/js/jquery.js +32 -0
- data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +114 -0
- data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +10 -0
- data/lib/rdoc/generator/template/darkfish/rdoc.css +696 -0
- data/lib/rdoc/generator/xml.rb +19 -12
- data/lib/rdoc/generator/xml/rdf.rb +50 -50
- data/lib/rdoc/generator/xml/xml.rb +58 -58
- data/lib/rdoc/known_classes.rb +0 -1
- data/lib/rdoc/markup/preprocess.rb +4 -3
- data/lib/rdoc/markup/to_html.rb +4 -1
- data/lib/rdoc/markup/to_html_crossref.rb +28 -31
- data/lib/rdoc/options.rb +25 -20
- data/lib/rdoc/parser.rb +10 -2
- data/lib/rdoc/parser/c.rb +38 -29
- data/lib/rdoc/parser/f95.rb +32 -32
- data/lib/rdoc/parser/ruby.rb +5 -2
- data/lib/rdoc/parser/simple.rb +1 -0
- data/lib/rdoc/rdoc.rb +99 -47
- data/lib/rdoc/ri/cache.rb +6 -6
- data/lib/rdoc/ri/display.rb +22 -75
- data/lib/rdoc/ri/driver.rb +237 -78
- data/lib/rdoc/stats.rb +91 -28
- data/lib/rdoc/template.rb +6 -2
- data/test/test.ja.rdoc +8 -0
- data/test/test.ja.txt +8 -0
- data/test/test_attribute_manager.rb +9 -6
- data/test/test_rdoc_markup.rb +4 -2
- data/test/test_rdoc_markup_attribute_manager.rb +13 -3
- data/test/test_rdoc_markup_to_html.rb +18 -2
- data/test/test_rdoc_markup_to_html_crossref.rb +186 -249
- data/test/test_rdoc_parser.rb +17 -1
- data/test/test_rdoc_parser_c.rb +65 -10
- data/test/test_rdoc_parser_perl.rb +4 -2
- data/test/test_rdoc_parser_ruby.rb +6 -4
- data/test/test_rdoc_ri_attribute_formatter.rb +4 -2
- data/test/test_rdoc_ri_default_display.rb +8 -4
- data/test/test_rdoc_ri_driver.rb +4 -2
- data/test/test_rdoc_ri_formatter.rb +6 -4
- data/test/test_rdoc_ri_overstrike_formatter.rb +4 -2
- metadata +84 -33
- metadata.gz.sig +0 -0
- data/lib/rdoc/generator/chm.rb +0 -113
- data/lib/rdoc/generator/chm/chm.rb +0 -100
- data/lib/rdoc/generator/html/frameless.rb +0 -92
- data/lib/rdoc/generator/html/hefss.rb +0 -150
- data/lib/rdoc/generator/html/kilmer.rb +0 -151
- data/lib/rdoc/generator/html/kilmerfactory.rb +0 -427
- data/lib/rdoc/generator/texinfo.rb +0 -81
- data/lib/rdoc/generator/texinfo/class.texinfo.erb +0 -44
- data/lib/rdoc/generator/texinfo/file.texinfo.erb +0 -6
- data/lib/rdoc/generator/texinfo/method.texinfo.erb +0 -6
- data/lib/rdoc/generator/texinfo/texinfo.erb +0 -28
- data/test/rdoc_markup_to_html_crossref_reference.rb +0 -31
- data/test/test_rdoc_info_formatting.rb +0 -175
- data/test/test_rdoc_info_sections.rb +0 -136
data/lib/rdoc/generator.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
218
|
-
|
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
|
-
|
233
|
-
|
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[
|
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
|
-
|
253
|
-
|
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[
|
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 << {
|
320
|
+
res << { :name => h_name, :aref => path }
|
307
321
|
else
|
308
|
-
res << {
|
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[
|
350
|
+
row[:callseq] = m.call_seq.gsub(/->/, '→')
|
337
351
|
else
|
338
|
-
row[
|
339
|
-
row[
|
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[
|
344
|
-
row[
|
345
|
-
row[
|
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
|
-
|
353
|
-
|
366
|
+
:name => other.name,
|
367
|
+
:aref => other.viewer.as_href(path)
|
354
368
|
}
|
355
369
|
end
|
356
370
|
end
|
357
371
|
|
358
|
-
row[
|
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[
|
376
|
+
row[:sourcecode] = code if code
|
363
377
|
else
|
364
378
|
code = m.src_url
|
365
379
|
if code then
|
366
|
-
row[
|
367
|
-
row[
|
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
|
-
|
377
|
-
|
378
|
-
|
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
|
-
|
468
|
-
|
481
|
+
:secname => section.title,
|
482
|
+
:href => section.sequence
|
469
483
|
}
|
470
484
|
end
|
471
485
|
end
|
472
486
|
|
473
|
-
@values[
|
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
|
-
|
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[
|
536
|
-
@values[
|
537
|
-
@values[
|
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
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
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[
|
553
|
-
@values[
|
570
|
+
@values[:charset] = @options.charset
|
571
|
+
@values[:style_url] = style_url(path, @options.css)
|
554
572
|
|
555
573
|
d = markup(@context.comment)
|
556
|
-
@values[
|
574
|
+
@values[:description] = d unless d.empty?
|
557
575
|
|
558
576
|
ml = build_method_summary_list @path
|
559
|
-
@values[
|
577
|
+
@values[:methods] = ml unless ml.empty?
|
560
578
|
|
561
579
|
il = build_include_list @context
|
562
|
-
@values[
|
580
|
+
@values[:includes] = il unless il.empty?
|
563
581
|
|
564
|
-
@values[
|
582
|
+
@values[:sections] = @context.sections.map do |section|
|
565
583
|
secdata = {
|
566
|
-
|
567
|
-
|
568
|
-
|
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[
|
590
|
+
secdata[:aliases] = al unless al.empty?
|
573
591
|
|
574
592
|
co = build_constants_summary_list section
|
575
|
-
secdata[
|
593
|
+
secdata[:constants] = co unless co.empty?
|
576
594
|
|
577
595
|
al = build_attribute_list section
|
578
|
-
secdata[
|
596
|
+
secdata[:attributes] = al unless al.empty?
|
579
597
|
|
580
598
|
cl = build_class_list 0, @context, section
|
581
|
-
secdata[
|
599
|
+
secdata[:classlist] = cl unless cl.empty?
|
582
600
|
|
583
601
|
mdl = build_method_detail_list section
|
584
|
-
secdata[
|
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
|
-
|
601
|
-
|
602
|
-
|
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[
|
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[
|
618
|
-
@values[
|
619
|
-
@values[
|
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[
|
643
|
+
@values[:diagram] = diagram_reference(c.diagram)
|
626
644
|
end
|
627
645
|
|
628
|
-
@values[
|
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[
|
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[
|
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[
|
653
|
-
res[
|
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[
|
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[
|
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
|
-
|
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[
|
724
|
-
@values[
|
725
|
-
@values[
|
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[
|
777
|
+
@values[:description] = d if d.size > 0
|
730
778
|
end
|
731
779
|
|
732
780
|
ml = build_method_summary_list
|
733
|
-
@values[
|
781
|
+
@values[:methods] = ml unless ml.empty?
|
734
782
|
|
735
783
|
il = build_include_list(@context)
|
736
|
-
@values[
|
784
|
+
@values[:includes] = il unless il.empty?
|
737
785
|
|
738
786
|
rl = build_requires_list(@context)
|
739
|
-
@values[
|
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[
|
749
|
-
|
791
|
+
@values[:sections] = @context.sections.map do |section|
|
750
792
|
secdata = {
|
751
|
-
|
752
|
-
|
753
|
-
|
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[
|
799
|
+
secdata[:classlist] = cl unless cl.empty?
|
758
800
|
|
759
801
|
mdl = build_method_detail_list(section)
|
760
|
-
secdata[
|
802
|
+
secdata[:method_list] = mdl unless mdl.empty?
|
761
803
|
|
762
804
|
al = build_alias_summary_list(section)
|
763
|
-
secdata[
|
805
|
+
secdata[:aliases] = al unless al.empty?
|
764
806
|
|
765
807
|
co = build_constants_summary_list(section)
|
766
|
-
secdata[
|
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[
|
778
|
-
@values[
|
779
|
-
@values[
|
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
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
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[
|
837
|
+
@values[:title] = CGI.escapeHTML("File: #{short_name} [#{@options.title}]")
|
795
838
|
|
796
839
|
if @context.diagram then
|
797
|
-
@values[
|
840
|
+
@values[:diagram] = diagram_reference(@context.diagram)
|
798
841
|
end
|
799
842
|
|
800
|
-
@values[
|
801
|
-
@values[
|
802
|
-
@values[
|
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[
|
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
|
853
|
-
@source_code = markup_code
|
854
|
-
|
855
|
-
|
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
|
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
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
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
|
-
|
1047
|
-
|
1048
|
-
line_num = first
|
1111
|
+
|
1112
|
+
line = first
|
1049
1113
|
src.gsub!(/^/) do
|
1050
|
-
if
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
end
|
1114
|
+
res = if line == first then
|
1115
|
+
" " * (size + 2)
|
1116
|
+
else
|
1117
|
+
"%#{size}d: " % line
|
1118
|
+
end
|
1056
1119
|
|
1057
|
-
|
1120
|
+
line += 1
|
1058
1121
|
res
|
1059
1122
|
end
|
1060
1123
|
end
|