rdoc 6.17.0 → 7.2.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.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +196 -0
  3. data/LEGAL.rdoc +6 -0
  4. data/README.md +90 -7
  5. data/doc/markup_reference/markdown.md +558 -0
  6. data/doc/markup_reference/rdoc.rdoc +1169 -0
  7. data/lib/rdoc/code_object/any_method.rb +15 -7
  8. data/lib/rdoc/code_object/attr.rb +2 -1
  9. data/lib/rdoc/code_object/class_module.rb +62 -11
  10. data/lib/rdoc/code_object/constant.rb +9 -0
  11. data/lib/rdoc/code_object/context/section.rb +46 -9
  12. data/lib/rdoc/code_object/context.rb +15 -4
  13. data/lib/rdoc/code_object/method_attr.rb +13 -1
  14. data/lib/rdoc/code_object/mixin.rb +3 -0
  15. data/lib/rdoc/code_object/top_level.rb +15 -1
  16. data/lib/rdoc/comment.rb +1 -1
  17. data/lib/rdoc/cross_reference.rb +31 -24
  18. data/lib/rdoc/generator/aliki.rb +141 -0
  19. data/lib/rdoc/generator/darkfish.rb +3 -1
  20. data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
  21. data/lib/rdoc/generator/template/aliki/_head.rhtml +9 -4
  22. data/lib/rdoc/generator/template/aliki/_header.rhtml +4 -4
  23. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +1 -1
  24. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +3 -3
  25. data/lib/rdoc/generator/template/aliki/class.rhtml +17 -17
  26. data/lib/rdoc/generator/template/aliki/css/rdoc.css +278 -60
  27. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  28. data/lib/rdoc/generator/template/aliki/js/aliki.js +51 -23
  29. data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  30. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +1 -1
  31. data/lib/rdoc/generator/template/aliki/js/{search.js → search_controller.js} +16 -7
  32. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  33. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  34. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  35. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  36. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +1 -1
  37. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +1 -1
  38. data/lib/rdoc/generator/template/darkfish/class.rhtml +11 -11
  39. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +19 -0
  40. data/lib/rdoc/markdown.kpeg +22 -12
  41. data/lib/rdoc/markdown.rb +36 -26
  42. data/lib/rdoc/markup/blank_line.rb +25 -23
  43. data/lib/rdoc/markup/element.rb +21 -0
  44. data/lib/rdoc/markup/formatter.rb +129 -106
  45. data/lib/rdoc/markup/hard_break.rb +30 -27
  46. data/lib/rdoc/markup/heading.rb +166 -77
  47. data/lib/rdoc/markup/inline_parser.rb +312 -0
  48. data/lib/rdoc/markup/parser.rb +1 -1
  49. data/lib/rdoc/markup/raw.rb +52 -55
  50. data/lib/rdoc/markup/table.rb +48 -40
  51. data/lib/rdoc/markup/to_ansi.rb +51 -4
  52. data/lib/rdoc/markup/to_bs.rb +22 -42
  53. data/lib/rdoc/markup/to_html.rb +178 -183
  54. data/lib/rdoc/markup/to_html_crossref.rb +58 -79
  55. data/lib/rdoc/markup/to_html_snippet.rb +62 -62
  56. data/lib/rdoc/markup/to_label.rb +29 -20
  57. data/lib/rdoc/markup/to_markdown.rb +61 -37
  58. data/lib/rdoc/markup/to_rdoc.rb +86 -26
  59. data/lib/rdoc/markup/to_test.rb +9 -1
  60. data/lib/rdoc/markup/to_tt_only.rb +10 -16
  61. data/lib/rdoc/markup/verbatim.rb +1 -1
  62. data/lib/rdoc/markup.rb +11 -32
  63. data/lib/rdoc/options.rb +1 -1
  64. data/lib/rdoc/parser/changelog.rb +29 -0
  65. data/lib/rdoc/parser/prism_ruby.rb +44 -32
  66. data/lib/rdoc/parser/ruby.rb +1 -1
  67. data/lib/rdoc/rubygems_hook.rb +3 -3
  68. data/lib/rdoc/text.rb +44 -5
  69. data/lib/rdoc/token_stream.rb +4 -8
  70. data/lib/rdoc/version.rb +1 -1
  71. data/rdoc.gemspec +3 -3
  72. metadata +13 -15
  73. data/CONTRIBUTING.rdoc +0 -219
  74. data/ExampleMarkdown.md +0 -39
  75. data/ExampleRDoc.rdoc +0 -210
  76. data/lib/rdoc/markup/attr_changer.rb +0 -22
  77. data/lib/rdoc/markup/attr_span.rb +0 -35
  78. data/lib/rdoc/markup/attribute_manager.rb +0 -405
  79. data/lib/rdoc/markup/attributes.rb +0 -70
  80. data/lib/rdoc/markup/regexp_handling.rb +0 -40
