require 'rdoc' class RDocWithHyperlinkToHtml < RDoc::Markup::ToHtml # Generate a hyperlink for url, labeled with text. Handle the # special cases for img: and link: described under handle_special_HYPEDLINK # def gen_url(url, text) if url =~ /([A-Za-z]+):(.*)/ type = $1 path = $2 else type = "http" path = url url = "http://#{url}" end if type == "link" if path[0,1] == '#' # is this meaningful? url = path else url = HTMLGenerator.gen_url(@from_path, path) end end if (type == "http" || type == "link") && url =~ /\.(gif|png|jpg|jpeg|bmp)$/ "" else "#{text.sub(%r{^#{type}:/*}, '')}" end end # And we're invoked with a potential external hyperlink mailto: # just gets inserted. http: links are checked to see if they # reference an image. If so, that image gets inserted using an # tag. Otherwise a conventional is used. We also # support a special type of hyperlink, link:, which is a reference # to a local file whose path is relative to the --op directory. # def handle_special_HYPERLINK(special) url = special.text gen_url(url, url) end # Here's a hypedlink where the label is different to the URL #