@@ -116,16 +116,6 @@ def initialize context
116116 def resolve name , text
117117 return @seen [ name ] if @seen . include? name
118118
119- # Find class, module, or method in class or module.
120- #
121- # Do not, however, use an if/elsif/else chain to do so. Instead, test
122- # each possible pattern until one matches. The reason for this is that a
123- # string like "YAML.txt" could be the txt() class method of class YAML (in
124- # which case it would match the first pattern, which splits the string
125- # into container and method components and looks up both) or a filename
126- # (in which case it would match the last pattern, which just checks
127- # whether the string as a whole is a known symbol).
128-
129119 if /#{ CLASS_REGEXP_STR } ([.#]|::)#{ METHOD_REGEXP_STR } /o =~ name then
130120 type = $2
131121 type = '' if type == '.' # will find either #method or ::method
@@ -150,12 +140,15 @@ def resolve name, text
150140
151141 ref = case name
152142 when /^\\ (#{ CLASS_REGEXP_STR } )$/o then
153- ref = @context . find_symbol $1
143+ @context . find_symbol $1
154144 else
155- ref = @context . find_symbol name
145+ @context . find_symbol name
156146 end unless ref
157147
158- ref = nil if RDoc ::Alias === ref # external alias: can't link to it
148+ # Try a page name
149+ ref = RDoc ::TopLevel . page name if not ref and name =~ /^\w +$/
150+
151+ ref = nil if RDoc ::Alias === ref # external alias, can't link to it
159152
160153 out = if name == '\\' then
161154 name
0 commit comments