rdoc 5.0.0 → 6.3.1
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.
- checksums.yaml +5 -5
- data/CONTRIBUTING.rdoc +4 -4
- data/Gemfile +9 -0
- data/History.rdoc +12 -2
- data/README.rdoc +5 -6
- data/Rakefile +35 -65
- data/lib/rdoc/alias.rb +1 -1
- data/lib/rdoc/anon_class.rb +1 -1
- data/lib/rdoc/any_method.rb +59 -15
- data/lib/rdoc/attr.rb +1 -1
- data/lib/rdoc/class_module.rb +5 -3
- data/lib/rdoc/code_object.rb +2 -9
- data/lib/rdoc/code_objects.rb +1 -1
- data/lib/rdoc/comment.rb +32 -11
- data/lib/rdoc/constant.rb +3 -3
- data/lib/rdoc/context/section.rb +1 -14
- data/lib/rdoc/context.rb +74 -21
- data/lib/rdoc/cross_reference.rb +33 -15
- data/lib/rdoc/encoding.rb +58 -30
- data/lib/rdoc/erb_partial.rb +2 -2
- data/lib/rdoc/erbio.rb +8 -4
- data/lib/rdoc/extend.rb +1 -1
- data/lib/rdoc/generator/darkfish.rb +60 -29
- data/lib/rdoc/generator/json_index.rb +7 -4
- data/lib/rdoc/generator/markup.rb +3 -13
- data/lib/rdoc/generator/pot/message_extractor.rb +1 -1
- data/lib/rdoc/generator/pot/po.rb +3 -3
- data/lib/rdoc/generator/pot/po_entry.rb +11 -11
- data/lib/rdoc/generator/pot.rb +4 -4
- data/lib/rdoc/generator/ri.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +9 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +6 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/class.rhtml +45 -47
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +55 -6
- data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -4
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +22 -99
- data/lib/rdoc/generator/template/darkfish/js/search.js +32 -31
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +15 -16
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +16 -16
- data/lib/rdoc/generator/template/json_index/js/navigation.js +4 -41
- data/lib/rdoc/generator/template/json_index/js/searcher.js +6 -6
- data/lib/rdoc/generator.rb +1 -1
- data/lib/rdoc/ghost_method.rb +1 -1
- data/lib/rdoc/i18n/locale.rb +2 -2
- data/lib/rdoc/i18n/text.rb +5 -5
- data/lib/rdoc/i18n.rb +3 -3
- data/lib/rdoc/include.rb +1 -1
- data/lib/rdoc/known_classes.rb +1 -1
- data/lib/rdoc/markdown/entities.rb +1 -1
- data/lib/rdoc/markdown/literals.kpeg +1 -0
- data/lib/rdoc/markdown/literals.rb +19 -7
- data/lib/rdoc/markdown.kpeg +92 -44
- data/lib/rdoc/markdown.rb +1171 -610
- data/lib/rdoc/markup/attr_changer.rb +1 -1
- data/lib/rdoc/markup/attr_span.rb +9 -3
- data/lib/rdoc/markup/attribute_manager.rb +115 -50
- data/lib/rdoc/markup/attributes.rb +7 -7
- data/lib/rdoc/markup/blank_line.rb +1 -1
- data/lib/rdoc/markup/block_quote.rb +1 -1
- data/lib/rdoc/markup/document.rb +1 -1
- data/lib/rdoc/markup/formatter.rb +25 -24
- data/lib/rdoc/markup/hard_break.rb +1 -1
- data/lib/rdoc/markup/heading.rb +4 -4
- data/lib/rdoc/markup/include.rb +1 -1
- data/lib/rdoc/markup/indented_paragraph.rb +1 -1
- data/lib/rdoc/markup/list.rb +1 -1
- data/lib/rdoc/markup/list_item.rb +1 -1
- data/lib/rdoc/markup/paragraph.rb +1 -1
- data/lib/rdoc/markup/parser.rb +79 -47
- data/lib/rdoc/markup/pre_process.rb +11 -6
- data/lib/rdoc/markup/raw.rb +1 -1
- data/lib/rdoc/markup/regexp_handling.rb +41 -0
- data/lib/rdoc/markup/rule.rb +1 -1
- data/lib/rdoc/markup/to_ansi.rb +1 -1
- data/lib/rdoc/markup/to_bs.rb +4 -4
- data/lib/rdoc/markup/to_html.rb +71 -26
- data/lib/rdoc/markup/to_html_crossref.rb +41 -26
- data/lib/rdoc/markup/to_html_snippet.rb +10 -10
- data/lib/rdoc/markup/to_joined_paragraph.rb +7 -32
- data/lib/rdoc/markup/to_label.rb +10 -10
- data/lib/rdoc/markup/to_markdown.rb +9 -9
- data/lib/rdoc/markup/to_rdoc.rb +35 -7
- data/lib/rdoc/markup/to_table_of_contents.rb +2 -1
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +3 -3
- data/lib/rdoc/markup/verbatim.rb +1 -1
- data/lib/rdoc/markup.rb +14 -17
- data/lib/rdoc/meta_method.rb +1 -1
- data/lib/rdoc/method_attr.rb +2 -2
- data/lib/rdoc/mixin.rb +1 -1
- data/lib/rdoc/normal_class.rb +3 -3
- data/lib/rdoc/normal_module.rb +1 -1
- data/lib/rdoc/options.rb +79 -21
- data/lib/rdoc/parser/c.rb +147 -194
- data/lib/rdoc/parser/changelog.rb +150 -19
- data/lib/rdoc/parser/markdown.rb +1 -1
- data/lib/rdoc/parser/rd.rb +1 -1
- data/lib/rdoc/parser/ripper_state_lex.rb +590 -0
- data/lib/rdoc/parser/ruby.rb +634 -465
- data/lib/rdoc/parser/ruby_tools.rb +33 -34
- data/lib/rdoc/parser/simple.rb +3 -3
- data/lib/rdoc/parser/text.rb +1 -1
- data/lib/rdoc/parser.rb +12 -35
- data/lib/rdoc/rd/block_parser.rb +109 -108
- data/lib/rdoc/rd/block_parser.ry +3 -3
- data/lib/rdoc/rd/inline.rb +5 -5
- data/lib/rdoc/rd/inline_parser.rb +186 -185
- data/lib/rdoc/rd/inline_parser.ry +1 -1
- data/lib/rdoc/rd.rb +1 -1
- data/lib/rdoc/rdoc.rb +54 -41
- data/lib/rdoc/require.rb +1 -1
- data/lib/rdoc/ri/driver.rb +132 -42
- data/lib/rdoc/ri/formatter.rb +1 -1
- data/lib/rdoc/ri/paths.rb +4 -18
- data/lib/rdoc/ri/store.rb +1 -1
- data/lib/rdoc/ri/task.rb +2 -2
- data/lib/rdoc/ri.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +3 -3
- data/lib/rdoc/servlet.rb +21 -12
- data/lib/rdoc/single_class.rb +1 -1
- data/lib/rdoc/stats/normal.rb +24 -18
- data/lib/rdoc/stats/quiet.rb +1 -1
- data/lib/rdoc/stats/verbose.rb +1 -1
- data/lib/rdoc/stats.rb +1 -1
- data/lib/rdoc/store.rb +38 -27
- data/lib/rdoc/task.rb +2 -2
- data/lib/rdoc/text.rb +16 -21
- data/lib/rdoc/token_stream.rb +56 -33
- data/lib/rdoc/tom_doc.rb +17 -12
- data/lib/rdoc/top_level.rb +9 -3
- data/lib/rdoc/version.rb +8 -0
- data/lib/rdoc.rb +24 -10
- data/man/ri.1 +247 -0
- data/rdoc.gemspec +206 -15
- metadata +15 -64
- data/.document +0 -5
- data/.gitignore +0 -13
- data/.travis.yml +0 -23
- data/lib/gauntlet_rdoc.rb +0 -82
- data/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -4
- data/lib/rdoc/markup/formatter_test_case.rb +0 -764
- data/lib/rdoc/markup/inline.rb +0 -2
- data/lib/rdoc/markup/special.rb +0 -41
- data/lib/rdoc/markup/text_formatter_test_case.rb +0 -115
- data/lib/rdoc/ruby_lex.rb +0 -1367
- data/lib/rdoc/ruby_token.rb +0 -461
- data/lib/rdoc/test_case.rb +0 -204
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 327e6414793206350f148388b0df495ff2c748c1d4bb129ef320a442e4084619
|
4
|
+
data.tar.gz: 44c884a1eb18506c90af82fefa6f7686973ab32e1ceb42c6616b0ffbf88ac868
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8691cde93b42f6c4ff77f6212e40c5c15c408b1953e58cf14f17cef142970ff79564bf7fe12b7f072067267fd67ad62920241e54e7a6d592487545bd19a82311
|
7
|
+
data.tar.gz: 3adbda517d389982d0d67ccd92478d0b0912c156c2988a26089715ff77e998025d6f2d8eafd44cdbd66daa2c647bd2201d1c0f57c5731bac19c45aea3014ae4c
|
data/CONTRIBUTING.rdoc
CHANGED
@@ -8,7 +8,7 @@ classes for each feature.
|
|
8
8
|
== Bugs
|
9
9
|
|
10
10
|
If you think you found a bug, file a ticket on the {issues
|
11
|
-
tracker}[https://github.com/
|
11
|
+
tracker}[https://github.com/ruby/rdoc/issues] on github.
|
12
12
|
|
13
13
|
If your bug involves an error RDoc produced please include a sample file that
|
14
14
|
illustrates the problem or link to the repository or gem that is associated
|
@@ -17,8 +17,8 @@ with the bug.
|
|
17
17
|
Please include steps to reproduce the issue. Here are some examples of good
|
18
18
|
issues:
|
19
19
|
|
20
|
-
* https://github.com/
|
21
|
-
* https://github.com/
|
20
|
+
* https://github.com/ruby/rdoc/issues/55
|
21
|
+
* https://github.com/ruby/rdoc/issues/61
|
22
22
|
|
23
23
|
== Developer Quick Start
|
24
24
|
|
@@ -35,7 +35,7 @@ This will install all the necessary dependencies for development with rake,
|
|
35
35
|
generate documentation and run the tests for the first time.
|
36
36
|
|
37
37
|
If the tests don't pass on the first run check the {Travis CI page for
|
38
|
-
RDoc}[https://travis-ci.org/
|
38
|
+
RDoc}[https://travis-ci.org/ruby/rdoc] to see if there are any known failures
|
39
39
|
(there shouldn't be).
|
40
40
|
|
41
41
|
You can now use `rake` and `autotest` to run the tests.
|
data/Gemfile
CHANGED
data/History.rdoc
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
=== 5.
|
1
|
+
=== 5.1.0 / 2017-02-24
|
2
|
+
|
3
|
+
* Bug fixes
|
4
|
+
* Fix an issue that rdoc fails when running on Windows with RUBYOPT=-U.
|
5
|
+
PR #430 by Toshihiko Ichida
|
6
|
+
|
7
|
+
* Minor enhancements
|
8
|
+
* Parse ruby 2.1 <visibility> def. PR #436 by Akira Matsuda.
|
9
|
+
* Suppress warnings in eval. PR #440 by Nobuyoshi Nakada.
|
10
|
+
|
11
|
+
=== 5.0.0 / 2016-11-05
|
2
12
|
|
3
13
|
* Major enhancements
|
4
14
|
* Cleanup deprecated code targeted Ruby 1.8
|
@@ -67,7 +77,7 @@
|
|
67
77
|
* Bug fixes
|
68
78
|
* Fixed HTML labels for cross-browser compatibility. This breaks existing
|
69
79
|
links but enables cross-browser compatibility. Pull request #330 by Jens
|
70
|
-
|
80
|
+
Will.
|
71
81
|
* RDoc handles ASCII-incompatible encodings now. An encoding hint may need
|
72
82
|
to be added to the file for RDoc to produce correct output, though.
|
73
83
|
Issue #288 by Manuel Meurer.
|
data/README.rdoc
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
= \RDoc - Ruby Documentation System
|
2
2
|
|
3
|
-
home :: https://github.com/
|
4
|
-
rdoc :: https://
|
5
|
-
bugs :: https://github.com/
|
6
|
-
|
7
|
-
code quality :: {<img src="https://codeclimate.com/badge.png" alt="code climate">}[https://codeclimate.com/github/rdoc/rdoc]
|
3
|
+
home :: https://github.com/ruby/rdoc
|
4
|
+
rdoc :: https://ruby.github.io/rdoc
|
5
|
+
bugs :: https://github.com/ruby/rdoc/issues
|
6
|
+
code quality :: {<img src="https://codeclimate.com/github/ruby/rdoc/badges/gpa.svg" alt="Code Climate">}[https://codeclimate.com/github/ruby/rdoc]
|
8
7
|
|
9
8
|
== Description
|
10
9
|
|
@@ -47,7 +46,7 @@ contain just Markup-style markup (with or without leading '#' comment
|
|
47
46
|
markers). If directory names are passed to RDoc, they are scanned
|
48
47
|
recursively for C and Ruby source files only.
|
49
48
|
|
50
|
-
To generate documentation using +rake+ see RDoc::Task[https://
|
49
|
+
To generate documentation using +rake+ see RDoc::Task[https://ruby.github.io/rdoc/RDocTask.html].
|
51
50
|
|
52
51
|
To generate documentation programmatically:
|
53
52
|
|
data/Rakefile
CHANGED
@@ -3,10 +3,8 @@ require 'rdoc/task'
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rake/testtask'
|
5
5
|
|
6
|
-
ENV['BENCHMARK'] = 'yes'
|
7
|
-
|
8
6
|
task :docs => :generate
|
9
|
-
task :test => :
|
7
|
+
task :test => [:normal_test, :rubygems_test]
|
10
8
|
|
11
9
|
PARSER_FILES = %w[
|
12
10
|
lib/rdoc/rd/block_parser.ry
|
@@ -35,10 +33,18 @@ task ghpages: :rdoc do
|
|
35
33
|
FileUtils.cp_r Dir.glob("/tmp/html/*"), "."
|
36
34
|
end
|
37
35
|
|
38
|
-
Rake::TestTask.new(:
|
39
|
-
t.libs << "test"
|
40
|
-
t.
|
41
|
-
t.
|
36
|
+
Rake::TestTask.new(:normal_test) do |t|
|
37
|
+
t.libs << "test/rdoc"
|
38
|
+
t.verbose = true
|
39
|
+
t.deps = :generate
|
40
|
+
t.test_files = FileList["test/**/test_*.rb"].exclude("test/rdoc/test_rdoc_rubygems_hook.rb")
|
41
|
+
end
|
42
|
+
|
43
|
+
Rake::TestTask.new(:rubygems_test) do |t|
|
44
|
+
t.libs << "test/rdoc"
|
45
|
+
t.verbose = true
|
46
|
+
t.deps = :generate
|
47
|
+
t.pattern = "test/rdoc/test_rdoc_rubygems_hook.rb"
|
42
48
|
end
|
43
49
|
|
44
50
|
path = "pkg/#{Bundler::GemHelper.gemspec.full_name}"
|
@@ -55,20 +61,25 @@ package_parser_files = PARSER_FILES.map do |parser_file|
|
|
55
61
|
end
|
56
62
|
|
57
63
|
parsed_files = PARSER_FILES.map do |parser_file|
|
58
|
-
|
59
|
-
|
60
|
-
parsed_file = "#{_path}/#{name}.rb"
|
64
|
+
ext = File.extname(parser_file)
|
65
|
+
parsed_file = "#{parser_file.chomp(ext)}.rb"
|
61
66
|
|
62
|
-
file parsed_file do |t|
|
67
|
+
file parsed_file => parser_file do |t|
|
63
68
|
puts "Generating #{parsed_file}..."
|
64
|
-
|
69
|
+
case ext
|
70
|
+
when '.ry' # need racc
|
65
71
|
racc = Gem.bin_path 'racc', 'racc'
|
66
72
|
rb_file = parser_file.gsub(/\.ry\z/, ".rb")
|
67
|
-
ruby "
|
68
|
-
|
73
|
+
ruby "#{racc} -l -o #{rb_file} #{parser_file}"
|
74
|
+
open(rb_file, 'r+') do |f|
|
75
|
+
newtext = "# frozen_string_literal: true\n#{f.read}"
|
76
|
+
f.rewind
|
77
|
+
f.write newtext
|
78
|
+
end
|
79
|
+
when '.kpeg' # need kpeg
|
69
80
|
kpeg = Gem.bin_path 'kpeg', 'kpeg'
|
70
81
|
rb_file = parser_file.gsub(/\.kpeg\z/, ".rb")
|
71
|
-
ruby "
|
82
|
+
ruby "#{kpeg} -fsv -o #{rb_file} #{parser_file}"
|
72
83
|
end
|
73
84
|
end
|
74
85
|
|
@@ -76,56 +87,15 @@ parsed_files = PARSER_FILES.map do |parser_file|
|
|
76
87
|
end
|
77
88
|
|
78
89
|
task "#{path}.gem" => package_parser_files
|
90
|
+
desc "Generate all files used racc and kpeg"
|
79
91
|
task :generate => parsed_files
|
80
|
-
task :check_manifest => :generate
|
81
|
-
|
82
|
-
# These tasks expect to have the following directory structure:
|
83
|
-
#
|
84
|
-
# git/git.rubini.us/code # Rubinius git HEAD checkout
|
85
|
-
# svn/ruby/trunk # ruby subversion HEAD checkout
|
86
|
-
# svn/rdoc/trunk # RDoc subversion HEAD checkout
|
87
|
-
#
|
88
|
-
# If you don't have this directory structure, set RUBY_PATH and/or
|
89
|
-
# RUBINIUS_PATH.
|
90
|
-
|
91
|
-
diff_options = "-urpN --exclude '*svn*' --exclude '*swp' --exclude '*rbc'"
|
92
|
-
rsync_options = "-avP --exclude '*svn*' --exclude '*swp' --exclude '*rbc' --exclude '*.rej' --exclude '*.orig' --exclude '*.kpeg' --exclude '*.ry' --exclude 'literals_1_8.rb' --exclude 'gauntlet_rdoc.rb'"
|
93
|
-
|
94
|
-
rubinius_dir = ENV['RUBINIUS_PATH'] || '../../../git/git.rubini.us/code'
|
95
|
-
ruby_dir = ENV['RUBY_PATH'] || '../../svn/ruby/trunk'
|
96
|
-
|
97
|
-
desc "Updates Ruby HEAD with the currently checked-out copy of RDoc."
|
98
|
-
task :update_ruby do
|
99
|
-
sh "rsync #{rsync_options} bin/rdoc #{ruby_dir}/bin/rdoc"
|
100
|
-
sh "rsync #{rsync_options} bin/ri #{ruby_dir}/bin/ri"
|
101
|
-
sh "rsync #{rsync_options} lib/ #{ruby_dir}/lib"
|
102
|
-
sh "rsync #{rsync_options} test/ #{ruby_dir}/test/rdoc"
|
103
|
-
end
|
104
92
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
sh "diff #{diff_options} test #{ruby_dir}/test/rdoc; true"
|
114
|
-
end
|
115
|
-
|
116
|
-
desc "Updates Rubinius HEAD with the currently checked-out copy of RDoc."
|
117
|
-
task :update_rubinius do
|
118
|
-
sh "rsync #{rsync_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb"
|
119
|
-
sh "rsync #{rsync_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb"
|
120
|
-
sh "rsync #{rsync_options} lib/ #{rubinius_dir}/lib"
|
121
|
-
sh "rsync #{rsync_options} test/ #{rubinius_dir}/test/rdoc"
|
122
|
-
end
|
123
|
-
|
124
|
-
desc "Diffs Rubinius HEAD with the currently checked-out copy of RDoc."
|
125
|
-
task :diff_rubinius do
|
126
|
-
sh "diff #{diff_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb; true"
|
127
|
-
sh "diff #{diff_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb; true"
|
128
|
-
sh "diff #{diff_options} lib/rdoc.rb #{rubinius_dir}/lib/rdoc.rb; true"
|
129
|
-
sh "diff #{diff_options} lib/rdoc #{rubinius_dir}/lib/rdoc; true"
|
130
|
-
sh "diff #{diff_options} test #{rubinius_dir}/test/rdoc; true"
|
93
|
+
begin
|
94
|
+
require 'rubocop/rake_task'
|
95
|
+
rescue LoadError
|
96
|
+
else
|
97
|
+
RuboCop::RakeTask.new(:rubocop) do |t|
|
98
|
+
t.options = [*parsed_files]
|
99
|
+
end
|
100
|
+
task :build => [:generate, "rubocop:auto_correct"]
|
131
101
|
end
|
data/lib/rdoc/alias.rb
CHANGED
data/lib/rdoc/anon_class.rb
CHANGED
data/lib/rdoc/any_method.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
##
|
3
3
|
# AnyMethod is the base class for objects representing methods
|
4
4
|
|
@@ -26,12 +26,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
26
26
|
|
27
27
|
attr_accessor :c_function
|
28
28
|
|
29
|
-
##
|
30
|
-
# Different ways to call this method
|
31
|
-
|
32
|
-
attr_reader :call_seq
|
33
|
-
|
34
|
-
##
|
35
29
|
# Parameters for this method
|
36
30
|
|
37
31
|
attr_accessor :params
|
@@ -93,6 +87,19 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
93
87
|
end
|
94
88
|
end
|
95
89
|
|
90
|
+
##
|
91
|
+
# Different ways to call this method
|
92
|
+
|
93
|
+
def call_seq
|
94
|
+
unless call_seq = _call_seq
|
95
|
+
call_seq = is_alias_for._call_seq if is_alias_for
|
96
|
+
end
|
97
|
+
|
98
|
+
return unless call_seq
|
99
|
+
|
100
|
+
deduplicate_call_seq(call_seq)
|
101
|
+
end
|
102
|
+
|
96
103
|
##
|
97
104
|
# Sets the different ways you can call this method. If an empty +call_seq+
|
98
105
|
# is given nil is assumed.
|
@@ -244,9 +251,9 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
244
251
|
if @block_params then
|
245
252
|
# If this method has explicit block parameters, remove any explicit
|
246
253
|
# &block
|
247
|
-
params.sub
|
254
|
+
params = params.sub(/,?\s*&\w+/, '')
|
248
255
|
else
|
249
|
-
params.sub
|
256
|
+
params = params.sub(/\&(\w+)/, '\1')
|
250
257
|
end
|
251
258
|
|
252
259
|
params = params.gsub(/\s+/, '').split(',').reject(&:empty?)
|
@@ -265,7 +272,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
265
272
|
params = params.sub(/(\|[^|]+\|)\s*\.\.\.\s*(end|\})/, '\1 \2')
|
266
273
|
elsif @params then
|
267
274
|
params = @params.gsub(/\s*\#.*/, '')
|
268
|
-
params = params.
|
275
|
+
params = params.tr_s("\n ", " ")
|
269
276
|
params = "(#{params})" unless params[0] == ?(
|
270
277
|
else
|
271
278
|
params = ''
|
@@ -274,12 +281,11 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
274
281
|
if @block_params then
|
275
282
|
# If this method has explicit block parameters, remove any explicit
|
276
283
|
# &block
|
277
|
-
params.sub
|
284
|
+
params = params.sub(/,?\s*&\w+/, '')
|
278
285
|
|
279
|
-
block = @block_params.
|
280
|
-
block = block.tr("\n", " ").squeeze(" ")
|
286
|
+
block = @block_params.tr_s("\n ", " ")
|
281
287
|
if block[0] == ?(
|
282
|
-
block.sub
|
288
|
+
block = block.sub(/^\(/, '').sub(/\)/, '')
|
283
289
|
end
|
284
290
|
params << " { |#{block}| ... }"
|
285
291
|
end
|
@@ -313,5 +319,43 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
313
319
|
@superclass_method
|
314
320
|
end
|
315
321
|
|
316
|
-
|
322
|
+
protected
|
323
|
+
|
324
|
+
##
|
325
|
+
# call_seq without deduplication and alias lookup.
|
326
|
+
|
327
|
+
def _call_seq
|
328
|
+
@call_seq if defined?(@call_seq) && @call_seq
|
329
|
+
end
|
330
|
+
|
331
|
+
private
|
332
|
+
|
333
|
+
##
|
334
|
+
# call_seq with alias examples information removed, if this
|
335
|
+
# method is an alias method.
|
336
|
+
|
337
|
+
def deduplicate_call_seq(call_seq)
|
338
|
+
return call_seq unless is_alias_for || !aliases.empty?
|
339
|
+
|
340
|
+
method_name = self.name
|
341
|
+
method_name = method_name[0, 1] if method_name =~ /\A\[/
|
317
342
|
|
343
|
+
entries = call_seq.split "\n"
|
344
|
+
|
345
|
+
ignore = aliases.map(&:name)
|
346
|
+
if is_alias_for
|
347
|
+
ignore << is_alias_for.name
|
348
|
+
ignore.concat is_alias_for.aliases.map(&:name)
|
349
|
+
end
|
350
|
+
ignore.map! { |n| n =~ /\A\[/ ? n[0, 1] : n}
|
351
|
+
ignore.delete(method_name)
|
352
|
+
ignore = Regexp.union(ignore)
|
353
|
+
|
354
|
+
matching = entries.reject do |entry|
|
355
|
+
entry =~ /^\w*\.?#{ignore}/ or
|
356
|
+
entry =~ /\s#{ignore}\s/
|
357
|
+
end
|
358
|
+
|
359
|
+
matching.join "\n"
|
360
|
+
end
|
361
|
+
end
|
data/lib/rdoc/attr.rb
CHANGED
data/lib/rdoc/class_module.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
##
|
3
3
|
# ClassModule is the base class for objects representing either a class or a
|
4
4
|
# module.
|
@@ -136,7 +136,9 @@ class RDoc::ClassModule < RDoc::Context
|
|
136
136
|
normalize_comment comment
|
137
137
|
end
|
138
138
|
|
139
|
-
|
139
|
+
if location.parser == RDoc::Parser::C
|
140
|
+
@comment_location.delete_if { |(_, l)| l == location }
|
141
|
+
end
|
140
142
|
|
141
143
|
@comment_location << [comment, location]
|
142
144
|
|
@@ -208,7 +210,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
208
210
|
normalize_comment comment
|
209
211
|
end
|
210
212
|
|
211
|
-
comment = "#{@comment}\n---\n#{comment}" unless @comment.empty?
|
213
|
+
comment = "#{@comment.to_s}\n---\n#{comment.to_s}" unless @comment.empty?
|
212
214
|
|
213
215
|
super comment
|
214
216
|
end
|
data/lib/rdoc/code_object.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
##
|
3
3
|
# Base class for the RDoc code tree.
|
4
4
|
#
|
@@ -69,13 +69,6 @@ class RDoc::CodeObject
|
|
69
69
|
|
70
70
|
attr_reader :metadata
|
71
71
|
|
72
|
-
##
|
73
|
-
# Offset in #file where this CodeObject was defined
|
74
|
-
#--
|
75
|
-
# TODO character or byte?
|
76
|
-
|
77
|
-
attr_accessor :offset
|
78
|
-
|
79
72
|
##
|
80
73
|
# Sets the parent CodeObject
|
81
74
|
|
@@ -151,7 +144,7 @@ class RDoc::CodeObject
|
|
151
144
|
# HACK correct fix is to have #initialize create @comment
|
152
145
|
# with the correct encoding
|
153
146
|
if String === @comment and @comment.empty? then
|
154
|
-
@comment.
|
147
|
+
@comment = RDoc::Encoding.change_encoding @comment, comment.encoding
|
155
148
|
end
|
156
149
|
@comment
|
157
150
|
end
|
data/lib/rdoc/code_objects.rb
CHANGED
data/lib/rdoc/comment.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
##
|
3
3
|
# A comment holds the text comment for a RDoc::CodeObject and provides a
|
4
4
|
# unified way of cleaning it up and parsing it into an RDoc::Markup::Document.
|
@@ -23,6 +23,11 @@ class RDoc::Comment
|
|
23
23
|
|
24
24
|
attr_accessor :location
|
25
25
|
|
26
|
+
##
|
27
|
+
# Line where this Comment was written
|
28
|
+
|
29
|
+
attr_accessor :line
|
30
|
+
|
26
31
|
##
|
27
32
|
# For duck-typing when merging classes at load time
|
28
33
|
|
@@ -33,6 +38,11 @@ class RDoc::Comment
|
|
33
38
|
|
34
39
|
attr_reader :text
|
35
40
|
|
41
|
+
##
|
42
|
+
# Alias for text
|
43
|
+
|
44
|
+
alias to_s text
|
45
|
+
|
36
46
|
##
|
37
47
|
# Overrides the content returned by #parse. Use when there is no #text
|
38
48
|
# source for this comment
|
@@ -43,9 +53,10 @@ class RDoc::Comment
|
|
43
53
|
# Creates a new comment with +text+ that is found in the RDoc::TopLevel
|
44
54
|
# +location+.
|
45
55
|
|
46
|
-
def initialize text = nil, location = nil
|
56
|
+
def initialize text = nil, location = nil, language = nil
|
47
57
|
@location = location
|
48
|
-
@text = text
|
58
|
+
@text = text.nil? ? nil : text.dup
|
59
|
+
@language = language
|
49
60
|
|
50
61
|
@document = nil
|
51
62
|
@format = 'rdoc'
|
@@ -114,10 +125,14 @@ class RDoc::Comment
|
|
114
125
|
|
115
126
|
method.call_seq = seq.chomp
|
116
127
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
128
|
+
else
|
129
|
+
regexp = /^\s*:?call-seq:(.*?)(^\s*$|\z)/m
|
130
|
+
if regexp =~ @text then
|
131
|
+
@text = @text.sub(regexp, '')
|
132
|
+
seq = $1
|
133
|
+
seq.gsub!(/^\s*/, '')
|
134
|
+
method.call_seq = seq
|
135
|
+
end
|
121
136
|
end
|
122
137
|
|
123
138
|
method
|
@@ -133,8 +148,14 @@ class RDoc::Comment
|
|
133
148
|
##
|
134
149
|
# HACK dubious
|
135
150
|
|
136
|
-
def
|
137
|
-
|
151
|
+
def encode! encoding
|
152
|
+
# TODO: Remove this condition after Ruby 2.2 EOL
|
153
|
+
if RUBY_VERSION < '2.3.0'
|
154
|
+
@text = @text.force_encoding encoding
|
155
|
+
else
|
156
|
+
@text = String.new @text, encoding: encoding
|
157
|
+
end
|
158
|
+
self
|
138
159
|
end
|
139
160
|
|
140
161
|
##
|
@@ -200,7 +221,7 @@ class RDoc::Comment
|
|
200
221
|
def remove_private
|
201
222
|
# Workaround for gsub encoding for Ruby 1.9.2 and earlier
|
202
223
|
empty = ''
|
203
|
-
empty.
|
224
|
+
empty = RDoc::Encoding.change_encoding empty, @text.encoding
|
204
225
|
|
205
226
|
@text = @text.gsub(%r%^\s*([#*]?)--.*?^\s*(\1)\+\+\n?%m, empty)
|
206
227
|
@text = @text.sub(%r%^\s*[#*]?--.*%m, '')
|
@@ -216,7 +237,7 @@ class RDoc::Comment
|
|
216
237
|
@text.nil? and @document
|
217
238
|
|
218
239
|
@document = nil
|
219
|
-
@text = text
|
240
|
+
@text = text.nil? ? nil : text.dup
|
220
241
|
end
|
221
242
|
|
222
243
|
##
|