From 84d34ed4f985d86bc452c696ae1a6a00dd5830ed Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 6 Feb 2004 13:49:54 +0000 Subject: Support https in hyperlinks git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/generators/html_generator.rb | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'lib/rdoc/generators') diff --git a/lib/rdoc/generators/html_generator.rb b/lib/rdoc/generators/html_generator.rb index 994d74b103..56ac2b7499 100644 --- a/lib/rdoc/generators/html_generator.rb +++ b/lib/rdoc/generators/html_generator.rb @@ -125,15 +125,10 @@ module Generators 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 + # 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 @@ -156,10 +151,22 @@ module Generators "" else - "#{url.sub(%r{^\w+:/*}, '')}" + "#{text.sub(%r{^\w+:/*}, '')}" 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 # #{label}" + gen_url(url, label) end end @@ -209,7 +211,7 @@ module Generators :CROSSREF) # external hyperlinks - @markup.add_special(/((link:|http:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK) + @markup.add_special(/((link:|https?:|mailto:|ftp:|www\.)\S+\w)/, :HYPERLINK) # and links of the form [] @markup.add_special(/\b(\S+?\[\S+?\.\S+?\])/, :TIDYLINK) -- cgit v1.2.3