Method: RDoc::Markup::ToHtmlCrossref#handle_regexp_CROSSREF

Defined in:
lib/rdoc/markup/to_html_crossref.rb

#handle_regexp_CROSSREF(target) ⇒ Object

We’re invoked when any text matches the CROSSREF pattern. If we find the corresponding reference, generate a link. If the name we’re looking for contains no punctuation, we look for it up the module/class chain. For example, ToHtml is found, even without the RDoc::Markup:: prefix, because we look for it in module Markup first.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/rdoc/markup/to_html_crossref.rb', line 74

def handle_regexp_CROSSREF(target)
  name = target.text

  return name if name =~ /@[\w-]+\.[\w-]/ # labels that look like emails

  unless @hyperlink_all then
    # This ensures that words entirely consisting of lowercase letters will
    # not have cross-references generated (to suppress lots of erroneous
    # cross-references to "new" in text, for instance)
    return name if name =~ /\A[a-z]*\z/
  end

  cross_reference name
end