@@ -351,7 +351,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
351
351
  return call_seq unless is_alias_for || !aliases.empty?
352
352
 
353
353
  method_name = self.name
354
- method_name = method_name[0, 1] if method_name =~ /\A\[/
355
354
 
356
355
  entries = call_seq.split "\n"
357
356
 
@@ -360,15 +359,24 @@ class RDoc::AnyMethod < RDoc::MethodAttr
360
359
  ignore << is_alias_for.name
361
360
  ignore.concat is_alias_for.aliases.map(&:name)
362
361
  end
363
- ignore.map! { |n| n =~ /\A\[/ ? /\[.*\]/ : n}
362
+
364
363
  ignore.delete(method_name)
365
- ignore = Regexp.union(ignore)
364
+ ignore_bracket_methods, ignore_other_methods = ignore.partition {|i| i.start_with?('[') }
366
365
 
367
- matching = entries.reject do |entry|
368
- entry =~ /^\w*\.?#{ignore}[$\(\s]/ or
369
- entry =~ /\s#{ignore}\s/
366
+ if ignore_other_methods.any?
367
+ ignore_union = Regexp.union(ignore_other_methods)
368
+ entries.reject! do |entry|
369
+ /\A(?:\w*\.)?#{ignore_union}(?:[(\s]|\z)/.match?(entry) ||
370
+ /\s#{ignore_union}\s/.match?(entry)
371
+ end
372
+ end
373
+ if ignore_bracket_methods.any?
374
+ entries.reject! do |entry|
375
+ # Ignore `receiver[arg] -> return_type` `[](arg)` `[]`
376
+ /\A\w*\[.*?\](?:[(\s]|\z)/.match?(entry)
377
+ end
370
378
  end
371
379
 
372
- matching.empty? ? nil : matching.join("\n")
380
+ entries.empty? ? nil : entries.join("\n")
373
381
  end
374
382
  end
@@ -43,7 +43,8 @@ class RDoc::Attr < RDoc::MethodAttr
43
43
  # Add +an_alias+ as an attribute in +context+.
44
44
 
45
45
  def add_alias(an_alias, context)
46
- new_attr = self.class.new(text, an_alias.new_name, rw, comment, singleton: singleton)
46
+ access_type = an_alias.new_name.end_with?('=') ? 'W' : 'R'
47
+ new_attr = self.class.new(text, an_alias.new_name, access_type, comment, singleton: singleton)
47
48
  new_attr.record_location an_alias.file
48
49
  new_attr.visibility = self.visibility
49
50
  new_attr.is_alias_for = self
@@ -30,7 +30,22 @@ class RDoc::ClassModule < RDoc::Context
30
30
  attr_accessor :constant_aliases
31
31
 
32
32
  ##
33
- # Comment and the location it came from. Use #add_comment to add comments
33
+ # An array of `[comment, location]` pairs documenting this class/module.
34
+ # Use #add_comment to add comments.
35
+ #
36
+ # Before marshalling:
37
+ # - +comment+ is a String
38
+ # - +location+ is an RDoc::TopLevel
39
+ #
40
+ # After unmarshalling:
41
+ # - +comment+ is an RDoc::Markup::Document
42
+ # - +location+ is a filename String
43
+ #
44
+ # These type changes are acceptable (for now) because:
45
+ # - +comment+: Both String and Document respond to #empty?, and #parse
46
+ # returns Document as-is (see RDoc::Text#parse)
47
+ # - +location+: Only used by #parse to set Document#file, which accepts
48
+ # both TopLevel (extracts relative_name) and String
34
49
 
35
50
  attr_accessor :comment_location
36
51
 
@@ -110,7 +125,7 @@ class RDoc::ClassModule < RDoc::Context
110
125
  @is_alias_for = nil
111
126
  @name = name
112
127
  @superclass = superclass
113
- @comment_location = [] # [[comment, location]]
128
+ @comment_location = [] # Array of [comment, location] pairs
114
129
 
115
130
  super()
116
131
  end
@@ -173,10 +188,26 @@ class RDoc::ClassModule < RDoc::Context
173
188
  end
174
189
 
175
190
  ##
176
- # HTML fragment reference for this module or class. See
177
- # RDoc::NormalClass#aref and RDoc::NormalModule#aref
191
+ # HTML fragment reference for this module or class using GitHub-style
192
+ # anchor format (lowercase, :: replaced with -).
193
+ #
194
+ # Examples:
195
+ # Foo -> class-foo
196
+ # Foo::Bar -> class-foo-bar
178
197
 
179
198
  def aref
199
+ "#{aref_prefix}-#{full_name.downcase.gsub('::', '-')}"
200
+ end
201
+
202
+ ##
203
+ # Legacy HTML fragment reference for backward compatibility.
204
+ # Returns the old RDoc-style anchor format.
205
+ #
206
+ # Examples:
207
+ # Foo -> class-Foo
208
+ # Foo::Bar -> class-Foo::Bar
209
+
210
+ def legacy_aref
180
211
  "#{aref_prefix}-#{full_name}"
181
212
  end
182
213
 
@@ -379,10 +410,10 @@ class RDoc::ClassModule < RDoc::Context
379
410
 
380
411
  @comment = RDoc::Comment.from_document document
381
412
 
382
- @comment_location = if RDoc::Markup::Document === document.parts.first then
383
- document
413
+ @comment_location = if document.parts.first.is_a?(RDoc::Markup::Document)
414
+ document.parts.map { |doc| [doc, doc.file] }
384
415
  else
385
- RDoc::Markup::Document.new document
416
+ [[document, document.file]]
386
417
  end
387
418
 
388
419
  array[5].each do |name, rw, visibility, singleton, file|
@@ -462,7 +493,12 @@ class RDoc::ClassModule < RDoc::Context
462
493
  document = document.merge other_document
463
494
 
464
495
  @comment = RDoc::Comment.from_document(document)
465
- @comment_location = document
496
+
497
+ @comment_location = if document.parts.first.is_a?(RDoc::Markup::Document)
498
+ document.parts.map { |doc| [doc, doc.file] }
499
+ else
500
+ [[document, document.file]]
501
+ end
466
502
  end
467
503
 
468
504
  cm = class_module
@@ -689,6 +725,9 @@ class RDoc::ClassModule < RDoc::Context
689
725
 
690
726
  ##
691
727
  # Search record used by RDoc::Generator::JsonIndex
728
+ #
729
+ # TODO: Remove this method after dropping the darkfish theme and JsonIndex generator.
730
+ # Use #search_snippet instead for getting documentation snippets.
692
731
 
693
732
  def search_record
694
733
  [
@@ -702,6 +741,16 @@ class RDoc::ClassModule < RDoc::Context
702
741
  ]
703
742
  end
704
743
 
744
+ ##
745
+ # Returns an HTML snippet of the first comment for search results.
746
+
747
+ def search_snippet
748
+ first_comment = @comment_location.first&.first
749
+ return '' unless first_comment && !first_comment.empty?
750
+
751
+ snippet(first_comment)
752
+ end
753
+
705
754
  ##
706
755
  # Sets the store for this class or module and its contained code objects.
707
756
 
@@ -794,11 +843,13 @@ class RDoc::ClassModule < RDoc::Context
794
843
  cm_alias = cm.dup
795
844
  cm_alias.name = const.name
796
845
 
797
- # Don't move top-level aliases under Object, they look ugly there
798
- unless RDoc::TopLevel === cm_alias.parent then
846
+ if full_name == 'Object'
847
+ # Don't move top-level aliases under Object, they look ugly there
848
+ cm_alias.parent = top_level
849
+ else
799
850
  cm_alias.parent = self
800
- cm_alias.full_name = nil # force update for new parent
801
851
  end
852
+ cm_alias.full_name = nil # force update for new parent
802
853
 
803
854
  cm_alias.aliases.clear
804
855
  cm_alias.is_alias_for = cm
@@ -154,6 +154,15 @@ class RDoc::Constant < RDoc::CodeObject
154
154
  "#{@parent.path}##{@name}"
155
155
  end
156
156
 
157
+ ##
158
+ # Returns an HTML snippet of the comment for search results.
159
+
160
+ def search_snippet
161
+ return '' if comment.empty?
162
+
163
+ snippet(comment)
164
+ end
165
+
157
166
  def pretty_print(q) # :nodoc:
158
167
  q.group 2, "[#{self.class.name} #{full_name}", "]" do
159
168
  unless comment.empty? then
@@ -17,11 +17,6 @@ class RDoc::Context::Section
17
17
 
18
18
  MARSHAL_VERSION = 0 # :nodoc:
19
19
 
20
- ##
21
- # Section comment
22
-
23
- attr_reader :comment
24
-
25
20
  ##
26
21
  # Section comments
27
22
 
@@ -37,12 +32,18 @@ class RDoc::Context::Section
37
32
 
38
33
  attr_reader :title
39
34
 
35
+ ##
36
+ # The RDoc::Store for this object.
37
+
38
+ attr_reader :store
39
+
40
40
  ##
41
41
  # Creates a new section with +title+ and +comment+
42
42
 
43
- def initialize(parent, title, comment)
43
+ def initialize(parent, title, comment, store = nil)
44
44
  @parent = parent
45
45
  @title = title ? title.strip : title
46
+ @store = store
46
47
 
47
48
  @comments = []
48
49
 
@@ -70,11 +71,30 @@ class RDoc::Context::Section
70
71
  end
71
72
 
72
73
  ##
73
- # Anchor reference for linking to this section
74
+ # Anchor reference for linking to this section using GitHub-style format.
75
+ #
76
+ # Examples:
77
+ # "Section" -> "section"
78
+ # "One Two" -> "one-two"
79
+ # "[untitled]" -> "untitled"
74
80
 
75
81
  def aref
76
82
  title = @title || '[untitled]'
77
83
 
84
+ RDoc::Text.to_anchor(title)
85
+ end
86
+
87
+ ##
88
+ # Legacy anchor reference for backward compatibility.
89
+ #
90
+ # Examples:
91
+ # "Section" -> "section"
92
+ # "One Two" -> "one+two"
93
+ # "[untitled]" -> "5Buntitled-5D"
94
+
95
+ def legacy_aref
96
+ title = @title || '[untitled]'
97
+
78
98
  CGI.escape(title).gsub('%', '-').sub(/^-/, '')
79
99
  end
80
100
 
@@ -132,7 +152,7 @@ class RDoc::Context::Section
132
152
  [
133
153
  MARSHAL_VERSION,
134
154
  @title,
135
- parse,
155
+ to_document,
136
156
  ]
137
157
  end
138
158
 
@@ -150,7 +170,7 @@ class RDoc::Context::Section
150
170
  # Parses +comment_location+ into an RDoc::Markup::Document composed of
151
171
  # multiple RDoc::Markup::Documents with their file set.
152
172
 
153
- def parse
173
+ def to_document
154
174
  RDoc::Markup::Document.new(*@comments.map(&:parse))
155
175
  end
156
176
 
@@ -163,6 +183,23 @@ class RDoc::Context::Section
163
183
  @title || 'Top Section'
164
184
  end
165
185
 
186
+ ##
187
+ # Section comment
188
+
189
+ def comment
190
+ return nil if @comments.empty?
191
+ RDoc::Comment.from_document(to_document)
192
+ end
193
+
194
+ def description
195
+ return '' if @comments.empty?
196
+ markup comment
197
+ end
198
+
199
+ def language
200
+ @comments.first&.language
201
+ end
202
+
166
203
  ##
167
204
  # Removes a comment from this section if it is from the same file as
168
205
  # +comment+
@@ -587,7 +587,7 @@ class RDoc::Context < RDoc::CodeObject
587
587
  if section = @sections[title] then
588
588
  section.add_comment comment if comment
589
589
  else
590
- section = Section.new self, title, comment
590
+ section = Section.new self, title, comment, @store
591
591
  @sections[title] = section
592
592
  end
593
593
 
@@ -785,7 +785,10 @@ class RDoc::Context < RDoc::CodeObject
785
785
  end
786
786
 
787
787
  ##
788
- # Find a module at a higher scope
788
+ # Tries to find a module at a higher scope.
789
+ # But parent is not always a higher module nesting scope, so the result is not correct.
790
+ # Parent chain can only represent last-opened nesting, and may be broken in some cases.
791
+ # PrismRuby parser stopped representing module nesting with parent chain at all.
789
792
 
790
793
  def find_enclosing_module_named(name)
791
794
  parent && parent.find_module_named(name)
@@ -860,15 +863,23 @@ class RDoc::Context < RDoc::CodeObject
860
863
  end
861
864
 
862
865
  ##
863
- # Find a module with +name+ using ruby's scoping rules
866
+ # Find a module with +name+ trying to using ruby's scoping rules.
867
+ # find_enclosing_module_named cannot use ruby's scoping so the result is not correct.
864
868
 
865
869
  def find_module_named(name)
866
- res = @modules[name] || @classes[name]
870
+ res = get_module_named(name)
867
871
  return res if res
868
872
  return self if self.name == name
869
873
  find_enclosing_module_named name
870
874
  end
871
875
 
876
+ # Get a module named +name+ in this context
877
+ # Don't look up for higher module nesting scopes. RDoc::Context doesn't have that information.
878
+
879
+ def get_module_named(name)
880
+ @modules[name] || @classes[name]
881
+ end
882
+
872
883
  ##
873
884
  # Look up +symbol+, first as a module, then as a local symbol.
874
885
 
@@ -375,6 +375,9 @@ class RDoc::MethodAttr < RDoc::CodeObject
375
375
  ##
376
376
  # Used by RDoc::Generator::JsonIndex to create a record for the search
377
377
  # engine.
378
+ #
379
+ # TODO: Remove this method after dropping the darkfish theme and JsonIndex generator.
380
+ # Use #search_snippet instead for getting documentation snippets.
378
381
 
379
382
  def search_record
380
383
  [
@@ -384,10 +387,19 @@ class RDoc::MethodAttr < RDoc::CodeObject
384
387
  @parent.full_name,
385
388
  path,
386
389
  params,
387
- snippet(@comment),
390
+ search_snippet,
388
391
  ]
389
392
  end
390
393
 
394
+ ##
395
+ # Returns an HTML snippet of the comment for search results.
396
+
397
+ def search_snippet
398
+ return '' if @comment.empty?
399
+
400
+ snippet(@comment)
401
+ end
402
+
391
403
  def to_s # :nodoc:
392
404
  if @is_alias_for
393
405
  "#{self.class.name}: #{full_name} -> #{is_alias_for}"
@@ -71,6 +71,9 @@ class RDoc::Mixin < RDoc::CodeObject
71
71
  # lookup behavior.
72
72
  #
73
73
  # As of the beginning of October, 2011, no gem includes nonexistent modules.
74
+ #
75
+ # When mixin is created from RDoc::Parser::PrismRuby, module name is already a resolved full-path name.
76
+ #
74
77
 
75
78
  def module
76
79
  return @module if @module
@@ -149,6 +149,8 @@ class RDoc::TopLevel < RDoc::Context
149
149
  find_class_or_module(name)
150
150
  end
151
151
 
152
+ alias get_module_named find_module_named
153
+
152
154
  ##
153
155
  # Returns the relative name of this file
154
156
 
@@ -237,6 +239,9 @@ class RDoc::TopLevel < RDoc::Context
237
239
 
238
240
  ##
239
241
  # Search record used by RDoc::Generator::JsonIndex
242
+ #
243
+ # TODO: Remove this method after dropping the darkfish theme and JsonIndex generator.
244
+ # Use #search_snippet instead for getting documentation snippets.
240
245
 
241
246
  def search_record
242
247
  return unless @parser < RDoc::Parser::Text
@@ -248,10 +253,19 @@ class RDoc::TopLevel < RDoc::Context
248
253
  '',
249
254
  path,
250
255
  '',
251
- snippet(@comment),
256
+ search_snippet,
252
257
  ]
253
258
  end
254
259
 
260
+ ##
261
+ # Returns an HTML snippet of the comment for search results.
262
+
263
+ def search_snippet
264
+ return '' if @comment.empty?
265
+
266
+ snippet(@comment)
267
+ end
268
+
255
269
  ##
256
270
  # Is this TopLevel from a text file instead of a source code file?
257
271
 
data/lib/rdoc/comment.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # Each comment may have a different markup format set by #format=. By default
7
7
  # 'rdoc' is used. The :markup: directive tells RDoc which format to use.
8
8
  #
9
- # See RDoc::MarkupReference@Directive+for+Specifying+RDoc+Source+Format.
9
+ # See {RDoc Markup Reference}[rdoc-ref:doc/markup_reference/rdoc.rdoc@Directive+for+Specifying+RDoc+Source+Format].
10
10
 
11
11
 
12
12
  class RDoc::Comment
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'markup/attribute_manager' # for PROTECT_ATTR
4
-
5
3
  ##
6
4
  # RDoc::CrossReference is a reusable way to create cross references for names.
7
5
 
@@ -33,7 +31,7 @@ class RDoc::CrossReference
33
31
  # See CLASS_REGEXP_STR
34
32
 
35
33
  METHOD_REGEXP_STR = /(
36
- (?!\d)[\w#{RDoc::Markup::AttributeManager::PROTECT_ATTR}]+[!?=]?|
34
+ (?!\d)[\w]+[!?=]?|
37
35
  %|=(?:==?|~)|![=~]|\[\]=?|<(?:<|=>?)?|>[>=]?|[-+!]@?|\*\*?|[\/%\`|&^~]
38
36
  )#{METHOD_ARGS_REGEXP_STR}/.source.delete("\n ").freeze
39
37
 
@@ -132,47 +130,56 @@ class RDoc::CrossReference
132
130
  end
133
131
 
134
132
  ##
135
- # Returns a method reference to +name+.
133
+ # Returns a method, attribute or constant reference to +name+
134
+ # if it exists in the containing context object. It returns
135
+ # nil otherwise.
136
+ #
137
+ # For example, this method would decompose name = 'A::CONSTANT' into a
138
+ # container object A and a symbol 'CONSTANT', and it would try to find
139
+ # 'CONSTANT' in A.
136
140
 
137
- def resolve_method(name)
141
+ def resolve_local_symbol(name)
138
142
  ref = nil
143
+ type = nil
144
+ container = nil
139
145
 
140
- if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
146
+ case name
147
+ when /#{CLASS_REGEXP_STR}::([A-Z]\w*)\z/o then
148
+ symbol = $2
149
+ container = @context.find_symbol_module($1)
150
+ when /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o then
141
151
  type = $2
142
152
  if '.' == type # will find either #method or ::method
143
- method = $3
153
+ symbol = $3
144
154
  else
145
- method = "#{type}#{$3}"
155
+ symbol = "#{type}#{$3}"
146
156
  end
147
157
  container = @context.find_symbol_module($1)
148
- elsif /^([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
158
+ when /^([.#]|::)#{METHOD_REGEXP_STR}/o then
149
159
  type = $1
150
160
  if '.' == type
151
- method = $2
161
+ symbol = $2
152
162
  else
153
- method = "#{type}#{$2}"
163
+ symbol = "#{type}#{$2}"
154
164
  end
155
165
  container = @context
156
- else
157
- type = nil
158
- container = nil
159
166
  end
160
167
 
161
168
  if container then
162
169
  unless RDoc::TopLevel === container then
163
170
  if '.' == type then
164
- if 'new' == method then # AnyClassName.new will be class method
165
- ref = container.find_local_symbol method
166
- ref = container.find_ancestor_local_symbol method unless ref
171
+ if 'new' == symbol then # AnyClassName.new will be class method
172
+ ref = container.find_local_symbol symbol
173
+ ref = container.find_ancestor_local_symbol symbol unless ref
167
174
  else
168
- ref = container.find_local_symbol "::#{method}"
169
- ref = container.find_ancestor_local_symbol "::#{method}" unless ref
170
- ref = container.find_local_symbol "##{method}" unless ref
171
- ref = container.find_ancestor_local_symbol "##{method}" unless ref
175
+ ref = container.find_local_symbol "::#{symbol}"
176
+ ref = container.find_ancestor_local_symbol "::#{symbol}" unless ref
177
+ ref = container.find_local_symbol "##{symbol}" unless ref
178
+ ref = container.find_ancestor_local_symbol "##{symbol}" unless ref
172
179
  end
173
180
  else
174
- ref = container.find_local_symbol method
175
- ref = container.find_ancestor_local_symbol method unless ref
181
+ ref = container.find_local_symbol symbol
182
+ ref = container.find_ancestor_local_symbol symbol unless ref
176
183
  end
177
184
  end
178
185
  end
@@ -197,7 +204,7 @@ class RDoc::CrossReference
197
204
  @context.find_symbol name
198
205
  end
199
206
 
200
- ref = resolve_method name unless ref
207
+ ref = resolve_local_symbol name unless ref
201
208
 
202
209
  # Try a page name
203
210
  ref = @store.page name if not ref and name =~ /^[\w.\/]+$/