We’re invoked when any text matches the CROSSREF pattern (defined in
MarkUp). If we fine the corresponding
reference, generate a hyperlink. If the name we’re looking for
contains no punctuation, we look for it up the module/class chain. For
example, HyperlinkHtml is found, even without the Generators:: prefix, because we look for it in
module Generators first.
# File lib/rdoc/generators/html_generator.rb, line 108
def handle_special_CROSSREF(special)
name = special.text
if name[0,1] == '#'
lookup = name[1..-1]
name = lookup unless Options.instance.show_hash
else
lookup = name
end
# Find class, module, or method in class or module.
if /([A-Z]\w*)[.\#](\w+[!?=]?)/ =~ lookup
container = $1
method = $2
ref = @context.find_symbol(container, method)
elsif /([A-Za-z]\w*)[.\#](\w+(\([\.\w+\*\/\+\-\=\<\>]+\))?)/ =~ lookup
container = $1
method = $2
ref = @context.find_symbol(container, method)
else
ref = @context.find_symbol(lookup)
end
if ref and ref.document_self
"<a href=\"#{ref.as_href(@from_path)}\">#{name}</a>"
else
name
end
end