rdoc 2.0.0 → 2.1.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 +1 -0
- data/History.txt +30 -0
- data/Manifest.txt +18 -6
- data/Rakefile +52 -0
- data/lib/rdoc.rb +69 -69
- data/lib/rdoc/code_objects.rb +331 -112
- data/lib/rdoc/generator.rb +172 -144
- data/lib/rdoc/generator/html.rb +45 -18
- data/lib/rdoc/generator/html/frameless.rb +795 -0
- data/lib/rdoc/generator/html/hefss.rb +11 -11
- data/lib/rdoc/generator/html/html.rb +81 -87
- data/lib/rdoc/generator/html/kilmer.rb +10 -10
- data/lib/rdoc/generator/html/one_page_html.rb +9 -9
- data/lib/rdoc/generator/ri.rb +5 -8
- data/lib/rdoc/generator/texinfo.rb +84 -0
- data/lib/rdoc/generator/texinfo/class.texinfo.erb +44 -0
- data/lib/rdoc/generator/texinfo/file.texinfo.erb +6 -0
- data/lib/rdoc/generator/texinfo/method.texinfo.erb +6 -0
- data/lib/rdoc/generator/texinfo/texinfo.erb +28 -0
- data/lib/rdoc/known_classes.rb +69 -0
- data/lib/rdoc/markup.rb +3 -3
- data/lib/rdoc/markup/attribute_manager.rb +0 -9
- data/lib/rdoc/markup/fragments.rb +1 -1
- data/lib/rdoc/markup/preprocess.rb +10 -6
- data/lib/rdoc/markup/to_html.rb +55 -8
- data/lib/rdoc/markup/to_html_crossref.rb +21 -5
- data/lib/rdoc/markup/to_texinfo.rb +69 -0
- data/lib/rdoc/options.rb +37 -14
- data/lib/rdoc/parser.rb +109 -0
- data/lib/rdoc/parser/c.rb +656 -0
- data/lib/rdoc/parser/f95.rb +1835 -0
- data/lib/rdoc/{parsers/parse_rb.rb → parser/ruby.rb} +1436 -1191
- data/lib/rdoc/parser/simple.rb +38 -0
- data/lib/rdoc/rdoc.rb +48 -32
- data/lib/rdoc/ri.rb +5 -1
- data/lib/rdoc/ri/descriptions.rb +8 -5
- data/lib/rdoc/ri/driver.rb +148 -49
- data/lib/rdoc/stats.rb +94 -4
- data/test/test_rdoc_info_formatting.rb +175 -0
- data/test/test_rdoc_info_sections.rb +136 -0
- data/test/test_rdoc_markup_to_html.rb +30 -0
- data/test/test_rdoc_markup_to_html_crossref.rb +18 -0
- data/test/{test_rdoc_c_parser.rb → test_rdoc_parser_c.rb} +8 -11
- data/test/test_rdoc_parser_ruby.rb +539 -0
- data/test/test_rdoc_ri_default_display.rb +17 -16
- data/test/test_rdoc_ri_driver.rb +92 -0
- metadata +54 -12
- metadata.gz.sig +0 -0
- data/lib/rdoc/parsers/parse_c.rb +0 -775
- data/lib/rdoc/parsers/parse_f95.rb +0 -1841
- data/lib/rdoc/parsers/parse_simple.rb +0 -40
- data/lib/rdoc/parsers/parserfactory.rb +0 -99
data/lib/rdoc/generator.rb
CHANGED
@@ -7,12 +7,12 @@ require 'rdoc/template'
|
|
7
7
|
module RDoc::Generator
|
8
8
|
|
9
9
|
##
|
10
|
-
# Name of sub-
|
10
|
+
# Name of sub-directory that holds file descriptions
|
11
11
|
|
12
12
|
FILE_DIR = "files"
|
13
13
|
|
14
14
|
##
|
15
|
-
# Name of sub-
|
15
|
+
# Name of sub-directory that holds class descriptions
|
16
16
|
|
17
17
|
CLASS_DIR = "classes"
|
18
18
|
|
@@ -21,27 +21,6 @@ module RDoc::Generator
|
|
21
21
|
|
22
22
|
CSS_NAME = "rdoc-style.css"
|
23
23
|
|
24
|
-
##
|
25
|
-
# Converts a target url to one that is relative to a given path
|
26
|
-
|
27
|
-
def self.gen_url(path, target)
|
28
|
-
from = ::File.dirname path
|
29
|
-
to, to_file = ::File.split target
|
30
|
-
|
31
|
-
from = from.split "/"
|
32
|
-
to = to.split "/"
|
33
|
-
|
34
|
-
while from.size > 0 and to.size > 0 and from[0] == to[0] do
|
35
|
-
from.shift
|
36
|
-
to.shift
|
37
|
-
end
|
38
|
-
|
39
|
-
from.fill ".."
|
40
|
-
from.concat to
|
41
|
-
from << to_file
|
42
|
-
::File.join(*from)
|
43
|
-
end
|
44
|
-
|
45
24
|
##
|
46
25
|
# Build a hash of all items that can be cross-referenced. This is used when
|
47
26
|
# we output required and included names: if the names appear in this hash,
|
@@ -80,11 +59,6 @@ module RDoc::Generator
|
|
80
59
|
def markup(str, remove_para = false)
|
81
60
|
return '' unless str
|
82
61
|
|
83
|
-
unless defined? @formatter then
|
84
|
-
@formatter = RDoc::Markup::ToHtmlCrossref.new(path, self,
|
85
|
-
@options.show_hash)
|
86
|
-
end
|
87
|
-
|
88
62
|
# Convert leading comment markers to spaces, but only if all non-blank
|
89
63
|
# lines have them
|
90
64
|
if str =~ /^(?>\s*)[^\#]/ then
|
@@ -93,7 +67,7 @@ module RDoc::Generator
|
|
93
67
|
content = str.gsub(/^\s*(#+)/) { $1.tr '#', ' ' }
|
94
68
|
end
|
95
69
|
|
96
|
-
res =
|
70
|
+
res = formatter.convert content
|
97
71
|
|
98
72
|
if remove_para then
|
99
73
|
res.sub!(/^<p>/, '')
|
@@ -114,7 +88,7 @@ module RDoc::Generator
|
|
114
88
|
if %r{^(https?:/)?/} =~ css_name
|
115
89
|
css_name
|
116
90
|
else
|
117
|
-
RDoc::
|
91
|
+
RDoc::Markup::ToHtml.gen_relative_url path, css_name
|
118
92
|
end
|
119
93
|
end
|
120
94
|
|
@@ -186,6 +160,11 @@ module RDoc::Generator
|
|
186
160
|
@template = options.template_class
|
187
161
|
end
|
188
162
|
|
163
|
+
def formatter
|
164
|
+
@formatter ||= @options.formatter ||
|
165
|
+
RDoc::Markup::ToHtmlCrossref.new(path, self, @options.show_hash)
|
166
|
+
end
|
167
|
+
|
189
168
|
##
|
190
169
|
# convenience method to build a hyperlink
|
191
170
|
|
@@ -201,7 +180,7 @@ module RDoc::Generator
|
|
201
180
|
if @options.all_one_file
|
202
181
|
"#" + path
|
203
182
|
else
|
204
|
-
RDoc::
|
183
|
+
RDoc::Markup::ToHtml.gen_relative_url from_path, path
|
205
184
|
end
|
206
185
|
end
|
207
186
|
|
@@ -215,7 +194,7 @@ module RDoc::Generator
|
|
215
194
|
list = @context.method_list
|
216
195
|
|
217
196
|
unless @options.show_all then
|
218
|
-
list = list.
|
197
|
+
list = list.select do |m|
|
219
198
|
m.visibility == :public or
|
220
199
|
m.visibility == :protected or
|
221
200
|
m.force_documentation
|
@@ -230,17 +209,15 @@ module RDoc::Generator
|
|
230
209
|
##
|
231
210
|
# Build a summary list of all the methods in this context
|
232
211
|
|
233
|
-
def build_method_summary_list(path_prefix="")
|
212
|
+
def build_method_summary_list(path_prefix = "")
|
234
213
|
collect_methods unless @methods
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
res << {
|
214
|
+
|
215
|
+
@methods.sort.map do |meth|
|
216
|
+
{
|
239
217
|
"name" => CGI.escapeHTML(meth.name),
|
240
218
|
"aref" => "#{path_prefix}\##{meth.aref}"
|
241
219
|
}
|
242
220
|
end
|
243
|
-
res
|
244
221
|
end
|
245
222
|
|
246
223
|
##
|
@@ -248,36 +225,40 @@ module RDoc::Generator
|
|
248
225
|
# corresponding method
|
249
226
|
|
250
227
|
def build_alias_summary_list(section)
|
251
|
-
|
252
|
-
@context.aliases.each do |al|
|
228
|
+
@context.aliases.map do |al|
|
253
229
|
next unless al.section == section
|
230
|
+
|
254
231
|
res = {
|
255
232
|
'old_name' => al.old_name,
|
256
233
|
'new_name' => al.new_name,
|
257
234
|
}
|
258
|
-
|
259
|
-
|
235
|
+
|
236
|
+
if al.comment and not al.comment.empty? then
|
237
|
+
res['desc'] = markup al.comment, true
|
260
238
|
end
|
261
|
-
|
262
|
-
|
263
|
-
|
239
|
+
|
240
|
+
res
|
241
|
+
end.compact
|
264
242
|
end
|
265
243
|
|
266
244
|
##
|
267
245
|
# Build a list of constants
|
268
246
|
|
269
247
|
def build_constants_summary_list(section)
|
270
|
-
|
271
|
-
@context.constants.each do |co|
|
248
|
+
@context.constants.map do |co|
|
272
249
|
next unless co.section == section
|
250
|
+
|
273
251
|
res = {
|
274
252
|
'name' => co.name,
|
275
253
|
'value' => CGI.escapeHTML(co.value)
|
276
254
|
}
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
255
|
+
|
256
|
+
if co.comment and not co.comment.empty? then
|
257
|
+
res['desc'] = markup co.comment, true
|
258
|
+
end
|
259
|
+
|
260
|
+
res
|
261
|
+
end.compact
|
281
262
|
end
|
282
263
|
|
283
264
|
def build_requires_list(context)
|
@@ -339,54 +320,58 @@ module RDoc::Generator
|
|
339
320
|
def build_method_detail_list(section)
|
340
321
|
outer = []
|
341
322
|
|
342
|
-
methods = @methods.sort
|
323
|
+
methods = @methods.sort.select do |m|
|
324
|
+
m.document_self and m.section == section
|
325
|
+
end
|
326
|
+
|
343
327
|
for singleton in [true, false]
|
344
328
|
for vis in [ :public, :protected, :private ]
|
345
329
|
res = []
|
346
330
|
methods.each do |m|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
end
|
372
|
-
unless alias_names.empty?
|
373
|
-
row["aka"] = alias_names
|
331
|
+
next unless m.visibility == vis and m.singleton == singleton
|
332
|
+
|
333
|
+
row = {}
|
334
|
+
|
335
|
+
if m.call_seq then
|
336
|
+
row["callseq"] = m.call_seq.gsub(/->/, '→')
|
337
|
+
else
|
338
|
+
row["name"] = CGI.escapeHTML(m.name)
|
339
|
+
row["params"] = m.params
|
340
|
+
end
|
341
|
+
|
342
|
+
desc = m.description.strip
|
343
|
+
row["m_desc"] = desc unless desc.empty?
|
344
|
+
row["aref"] = m.aref
|
345
|
+
row["visibility"] = m.visibility.to_s
|
346
|
+
|
347
|
+
alias_names = []
|
348
|
+
|
349
|
+
m.aliases.each do |other|
|
350
|
+
if other.viewer then # won't be if the alias is private
|
351
|
+
alias_names << {
|
352
|
+
'name' => other.name,
|
353
|
+
'aref' => other.viewer.as_href(path)
|
354
|
+
}
|
374
355
|
end
|
356
|
+
end
|
375
357
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
358
|
+
row["aka"] = alias_names unless alias_names.empty?
|
359
|
+
|
360
|
+
if @options.inline_source then
|
361
|
+
code = m.source_code
|
362
|
+
row["sourcecode"] = code if code
|
363
|
+
else
|
364
|
+
code = m.src_url
|
365
|
+
if code then
|
366
|
+
row["codeurl"] = code
|
367
|
+
row["imgurl"] = m.img_url
|
385
368
|
end
|
386
|
-
res << row
|
387
369
|
end
|
370
|
+
|
371
|
+
res << row
|
388
372
|
end
|
389
|
-
|
373
|
+
|
374
|
+
if res.size > 0 then
|
390
375
|
outer << {
|
391
376
|
"type" => vis.to_s.capitalize,
|
392
377
|
"category" => singleton ? "Class" : "Instance",
|
@@ -395,6 +380,7 @@ module RDoc::Generator
|
|
395
380
|
end
|
396
381
|
end
|
397
382
|
end
|
383
|
+
|
398
384
|
outer
|
399
385
|
end
|
400
386
|
|
@@ -403,8 +389,8 @@ module RDoc::Generator
|
|
403
389
|
# in this context.
|
404
390
|
|
405
391
|
def build_class_list(level, from, section, infile=nil)
|
406
|
-
|
407
|
-
|
392
|
+
prefix = ' ::' * level;
|
393
|
+
res = ''
|
408
394
|
|
409
395
|
from.modules.sort.each do |mod|
|
410
396
|
next unless mod.section == section
|
@@ -412,8 +398,8 @@ module RDoc::Generator
|
|
412
398
|
if mod.document_self
|
413
399
|
res <<
|
414
400
|
prefix <<
|
415
|
-
|
416
|
-
href(url(mod.viewer.path),
|
401
|
+
'Module ' <<
|
402
|
+
href(url(mod.viewer.path), 'link', mod.full_name) <<
|
417
403
|
"<br />\n" <<
|
418
404
|
build_class_list(level + 1, mod, section, infile)
|
419
405
|
end
|
@@ -421,12 +407,13 @@ module RDoc::Generator
|
|
421
407
|
|
422
408
|
from.classes.sort.each do |cls|
|
423
409
|
next unless cls.section == section
|
424
|
-
next if infile
|
410
|
+
next if infile and not cls.defined_in?(infile)
|
411
|
+
|
425
412
|
if cls.document_self
|
426
|
-
res
|
413
|
+
res <<
|
427
414
|
prefix <<
|
428
|
-
|
429
|
-
href(url(cls.viewer.path),
|
415
|
+
'Class ' <<
|
416
|
+
href(url(cls.viewer.path), 'link', cls.full_name) <<
|
430
417
|
"<br />\n" <<
|
431
418
|
build_class_list(level + 1, cls, section, infile)
|
432
419
|
end
|
@@ -436,7 +423,7 @@ module RDoc::Generator
|
|
436
423
|
end
|
437
424
|
|
438
425
|
def url(target)
|
439
|
-
RDoc::
|
426
|
+
RDoc::Markup::ToHtml.gen_relative_url path, target
|
440
427
|
end
|
441
428
|
|
442
429
|
def aref_to(target)
|
@@ -475,7 +462,7 @@ module RDoc::Generator
|
|
475
462
|
def add_table_of_sections
|
476
463
|
toc = []
|
477
464
|
@context.sections.each do |section|
|
478
|
-
if section.title
|
465
|
+
if section.title then
|
479
466
|
toc << {
|
480
467
|
'secname' => section.title,
|
481
468
|
'href' => section.sequence
|
@@ -495,12 +482,14 @@ module RDoc::Generator
|
|
495
482
|
|
496
483
|
attr_reader :methods
|
497
484
|
attr_reader :path
|
485
|
+
attr_reader :values
|
498
486
|
|
499
487
|
def initialize(context, html_file, prefix, options)
|
500
|
-
super
|
488
|
+
super context, options
|
501
489
|
|
502
490
|
@html_file = html_file
|
503
|
-
@
|
491
|
+
@html_class = self
|
492
|
+
@is_module = context.module?
|
504
493
|
@values = {}
|
505
494
|
|
506
495
|
context.viewer = self
|
@@ -540,11 +529,19 @@ module RDoc::Generator
|
|
540
529
|
name
|
541
530
|
end
|
542
531
|
|
543
|
-
def write_on(f)
|
532
|
+
def write_on(f, file_list, class_list, method_list, overrides = {})
|
544
533
|
value_hash
|
534
|
+
|
535
|
+
@values['file_list'] = file_list
|
536
|
+
@values['class_list'] = class_list
|
537
|
+
@values['method_list'] = method_list
|
538
|
+
|
539
|
+
@values.update overrides
|
540
|
+
|
545
541
|
template = RDoc::TemplatePage.new(@template::BODY,
|
546
542
|
@template::CLASS_PAGE,
|
547
543
|
@template::METHOD_LIST)
|
544
|
+
|
548
545
|
template.write_html_on(f, @values)
|
549
546
|
end
|
550
547
|
|
@@ -561,30 +558,29 @@ module RDoc::Generator
|
|
561
558
|
ml = build_method_summary_list @path
|
562
559
|
@values["methods"] = ml unless ml.empty?
|
563
560
|
|
564
|
-
il = build_include_list
|
561
|
+
il = build_include_list @context
|
565
562
|
@values["includes"] = il unless il.empty?
|
566
563
|
|
567
564
|
@values["sections"] = @context.sections.map do |section|
|
568
|
-
|
569
565
|
secdata = {
|
570
566
|
"sectitle" => section.title,
|
571
567
|
"secsequence" => section.sequence,
|
572
|
-
"seccomment" => markup(section.comment)
|
568
|
+
"seccomment" => markup(section.comment),
|
573
569
|
}
|
574
570
|
|
575
|
-
al = build_alias_summary_list
|
571
|
+
al = build_alias_summary_list section
|
576
572
|
secdata["aliases"] = al unless al.empty?
|
577
573
|
|
578
|
-
co = build_constants_summary_list
|
574
|
+
co = build_constants_summary_list section
|
579
575
|
secdata["constants"] = co unless co.empty?
|
580
576
|
|
581
|
-
al = build_attribute_list
|
577
|
+
al = build_attribute_list section
|
582
578
|
secdata["attributes"] = al unless al.empty?
|
583
579
|
|
584
|
-
cl = build_class_list
|
580
|
+
cl = build_class_list 0, @context, section
|
585
581
|
secdata["classlist"] = cl unless cl.empty?
|
586
582
|
|
587
|
-
mdl = build_method_detail_list
|
583
|
+
mdl = build_method_detail_list section
|
588
584
|
secdata["method_list"] = mdl unless mdl.empty?
|
589
585
|
|
590
586
|
secdata
|
@@ -594,23 +590,25 @@ module RDoc::Generator
|
|
594
590
|
end
|
595
591
|
|
596
592
|
def build_attribute_list(section)
|
597
|
-
|
598
|
-
res = []
|
599
|
-
atts.each do |att|
|
593
|
+
@context.attributes.sort.map do |att|
|
600
594
|
next unless att.section == section
|
601
|
-
|
595
|
+
|
596
|
+
if att.visibility == :public or att.visibility == :protected or
|
597
|
+
@options.show_all then
|
598
|
+
|
602
599
|
entry = {
|
603
600
|
"name" => CGI.escapeHTML(att.name),
|
604
601
|
"rw" => att.rw,
|
605
602
|
"a_desc" => markup(att.comment, true)
|
606
603
|
}
|
607
|
-
|
604
|
+
|
605
|
+
unless att.visibility == :public or att.visibility == :protected then
|
608
606
|
entry["rw"] << "-"
|
609
607
|
end
|
610
|
-
|
608
|
+
|
609
|
+
entry
|
611
610
|
end
|
612
|
-
end
|
613
|
-
res
|
611
|
+
end.compact
|
614
612
|
end
|
615
613
|
|
616
614
|
def class_attribute_values
|
@@ -621,16 +619,16 @@ module RDoc::Generator
|
|
621
619
|
@values["title"] = "#{@values['classmod']}: #{h_name}"
|
622
620
|
|
623
621
|
c = @context
|
624
|
-
c = c.parent while c and
|
625
|
-
|
622
|
+
c = c.parent while c and not c.diagram
|
623
|
+
|
624
|
+
if c and c.diagram then
|
626
625
|
@values["diagram"] = diagram_reference(c.diagram)
|
627
626
|
end
|
628
627
|
|
629
628
|
@values["full_name"] = h_name
|
630
629
|
|
631
|
-
|
632
|
-
|
633
|
-
if parent_class
|
630
|
+
if not @context.module? and @context.superclass then
|
631
|
+
parent_class = @context.superclass
|
634
632
|
@values["parent"] = CGI.escapeHTML(parent_class)
|
635
633
|
|
636
634
|
if parent_name
|
@@ -680,9 +678,10 @@ module RDoc::Generator
|
|
680
678
|
|
681
679
|
attr_reader :path
|
682
680
|
attr_reader :name
|
681
|
+
attr_reader :values
|
683
682
|
|
684
683
|
def initialize(context, options, file_dir)
|
685
|
-
super
|
684
|
+
super context, options
|
686
685
|
|
687
686
|
@values = {}
|
688
687
|
|
@@ -755,7 +754,7 @@ module RDoc::Generator
|
|
755
754
|
}
|
756
755
|
|
757
756
|
cl = build_class_list(0, @context, section, file_context)
|
758
|
-
|
757
|
+
secdata["classlist"] = cl unless cl.empty?
|
759
758
|
|
760
759
|
mdl = build_method_detail_list(section)
|
761
760
|
secdata["method_list"] = mdl unless mdl.empty?
|
@@ -764,7 +763,7 @@ module RDoc::Generator
|
|
764
763
|
secdata["aliases"] = al unless al.empty?
|
765
764
|
|
766
765
|
co = build_constants_summary_list(section)
|
767
|
-
|
766
|
+
secdata["constants"] = co unless co.empty?
|
768
767
|
|
769
768
|
secdata
|
770
769
|
end
|
@@ -772,9 +771,15 @@ module RDoc::Generator
|
|
772
771
|
@values
|
773
772
|
end
|
774
773
|
|
775
|
-
def write_on(f)
|
774
|
+
def write_on(f, file_list, class_list, method_list, overrides = {})
|
776
775
|
value_hash
|
777
776
|
|
777
|
+
@values['file_list'] = file_list
|
778
|
+
@values['class_list'] = class_list
|
779
|
+
@values['method_list'] = method_list
|
780
|
+
|
781
|
+
@values.update overrides
|
782
|
+
|
778
783
|
template = RDoc::TemplatePage.new(@template::BODY,
|
779
784
|
@template::FILE_PAGE,
|
780
785
|
@template::METHOD_LIST)
|
@@ -829,15 +834,17 @@ module RDoc::Generator
|
|
829
834
|
end
|
830
835
|
|
831
836
|
def initialize(context, html_class, options)
|
837
|
+
# TODO: rethink the class hierarchy here...
|
832
838
|
@context = context
|
833
839
|
@html_class = html_class
|
834
840
|
@options = options
|
835
841
|
|
842
|
+
@@seq = @@seq.succ
|
843
|
+
@seq = @@seq
|
844
|
+
|
836
845
|
# HACK ugly
|
837
846
|
@template = options.template_class
|
838
847
|
|
839
|
-
@@seq = @@seq.succ
|
840
|
-
@seq = @@seq
|
841
848
|
@@all_methods << self
|
842
849
|
|
843
850
|
context.viewer = self
|
@@ -846,7 +853,7 @@ module RDoc::Generator
|
|
846
853
|
@source_code = markup_code(ts)
|
847
854
|
unless @options.inline_source
|
848
855
|
@src_url = create_source_code_file(@source_code)
|
849
|
-
@img_url = RDoc::
|
856
|
+
@img_url = RDoc::Markup::ToHtml.gen_relative_url path, 'source.png'
|
850
857
|
end
|
851
858
|
end
|
852
859
|
|
@@ -861,10 +868,32 @@ module RDoc::Generator
|
|
861
868
|
if @options.all_one_file
|
862
869
|
"#" + path
|
863
870
|
else
|
864
|
-
RDoc::
|
871
|
+
RDoc::Markup::ToHtml.gen_relative_url from_path, path
|
865
872
|
end
|
866
873
|
end
|
867
874
|
|
875
|
+
def formatter
|
876
|
+
@formatter ||= @options.formatter ||
|
877
|
+
RDoc::Markup::ToHtmlCrossref.new(path, self, @options.show_hash)
|
878
|
+
end
|
879
|
+
|
880
|
+
def inspect
|
881
|
+
alias_for = if @context.is_alias_for then
|
882
|
+
" (alias_for #{@context.is_alias_for})"
|
883
|
+
else
|
884
|
+
nil
|
885
|
+
end
|
886
|
+
|
887
|
+
"#<%s:0x%x %s%s%s (%s)%s>" % [
|
888
|
+
self.class, object_id,
|
889
|
+
@context.parent.name,
|
890
|
+
@context.singleton ? '::' : '#',
|
891
|
+
name,
|
892
|
+
@context.visibility,
|
893
|
+
alias_for
|
894
|
+
]
|
895
|
+
end
|
896
|
+
|
868
897
|
def name
|
869
898
|
@context.name
|
870
899
|
end
|
@@ -961,7 +990,7 @@ module RDoc::Generator
|
|
961
990
|
template.write_html_on(f, values)
|
962
991
|
end
|
963
992
|
|
964
|
-
RDoc::
|
993
|
+
RDoc::Markup::ToHtml.gen_relative_url path, file_path
|
965
994
|
end
|
966
995
|
|
967
996
|
def <=>(other)
|
@@ -976,19 +1005,18 @@ module RDoc::Generator
|
|
976
1005
|
src = ""
|
977
1006
|
tokens.each do |t|
|
978
1007
|
next unless t
|
979
|
-
# p t.class
|
980
1008
|
# style = STYLE_MAP[t.class]
|
981
1009
|
style = case t
|
982
|
-
when RubyToken::TkCONSTANT then "ruby-constant"
|
983
|
-
when RubyToken::TkKW then "ruby-keyword kw"
|
984
|
-
when RubyToken::TkIVAR then "ruby-ivar"
|
985
|
-
when RubyToken::TkOp then "ruby-operator"
|
986
|
-
when RubyToken::TkId then "ruby-identifier"
|
987
|
-
when RubyToken::TkNode then "ruby-node"
|
988
|
-
when RubyToken::TkCOMMENT then "ruby-comment cmt"
|
989
|
-
when RubyToken::TkREGEXP then "ruby-regexp re"
|
990
|
-
when RubyToken::TkSTRING then "ruby-value str"
|
991
|
-
when RubyToken::TkVal then "ruby-value"
|
1010
|
+
when RDoc::RubyToken::TkCONSTANT then "ruby-constant"
|
1011
|
+
when RDoc::RubyToken::TkKW then "ruby-keyword kw"
|
1012
|
+
when RDoc::RubyToken::TkIVAR then "ruby-ivar"
|
1013
|
+
when RDoc::RubyToken::TkOp then "ruby-operator"
|
1014
|
+
when RDoc::RubyToken::TkId then "ruby-identifier"
|
1015
|
+
when RDoc::RubyToken::TkNode then "ruby-node"
|
1016
|
+
when RDoc::RubyToken::TkCOMMENT then "ruby-comment cmt"
|
1017
|
+
when RDoc::RubyToken::TkREGEXP then "ruby-regexp re"
|
1018
|
+
when RDoc::RubyToken::TkSTRING then "ruby-value str"
|
1019
|
+
when RDoc::RubyToken::TkVal then "ruby-value"
|
992
1020
|
else
|
993
1021
|
nil
|
994
1022
|
end
|