class RDoc::Markup::ToHtml

def handle_RDOCLINK(url) # :nodoc:

:nodoc:
def handle_RDOCLINK(url) # :nodoc:
  case url
  when /^rdoc-ref:/
    CGI.escapeHTML($')
  when /^rdoc-label:/
    text = $'
    text = case text
           when /\Alabel-/    then $'
           when /\Afootmark-/ then $'
           when /\Afoottext-/ then $'
           else                    text
           end
    gen_url CGI.escapeHTML(url), CGI.escapeHTML(text)
  when /^rdoc-image:/
    # Split the string after "rdoc-image:" into url and alt.
    #   "path/to/image.jpg:alt text" => ["path/to/image.jpg", "alt text"]
    #   "http://example.com/path/to/image.jpg:alt text" => ["http://example.com/path/to/image.jpg", "alt text"]
    url, alt = $'.split(/:(?!\/)/, 2)
    if alt && !alt.empty?
      %[<img src="#{CGI.escapeHTML(url)}" alt="#{CGI.escapeHTML(alt)}">]
    else
      %[<img src="#{CGI.escapeHTML(url)}">]
    end
  when /\Ardoc-[a-z]+:/
    CGI.escapeHTML($')
  end
end