rdoc 6.13.0 → 6.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.rdoc +1 -1
- data/README.md +112 -0
- data/RI.md +1 -1
- data/lib/rdoc/code_object/any_method.rb +4 -4
- data/lib/rdoc/code_object/attr.rb +3 -3
- data/lib/rdoc/code_object/class_module.rb +18 -16
- data/lib/rdoc/code_object/constant.rb +5 -5
- data/lib/rdoc/code_object/context/section.rb +8 -7
- data/lib/rdoc/code_object/context.rb +19 -19
- data/lib/rdoc/code_object/method_attr.rb +7 -6
- data/lib/rdoc/code_object/mixin.rb +3 -3
- data/lib/rdoc/code_object/normal_class.rb +1 -1
- data/lib/rdoc/code_object/normal_module.rb +1 -1
- data/lib/rdoc/code_object/single_class.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +28 -33
- data/lib/rdoc/code_object.rb +3 -3
- data/lib/rdoc/comment.rb +196 -14
- data/lib/rdoc/cross_reference.rb +4 -4
- data/lib/rdoc/encoding.rb +4 -4
- data/lib/rdoc/erb_partial.rb +1 -1
- data/lib/rdoc/erbio.rb +2 -2
- data/lib/rdoc/generator/aliki.rb +42 -0
- data/lib/rdoc/generator/darkfish.rb +20 -16
- data/lib/rdoc/generator/json_index.rb +3 -3
- data/lib/rdoc/generator/markup.rb +12 -0
- data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
- data/lib/rdoc/generator/pot/po.rb +1 -1
- data/lib/rdoc/generator/pot/po_entry.rb +7 -7
- data/lib/rdoc/generator/pot.rb +1 -1
- data/lib/rdoc/generator/ri.rb +1 -1
- data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
- data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
- data/lib/rdoc/generator/template/aliki/_head.rhtml +158 -0
- data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
- data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +25 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +25 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
- data/lib/rdoc/generator/template/aliki/class.rhtml +220 -0
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +1737 -0
- data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
- data/lib/rdoc/generator/template/aliki/js/aliki.js +483 -0
- data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
- data/lib/rdoc/generator/template/aliki/js/search.js +120 -0
- data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
- data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
- data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
- data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +16 -16
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -8
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -8
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +6 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +19 -19
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +14 -14
- data/lib/rdoc/generator/template/darkfish/class.rhtml +62 -60
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +2 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -3
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +21 -1
- data/lib/rdoc/generator/template/darkfish/js/search.js +11 -1
- data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -1
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +2 -1
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +19 -19
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +19 -17
- data/lib/rdoc/generator/template/json_index/js/searcher.js +48 -6
- data/lib/rdoc/generator.rb +1 -0
- data/lib/rdoc/markdown.kpeg +72 -18
- data/lib/rdoc/markdown.rb +411 -547
- data/lib/rdoc/markup/attribute_manager.rb +5 -5
- data/lib/rdoc/markup/attributes.rb +3 -3
- data/lib/rdoc/markup/blank_line.rb +2 -2
- data/lib/rdoc/markup/block_quote.rb +1 -1
- data/lib/rdoc/markup/document.rb +8 -8
- data/lib/rdoc/markup/formatter.rb +12 -12
- data/lib/rdoc/markup/hard_break.rb +3 -3
- data/lib/rdoc/markup/heading.rb +4 -4
- data/lib/rdoc/markup/include.rb +3 -3
- data/lib/rdoc/markup/indented_paragraph.rb +3 -3
- data/lib/rdoc/markup/list.rb +4 -4
- data/lib/rdoc/markup/list_item.rb +4 -4
- data/lib/rdoc/markup/paragraph.rb +2 -2
- data/lib/rdoc/markup/parser.rb +11 -11
- data/lib/rdoc/markup/pre_process.rb +39 -15
- data/lib/rdoc/markup/raw.rb +5 -5
- data/lib/rdoc/markup/rule.rb +2 -2
- data/lib/rdoc/markup/table.rb +4 -4
- data/lib/rdoc/markup/to_ansi.rb +7 -3
- data/lib/rdoc/markup/to_bs.rb +10 -6
- data/lib/rdoc/markup/to_html.rb +182 -30
- data/lib/rdoc/markup/to_html_crossref.rb +58 -28
- data/lib/rdoc/markup/to_html_snippet.rb +17 -17
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
- data/lib/rdoc/markup/to_label.rb +6 -5
- data/lib/rdoc/markup/to_markdown.rb +12 -12
- data/lib/rdoc/markup/to_rdoc.rb +40 -31
- data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +8 -8
- data/lib/rdoc/markup/verbatim.rb +3 -3
- data/lib/rdoc/markup.rb +3 -3
- data/lib/rdoc/options.rb +53 -23
- data/lib/rdoc/parser/c.rb +31 -62
- data/lib/rdoc/parser/changelog.rb +9 -9
- data/lib/rdoc/parser/prism_ruby.rb +122 -114
- data/lib/rdoc/parser/ruby.rb +51 -51
- data/lib/rdoc/parser/ruby_tools.rb +5 -7
- data/lib/rdoc/parser/simple.rb +5 -22
- data/lib/rdoc/parser.rb +8 -8
- data/lib/rdoc/rd/inline.rb +4 -4
- data/lib/rdoc/rd.rb +1 -1
- data/lib/rdoc/rdoc.rb +9 -8
- data/lib/rdoc/ri/driver.rb +49 -49
- data/lib/rdoc/ri/paths.rb +2 -2
- data/lib/rdoc/ri/task.rb +3 -3
- data/lib/rdoc/rubygems_hook.rb +14 -11
- data/lib/rdoc/servlet.rb +15 -15
- data/lib/rdoc/stats/normal.rb +1 -1
- data/lib/rdoc/stats/quiet.rb +1 -1
- data/lib/rdoc/stats/verbose.rb +3 -3
- data/lib/rdoc/stats.rb +12 -12
- data/lib/rdoc/store.rb +32 -32
- data/lib/rdoc/task.rb +6 -6
- data/lib/rdoc/text.rb +11 -11
- data/lib/rdoc/token_stream.rb +14 -2
- data/lib/rdoc/tom_doc.rb +8 -8
- data/lib/rdoc/version.rb +1 -1
- data/man/ri.1 +2 -0
- data/rdoc.gemspec +72 -0
- metadata +61 -6
- data/README.rdoc +0 -142
data/lib/rdoc/rdoc.rb
CHANGED
|
@@ -89,7 +89,7 @@ class RDoc::RDoc
|
|
|
89
89
|
##
|
|
90
90
|
# Sets the active RDoc::RDoc instance
|
|
91
91
|
|
|
92
|
-
def self.current=
|
|
92
|
+
def self.current=(rdoc)
|
|
93
93
|
@current = rdoc
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -118,7 +118,7 @@ class RDoc::RDoc
|
|
|
118
118
|
# Gathers a set of parseable files from the files and directories listed in
|
|
119
119
|
# +files+.
|
|
120
120
|
|
|
121
|
-
def gather_files
|
|
121
|
+
def gather_files(files)
|
|
122
122
|
files = [@options.root.to_s] if files.empty?
|
|
123
123
|
|
|
124
124
|
file_list = normalized_file_list files, true, @options.exclude
|
|
@@ -237,7 +237,7 @@ option)
|
|
|
237
237
|
# representing candidates for documentation. It may also contain comments
|
|
238
238
|
# (starting with '#')
|
|
239
239
|
|
|
240
|
-
def parse_dot_doc_file
|
|
240
|
+
def parse_dot_doc_file(in_dir, filename)
|
|
241
241
|
# read and strip comments
|
|
242
242
|
patterns = File.read(filename).gsub(/#.*/, '')
|
|
243
243
|
|
|
@@ -311,7 +311,7 @@ option)
|
|
|
311
311
|
# files. However we may well contain subdirectories which must be tested
|
|
312
312
|
# for .document files.
|
|
313
313
|
|
|
314
|
-
def list_files_in_directory
|
|
314
|
+
def list_files_in_directory(dir)
|
|
315
315
|
files = Dir.glob File.join(dir, "*")
|
|
316
316
|
|
|
317
317
|
normalized_file_list files, false, @options.exclude
|
|
@@ -320,7 +320,7 @@ option)
|
|
|
320
320
|
##
|
|
321
321
|
# Parses +filename+ and returns an RDoc::TopLevel
|
|
322
322
|
|
|
323
|
-
def parse_file
|
|
323
|
+
def parse_file(filename)
|
|
324
324
|
encoding = @options.encoding
|
|
325
325
|
filename = filename.encode encoding
|
|
326
326
|
|
|
@@ -391,7 +391,7 @@ The internal error was:
|
|
|
391
391
|
##
|
|
392
392
|
# Parse each file on the command line, recursively entering directories.
|
|
393
393
|
|
|
394
|
-
def parse_files
|
|
394
|
+
def parse_files(files)
|
|
395
395
|
file_list = gather_files files
|
|
396
396
|
@stats = RDoc::Stats.new @store, file_list.length, @options.verbosity
|
|
397
397
|
|
|
@@ -418,7 +418,7 @@ The internal error was:
|
|
|
418
418
|
# Removes file extensions known to be unparseable from +files+ and TAGS
|
|
419
419
|
# files for emacs and vim.
|
|
420
420
|
|
|
421
|
-
def remove_unparseable
|
|
421
|
+
def remove_unparseable(files)
|
|
422
422
|
files.reject do |file, *|
|
|
423
423
|
file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)$/i or
|
|
424
424
|
(file =~ /tags$/i and
|
|
@@ -440,7 +440,7 @@ The internal error was:
|
|
|
440
440
|
# By default, output will be stored in a directory called "doc" below the
|
|
441
441
|
# current directory, so make sure you're somewhere writable before invoking.
|
|
442
442
|
|
|
443
|
-
def document
|
|
443
|
+
def document(options)
|
|
444
444
|
if RDoc::Options === options then
|
|
445
445
|
@options = options
|
|
446
446
|
else
|
|
@@ -547,5 +547,6 @@ end
|
|
|
547
547
|
|
|
548
548
|
# require built-in generators after discovery in case they've been replaced
|
|
549
549
|
require_relative 'generator/darkfish'
|
|
550
|
+
require_relative 'generator/aliki'
|
|
550
551
|
require_relative 'generator/ri'
|
|
551
552
|
require_relative 'generator/pot'
|
data/lib/rdoc/ri/driver.rb
CHANGED
|
@@ -96,7 +96,7 @@ class RDoc::RI::Driver
|
|
|
96
96
|
##
|
|
97
97
|
# Dump +data_path+ using pp
|
|
98
98
|
|
|
99
|
-
def self.dump
|
|
99
|
+
def self.dump(data_path)
|
|
100
100
|
require 'pp'
|
|
101
101
|
|
|
102
102
|
File.open data_path, 'rb' do |io|
|
|
@@ -107,7 +107,7 @@ class RDoc::RI::Driver
|
|
|
107
107
|
##
|
|
108
108
|
# Parses +argv+ and returns a Hash of options
|
|
109
109
|
|
|
110
|
-
def self.process_args
|
|
110
|
+
def self.process_args(argv)
|
|
111
111
|
options = default_options
|
|
112
112
|
|
|
113
113
|
opts = OptionParser.new do |opt|
|
|
@@ -384,7 +384,7 @@ or the PAGER environment variable.
|
|
|
384
384
|
##
|
|
385
385
|
# Runs the ri command line executable using +argv+
|
|
386
386
|
|
|
387
|
-
def self.run
|
|
387
|
+
def self.run(argv = ARGV)
|
|
388
388
|
options = process_args argv
|
|
389
389
|
|
|
390
390
|
if options[:dump_path] then
|
|
@@ -399,7 +399,7 @@ or the PAGER environment variable.
|
|
|
399
399
|
##
|
|
400
400
|
# Creates a new driver using +initial_options+ from ::process_args
|
|
401
401
|
|
|
402
|
-
def initialize
|
|
402
|
+
def initialize(initial_options = {})
|
|
403
403
|
@paging = false
|
|
404
404
|
@classes = nil
|
|
405
405
|
|
|
@@ -438,7 +438,7 @@ or the PAGER environment variable.
|
|
|
438
438
|
##
|
|
439
439
|
# Adds paths for undocumented classes +also_in+ to +out+
|
|
440
440
|
|
|
441
|
-
def add_also_in
|
|
441
|
+
def add_also_in(out, also_in)
|
|
442
442
|
return if also_in.empty?
|
|
443
443
|
|
|
444
444
|
out << RDoc::Markup::Rule.new(1)
|
|
@@ -455,7 +455,7 @@ or the PAGER environment variable.
|
|
|
455
455
|
# Adds a class header to +out+ for class +name+ which is described in
|
|
456
456
|
# +classes+.
|
|
457
457
|
|
|
458
|
-
def add_class
|
|
458
|
+
def add_class(out, name, classes)
|
|
459
459
|
heading = if classes.all? { |klass| klass.module? } then
|
|
460
460
|
name
|
|
461
461
|
else
|
|
@@ -475,14 +475,14 @@ or the PAGER environment variable.
|
|
|
475
475
|
##
|
|
476
476
|
# Adds "(from ...)" to +out+ for +store+
|
|
477
477
|
|
|
478
|
-
def add_from
|
|
478
|
+
def add_from(out, store)
|
|
479
479
|
out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
|
|
480
480
|
end
|
|
481
481
|
|
|
482
482
|
##
|
|
483
483
|
# Adds +extends+ to +out+
|
|
484
484
|
|
|
485
|
-
def add_extends
|
|
485
|
+
def add_extends(out, extends)
|
|
486
486
|
add_extension_modules out, 'Extended by', extends
|
|
487
487
|
end
|
|
488
488
|
|
|
@@ -490,7 +490,7 @@ or the PAGER environment variable.
|
|
|
490
490
|
# Adds a list of +extensions+ to this module of the given +type+ to +out+.
|
|
491
491
|
# add_includes and add_extends call this, so you should use those directly.
|
|
492
492
|
|
|
493
|
-
def add_extension_modules
|
|
493
|
+
def add_extension_modules(out, type, extensions)
|
|
494
494
|
return if extensions.empty?
|
|
495
495
|
|
|
496
496
|
out << RDoc::Markup::Rule.new(1)
|
|
@@ -508,7 +508,7 @@ or the PAGER environment variable.
|
|
|
508
508
|
##
|
|
509
509
|
# Renders multiple included +modules+ from +store+ to +out+.
|
|
510
510
|
|
|
511
|
-
def add_extension_modules_multiple
|
|
511
|
+
def add_extension_modules_multiple(out, store, modules) # :nodoc:
|
|
512
512
|
out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
|
|
513
513
|
|
|
514
514
|
wout, with = modules.partition { |incl| incl.comment.empty? }
|
|
@@ -535,7 +535,7 @@ or the PAGER environment variable.
|
|
|
535
535
|
##
|
|
536
536
|
# Adds a single extension module +include+ from +store+ to +out+
|
|
537
537
|
|
|
538
|
-
def add_extension_modules_single
|
|
538
|
+
def add_extension_modules_single(out, store, include) # :nodoc:
|
|
539
539
|
name = include.name
|
|
540
540
|
path = store.friendly_path
|
|
541
541
|
out << RDoc::Markup::Paragraph.new("#{name} (from #{path})")
|
|
@@ -549,14 +549,14 @@ or the PAGER environment variable.
|
|
|
549
549
|
##
|
|
550
550
|
# Adds +includes+ to +out+
|
|
551
551
|
|
|
552
|
-
def add_includes
|
|
552
|
+
def add_includes(out, includes)
|
|
553
553
|
add_extension_modules out, 'Includes', includes
|
|
554
554
|
end
|
|
555
555
|
|
|
556
556
|
##
|
|
557
557
|
# Looks up the method +name+ and adds it to +out+
|
|
558
558
|
|
|
559
|
-
def add_method
|
|
559
|
+
def add_method(out, name)
|
|
560
560
|
filtered = lookup_method name
|
|
561
561
|
method_document out, name, filtered
|
|
562
562
|
end
|
|
@@ -564,7 +564,7 @@ or the PAGER environment variable.
|
|
|
564
564
|
##
|
|
565
565
|
# Adds documentation for all methods in +klass+ to +out+
|
|
566
566
|
|
|
567
|
-
def add_method_documentation
|
|
567
|
+
def add_method_documentation(out, klass)
|
|
568
568
|
klass.method_list.each do |method|
|
|
569
569
|
begin
|
|
570
570
|
add_method out, method.full_name
|
|
@@ -577,7 +577,7 @@ or the PAGER environment variable.
|
|
|
577
577
|
##
|
|
578
578
|
# Adds a list of +methods+ to +out+ with a heading of +name+
|
|
579
579
|
|
|
580
|
-
def add_method_list
|
|
580
|
+
def add_method_list(out, methods, name)
|
|
581
581
|
return if methods.empty?
|
|
582
582
|
|
|
583
583
|
out << RDoc::Markup::Heading.new(1, "#{name}:")
|
|
@@ -597,7 +597,7 @@ or the PAGER environment variable.
|
|
|
597
597
|
##
|
|
598
598
|
# Returns ancestor classes of +klass+
|
|
599
599
|
|
|
600
|
-
def ancestors_of
|
|
600
|
+
def ancestors_of(klass)
|
|
601
601
|
ancestors = []
|
|
602
602
|
|
|
603
603
|
unexamined = [klass]
|
|
@@ -634,7 +634,7 @@ or the PAGER environment variable.
|
|
|
634
634
|
##
|
|
635
635
|
# Builds a RDoc::Markup::Document from +found+, +klasess+ and +includes+
|
|
636
636
|
|
|
637
|
-
def class_document
|
|
637
|
+
def class_document(name, found, klasses, includes, extends)
|
|
638
638
|
also_in = []
|
|
639
639
|
|
|
640
640
|
out = RDoc::Markup::Document.new
|
|
@@ -657,7 +657,7 @@ or the PAGER environment variable.
|
|
|
657
657
|
##
|
|
658
658
|
# Adds the class +comment+ to +out+.
|
|
659
659
|
|
|
660
|
-
def class_document_comment
|
|
660
|
+
def class_document_comment(out, document) # :nodoc:
|
|
661
661
|
unless document.empty? then
|
|
662
662
|
out << RDoc::Markup::Rule.new(1)
|
|
663
663
|
|
|
@@ -677,7 +677,7 @@ or the PAGER environment variable.
|
|
|
677
677
|
##
|
|
678
678
|
# Adds the constants from +klass+ to the Document +out+.
|
|
679
679
|
|
|
680
|
-
def class_document_constants
|
|
680
|
+
def class_document_constants(out, klass) # :nodoc:
|
|
681
681
|
return if klass.constants.empty?
|
|
682
682
|
|
|
683
683
|
out << RDoc::Markup::Heading.new(1, "Constants:")
|
|
@@ -721,7 +721,7 @@ or the PAGER environment variable.
|
|
|
721
721
|
# Returns the stores wherein +name+ is found along with the classes,
|
|
722
722
|
# extends and includes that match it
|
|
723
723
|
|
|
724
|
-
def classes_and_includes_and_extends_for
|
|
724
|
+
def classes_and_includes_and_extends_for(name)
|
|
725
725
|
klasses = []
|
|
726
726
|
extends = []
|
|
727
727
|
includes = []
|
|
@@ -746,7 +746,7 @@ or the PAGER environment variable.
|
|
|
746
746
|
##
|
|
747
747
|
# Completes +name+ based on the caches. For Readline
|
|
748
748
|
|
|
749
|
-
def complete
|
|
749
|
+
def complete(name)
|
|
750
750
|
completions = []
|
|
751
751
|
|
|
752
752
|
klass, selector, method = parse_name name
|
|
@@ -757,7 +757,7 @@ or the PAGER environment variable.
|
|
|
757
757
|
completions.uniq.select {|s| s.start_with? name }.sort
|
|
758
758
|
end
|
|
759
759
|
|
|
760
|
-
def complete_klass
|
|
760
|
+
def complete_klass(name, klass, selector, method, completions) # :nodoc:
|
|
761
761
|
klasses = classes.keys
|
|
762
762
|
|
|
763
763
|
# may need to include Foo when given Foo::
|
|
@@ -776,7 +776,7 @@ or the PAGER environment variable.
|
|
|
776
776
|
end
|
|
777
777
|
end
|
|
778
778
|
|
|
779
|
-
def complete_method
|
|
779
|
+
def complete_method(name, klass, selector, completions) # :nodoc:
|
|
780
780
|
if completions.include? klass and name =~ /#|\.|::/ then
|
|
781
781
|
methods = list_methods_matching name
|
|
782
782
|
|
|
@@ -804,7 +804,7 @@ or the PAGER environment variable.
|
|
|
804
804
|
##
|
|
805
805
|
# Converts +document+ to text and writes it to the pager
|
|
806
806
|
|
|
807
|
-
def display
|
|
807
|
+
def display(document)
|
|
808
808
|
page do |io|
|
|
809
809
|
f = formatter(io)
|
|
810
810
|
f.width = @width if @width and f.respond_to?(:width)
|
|
@@ -817,7 +817,7 @@ or the PAGER environment variable.
|
|
|
817
817
|
##
|
|
818
818
|
# Outputs formatted RI data for class +name+. Groups undocumented classes
|
|
819
819
|
|
|
820
|
-
def display_class
|
|
820
|
+
def display_class(name)
|
|
821
821
|
return if name =~ /#|\./
|
|
822
822
|
|
|
823
823
|
found, klasses, includes, extends =
|
|
@@ -833,7 +833,7 @@ or the PAGER environment variable.
|
|
|
833
833
|
##
|
|
834
834
|
# Outputs formatted RI data for method +name+
|
|
835
835
|
|
|
836
|
-
def display_method
|
|
836
|
+
def display_method(name)
|
|
837
837
|
out = RDoc::Markup::Document.new
|
|
838
838
|
|
|
839
839
|
add_method out, name
|
|
@@ -849,7 +849,7 @@ or the PAGER environment variable.
|
|
|
849
849
|
# Returns true if +name+ was found, false if it was not an alternative could
|
|
850
850
|
# be guessed, raises an error if +name+ couldn't be guessed.
|
|
851
851
|
|
|
852
|
-
def display_name
|
|
852
|
+
def display_name(name)
|
|
853
853
|
if name =~ /\w:(\w|$)/ then
|
|
854
854
|
display_page name
|
|
855
855
|
return true
|
|
@@ -878,7 +878,7 @@ or the PAGER environment variable.
|
|
|
878
878
|
##
|
|
879
879
|
# Displays each name in +name+
|
|
880
880
|
|
|
881
|
-
def display_names
|
|
881
|
+
def display_names(names)
|
|
882
882
|
names.each do |name|
|
|
883
883
|
name = expand_name name
|
|
884
884
|
|
|
@@ -889,7 +889,7 @@ or the PAGER environment variable.
|
|
|
889
889
|
##
|
|
890
890
|
# Outputs formatted RI data for page +name+.
|
|
891
891
|
|
|
892
|
-
def display_page
|
|
892
|
+
def display_page(name)
|
|
893
893
|
store_name, page_name = name.split ':', 2
|
|
894
894
|
|
|
895
895
|
store = @stores.find { |s| s.source == store_name }
|
|
@@ -920,7 +920,7 @@ or the PAGER environment variable.
|
|
|
920
920
|
##
|
|
921
921
|
# Outputs a formatted RI page list for the pages in +store+.
|
|
922
922
|
|
|
923
|
-
def display_page_list
|
|
923
|
+
def display_page_list(store, pages = store.cache[:pages], search = nil)
|
|
924
924
|
out = RDoc::Markup::Document.new
|
|
925
925
|
|
|
926
926
|
title = if search then
|
|
@@ -964,7 +964,7 @@ or the PAGER environment variable.
|
|
|
964
964
|
# Expands abbreviated klass +klass+ into a fully-qualified class. "Zl::Da"
|
|
965
965
|
# will be expanded to Zlib::DataError.
|
|
966
966
|
|
|
967
|
-
def expand_class
|
|
967
|
+
def expand_class(klass)
|
|
968
968
|
class_names = classes.keys
|
|
969
969
|
ary = class_names.grep(Regexp.new("\\A#{klass.gsub(/(?=::|\z)/, '[^:]*')}\\z"))
|
|
970
970
|
if ary.length != 1 && ary.first != klass
|
|
@@ -982,7 +982,7 @@ or the PAGER environment variable.
|
|
|
982
982
|
# Expands the class portion of +name+ into a fully-qualified class. See
|
|
983
983
|
# #expand_class.
|
|
984
984
|
|
|
985
|
-
def expand_name
|
|
985
|
+
def expand_name(name)
|
|
986
986
|
klass, selector, method = parse_name name
|
|
987
987
|
|
|
988
988
|
return [selector, method].join if klass.empty?
|
|
@@ -998,7 +998,7 @@ or the PAGER environment variable.
|
|
|
998
998
|
##
|
|
999
999
|
# Filters the methods in +found+ trying to find a match for +name+.
|
|
1000
1000
|
|
|
1001
|
-
def filter_methods
|
|
1001
|
+
def filter_methods(found, name)
|
|
1002
1002
|
regexp = name_regexp name
|
|
1003
1003
|
|
|
1004
1004
|
filtered = found.find_all do |store, methods|
|
|
@@ -1016,7 +1016,7 @@ or the PAGER environment variable.
|
|
|
1016
1016
|
# types of methods to look up (from #method_type), and the method name being
|
|
1017
1017
|
# searched for
|
|
1018
1018
|
|
|
1019
|
-
def find_methods
|
|
1019
|
+
def find_methods(name)
|
|
1020
1020
|
klass, selector, method = parse_name name
|
|
1021
1021
|
|
|
1022
1022
|
types = method_type selector
|
|
@@ -1062,7 +1062,7 @@ or the PAGER environment variable.
|
|
|
1062
1062
|
#
|
|
1063
1063
|
# See also RDoc::Store#source
|
|
1064
1064
|
|
|
1065
|
-
def find_store
|
|
1065
|
+
def find_store(name)
|
|
1066
1066
|
@stores.each do |store|
|
|
1067
1067
|
source = store.source
|
|
1068
1068
|
|
|
@@ -1131,7 +1131,7 @@ or the PAGER environment variable.
|
|
|
1131
1131
|
# Lists classes known to ri starting with +names+. If +names+ is empty all
|
|
1132
1132
|
# known classes are shown.
|
|
1133
1133
|
|
|
1134
|
-
def list_known_classes
|
|
1134
|
+
def list_known_classes(names = [])
|
|
1135
1135
|
classes = []
|
|
1136
1136
|
|
|
1137
1137
|
stores.each do |store|
|
|
@@ -1163,7 +1163,7 @@ or the PAGER environment variable.
|
|
|
1163
1163
|
##
|
|
1164
1164
|
# Returns an Array of methods matching +name+
|
|
1165
1165
|
|
|
1166
|
-
def list_methods_matching
|
|
1166
|
+
def list_methods_matching(name)
|
|
1167
1167
|
found = []
|
|
1168
1168
|
|
|
1169
1169
|
find_methods name do |store, klass, ancestor, types, method|
|
|
@@ -1202,7 +1202,7 @@ or the PAGER environment variable.
|
|
|
1202
1202
|
# Loads RI data for method +name+ on +klass+ from +store+. +type+ and
|
|
1203
1203
|
# +cache+ indicate if it is a class or instance method.
|
|
1204
1204
|
|
|
1205
|
-
def load_method
|
|
1205
|
+
def load_method(store, cache, klass, type, name)
|
|
1206
1206
|
methods = store.public_send(cache)[klass]
|
|
1207
1207
|
|
|
1208
1208
|
return unless methods
|
|
@@ -1226,7 +1226,7 @@ or the PAGER environment variable.
|
|
|
1226
1226
|
##
|
|
1227
1227
|
# Returns an Array of RI data for methods matching +name+
|
|
1228
1228
|
|
|
1229
|
-
def load_methods_matching
|
|
1229
|
+
def load_methods_matching(name)
|
|
1230
1230
|
found = []
|
|
1231
1231
|
|
|
1232
1232
|
find_methods name do |store, klass, ancestor, types, method|
|
|
@@ -1247,7 +1247,7 @@ or the PAGER environment variable.
|
|
|
1247
1247
|
##
|
|
1248
1248
|
# Returns a filtered list of methods matching +name+
|
|
1249
1249
|
|
|
1250
|
-
def lookup_method
|
|
1250
|
+
def lookup_method(name)
|
|
1251
1251
|
found = load_methods_matching name
|
|
1252
1252
|
|
|
1253
1253
|
if found.empty?
|
|
@@ -1272,7 +1272,7 @@ or the PAGER environment variable.
|
|
|
1272
1272
|
##
|
|
1273
1273
|
# Builds a RDoc::Markup::Document from +found+, +klasses+ and +includes+
|
|
1274
1274
|
|
|
1275
|
-
def method_document
|
|
1275
|
+
def method_document(out, name, filtered)
|
|
1276
1276
|
out << RDoc::Markup::Heading.new(1, name)
|
|
1277
1277
|
out << RDoc::Markup::BlankLine.new
|
|
1278
1278
|
|
|
@@ -1288,7 +1288,7 @@ or the PAGER environment variable.
|
|
|
1288
1288
|
##
|
|
1289
1289
|
# Returns the type of method (:both, :instance, :class) for +selector+
|
|
1290
1290
|
|
|
1291
|
-
def method_type
|
|
1291
|
+
def method_type(selector)
|
|
1292
1292
|
case selector
|
|
1293
1293
|
when '.', nil then :both
|
|
1294
1294
|
when '#' then :instance
|
|
@@ -1300,7 +1300,7 @@ or the PAGER environment variable.
|
|
|
1300
1300
|
# Returns a regular expression for +name+ that will match an
|
|
1301
1301
|
# RDoc::AnyMethod's name.
|
|
1302
1302
|
|
|
1303
|
-
def name_regexp
|
|
1303
|
+
def name_regexp(name)
|
|
1304
1304
|
klass, type, name = parse_name name
|
|
1305
1305
|
|
|
1306
1306
|
case type
|
|
@@ -1343,7 +1343,7 @@ or the PAGER environment variable.
|
|
|
1343
1343
|
# NOTE: Given Foo::Bar, Bar is considered a class even though it may be a
|
|
1344
1344
|
# method
|
|
1345
1345
|
|
|
1346
|
-
def parse_name
|
|
1346
|
+
def parse_name(name)
|
|
1347
1347
|
parts = name.split(/(::?|#|\.)/)
|
|
1348
1348
|
|
|
1349
1349
|
if parts.length == 1 then
|
|
@@ -1375,7 +1375,7 @@ or the PAGER environment variable.
|
|
|
1375
1375
|
# Renders the +klass+ from +store+ to +out+. If the klass has no
|
|
1376
1376
|
# documentable items the class is added to +also_in+ instead.
|
|
1377
1377
|
|
|
1378
|
-
def render_class
|
|
1378
|
+
def render_class(out, store, klass, also_in) # :nodoc:
|
|
1379
1379
|
document = klass.comment.parse
|
|
1380
1380
|
# TODO the store's cache should always return an empty Array
|
|
1381
1381
|
class_methods = store.class_methods[klass.full_name] || []
|
|
@@ -1405,7 +1405,7 @@ or the PAGER environment variable.
|
|
|
1405
1405
|
add_method_documentation out, klass if @show_all
|
|
1406
1406
|
end
|
|
1407
1407
|
|
|
1408
|
-
def render_method
|
|
1408
|
+
def render_method(out, store, method, name) # :nodoc:
|
|
1409
1409
|
out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
|
|
1410
1410
|
|
|
1411
1411
|
unless name =~ /^#{Regexp.escape method.parent_name}/ then
|
|
@@ -1425,7 +1425,7 @@ or the PAGER environment variable.
|
|
|
1425
1425
|
end
|
|
1426
1426
|
end
|
|
1427
1427
|
|
|
1428
|
-
def render_method_arguments
|
|
1428
|
+
def render_method_arguments(out, arglists) # :nodoc:
|
|
1429
1429
|
return unless arglists
|
|
1430
1430
|
|
|
1431
1431
|
arglists = arglists.chomp.split "\n"
|
|
@@ -1434,7 +1434,7 @@ or the PAGER environment variable.
|
|
|
1434
1434
|
out << RDoc::Markup::Rule.new(1)
|
|
1435
1435
|
end
|
|
1436
1436
|
|
|
1437
|
-
def render_method_comment
|
|
1437
|
+
def render_method_comment(out, method, alias_for = nil)# :nodoc:
|
|
1438
1438
|
if alias_for
|
|
1439
1439
|
unless method.comment.nil? or method.comment.empty?
|
|
1440
1440
|
out << RDoc::Markup::BlankLine.new
|
|
@@ -1452,7 +1452,7 @@ or the PAGER environment variable.
|
|
|
1452
1452
|
end
|
|
1453
1453
|
end
|
|
1454
1454
|
|
|
1455
|
-
def render_method_superclass
|
|
1455
|
+
def render_method_superclass(out, method) # :nodoc:
|
|
1456
1456
|
return unless
|
|
1457
1457
|
method.respond_to?(:superclass_method) and method.superclass_method
|
|
1458
1458
|
|
data/lib/rdoc/ri/paths.rb
CHANGED
|
@@ -52,7 +52,7 @@ module RDoc::RI::Paths
|
|
|
52
52
|
##
|
|
53
53
|
# The ri directory for the gem with +gem_name+.
|
|
54
54
|
|
|
55
|
-
def self.gem_dir
|
|
55
|
+
def self.gem_dir(name, version)
|
|
56
56
|
req = Gem::Requirement.new "= #{version}"
|
|
57
57
|
|
|
58
58
|
spec = Gem::Specification.find_by_name name, req
|
|
@@ -67,7 +67,7 @@ module RDoc::RI::Paths
|
|
|
67
67
|
# A +filter+ :all includes all versions of gems and includes gems without
|
|
68
68
|
# ri documentation.
|
|
69
69
|
|
|
70
|
-
def self.gemdirs
|
|
70
|
+
def self.gemdirs(filter = :latest)
|
|
71
71
|
ri_paths = {}
|
|
72
72
|
|
|
73
73
|
all = Gem::Specification.map do |spec|
|
data/lib/rdoc/ri/task.rb
CHANGED
|
@@ -26,8 +26,8 @@ require_relative '../task'
|
|
|
26
26
|
# require 'rdoc/ri/task'
|
|
27
27
|
#
|
|
28
28
|
# RDoc::RI::Task.new do |ri|
|
|
29
|
-
# ri.main = 'README.
|
|
30
|
-
# ri.rdoc_files.include 'README.
|
|
29
|
+
# ri.main = 'README.md'
|
|
30
|
+
# ri.rdoc_files.include 'README.md', 'lib/**/*.rb'
|
|
31
31
|
# end
|
|
32
32
|
#
|
|
33
33
|
# For further configuration details see RDoc::Task.
|
|
@@ -44,7 +44,7 @@ class RDoc::RI::Task < RDoc::Task
|
|
|
44
44
|
# Create an ri task with the given name. See RDoc::Task for documentation on
|
|
45
45
|
# setting names.
|
|
46
46
|
|
|
47
|
-
def initialize
|
|
47
|
+
def initialize(name = DEFAULT_NAMES) # :yield: self
|
|
48
48
|
super
|
|
49
49
|
end
|
|
50
50
|
|
data/lib/rdoc/rubygems_hook.rb
CHANGED
|
@@ -51,7 +51,7 @@ class RDoc::RubyGemsHook
|
|
|
51
51
|
# Post installs hook that generates documentation for each specification in
|
|
52
52
|
# +specs+
|
|
53
53
|
|
|
54
|
-
def self.generate
|
|
54
|
+
def self.generate(installer, specs)
|
|
55
55
|
start = Time.now
|
|
56
56
|
types = installer.document
|
|
57
57
|
|
|
@@ -70,7 +70,7 @@ class RDoc::RubyGemsHook
|
|
|
70
70
|
say "Done installing documentation for #{names} after #{duration} seconds"
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
def self.remove
|
|
73
|
+
def self.remove(uninstaller)
|
|
74
74
|
new(uninstaller.spec).remove
|
|
75
75
|
end
|
|
76
76
|
|
|
@@ -92,7 +92,7 @@ class RDoc::RubyGemsHook
|
|
|
92
92
|
#
|
|
93
93
|
# Only +generate_ri+ is enabled by default.
|
|
94
94
|
|
|
95
|
-
def initialize
|
|
95
|
+
def initialize(spec, generate_rdoc = false, generate_ri = true)
|
|
96
96
|
@doc_dir = spec.doc_dir
|
|
97
97
|
@force = false
|
|
98
98
|
@rdoc = nil
|
|
@@ -110,7 +110,7 @@ class RDoc::RubyGemsHook
|
|
|
110
110
|
#--
|
|
111
111
|
# TODO move to RDoc::Options
|
|
112
112
|
|
|
113
|
-
def delete_legacy_args
|
|
113
|
+
def delete_legacy_args(args)
|
|
114
114
|
args.delete '--inline-source'
|
|
115
115
|
args.delete '--promiscuous'
|
|
116
116
|
args.delete '-p'
|
|
@@ -123,7 +123,7 @@ class RDoc::RubyGemsHook
|
|
|
123
123
|
#
|
|
124
124
|
# Documentation will be generated into +destination+
|
|
125
125
|
|
|
126
|
-
def document
|
|
126
|
+
def document(generator, options, destination)
|
|
127
127
|
generator_name = generator
|
|
128
128
|
|
|
129
129
|
options = options.dup
|
|
@@ -182,18 +182,21 @@ class RDoc::RubyGemsHook
|
|
|
182
182
|
options.default_title = "#{@spec.full_name} Documentation"
|
|
183
183
|
options.parse args
|
|
184
184
|
options.quiet = !Gem.configuration.really_verbose
|
|
185
|
-
options.finish
|
|
186
185
|
end
|
|
187
186
|
|
|
188
187
|
@rdoc = new_rdoc
|
|
189
|
-
@rdoc.options = options
|
|
190
|
-
|
|
191
|
-
@rdoc.store = RDoc::Store.new(options)
|
|
192
188
|
|
|
193
189
|
say "Parsing documentation for #{@spec.full_name}"
|
|
194
190
|
|
|
195
191
|
Dir.chdir @spec.full_gem_path do
|
|
196
|
-
|
|
192
|
+
# RDoc::Options#finish must be called before parse_files.
|
|
193
|
+
# RDoc::Options#finish is also called after ri/darkfish generator setup.
|
|
194
|
+
# We need to dup the options to avoid modifying it after finish is called.
|
|
195
|
+
parse_options = options.dup
|
|
196
|
+
parse_options.finish
|
|
197
|
+
@rdoc.options = parse_options
|
|
198
|
+
@rdoc.store = RDoc::Store.new(parse_options)
|
|
199
|
+
@rdoc.parse_files parse_options.files
|
|
197
200
|
end
|
|
198
201
|
|
|
199
202
|
document 'ri', options, @ri_dir if
|
|
@@ -297,7 +300,7 @@ module RDoc
|
|
|
297
300
|
RubyGemsHook.new(@spec).remove
|
|
298
301
|
end
|
|
299
302
|
|
|
300
|
-
def self.generation_hook
|
|
303
|
+
def self.generation_hook(installer, specs)
|
|
301
304
|
# Do nothing if this is NOT a default gem.
|
|
302
305
|
return unless default_gem?
|
|
303
306
|
|