class RDoc::Markup::ToHtmlCrossref

def link name, text

def link name, text
  original_name = name
  if name =~ /(.*[^#:])@/ then
    name = $1
    label = $'
  end
  ref = @cross_reference.resolve name, text
  text = ref.output_name @context if
    RDoc::MethodAttr === ref and text == original_name
  case ref
  when String then
    ref
  else
    path = ref.as_href @from_path
    if path =~ /#/ then
      path << "-label-#{label}"
    elsif ref.sections and
          ref.sections.any? { |section| label == section.title } then
      path << "##{label}"
    else
      path << "#label-#{label}"
    end if label
    "<a href=\"#{path}\">#{text}</a>"
  end
end