class RDoc::Markup::ToHtml

def gen_url(url, text)

def gen_url(url, text)
  scheme, url, id = parse_url url
  if %w[http https link].include?(scheme) and
     url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then
    "<img src=\"#{url}\" />"
  else
    if scheme != 'link' and %r%\A((?!https?:)(?:[^/#]*/)*+)([^/#]+)\.(rb|rdoc|md)(?=\z|#)%i =~ url
      url = "#$1#{$2.tr('.', '_')}_#$3.html#$'"
    end
    text = text.sub %r%^#{scheme}:/*%i, ''
    text = text.sub %r%^[*\^](\d+)$%,   '\1'
    link = "<a#{id} href=\"#{url}\">#{text}</a>"
    link = "<sup>#{link}</sup>" if /"foot/ =~ id
    link
  end
end