summaryrefslogtreecommitdiffstats
path: root/lib/rdoc
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-29 13:44:04 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-29 13:44:04 +0000
commitc386d519a1a381ba1c7628f4e659142eebb5fd48 (patch)
treef1d74a2fa0bb31ba0541efa36731cca9f9b630b7 /lib/rdoc
parent9f923528d14102b2f94f9c988dfaf6d61fd4b7f3 (diff)
downloadruby-c386d519a1a381ba1c7628f4e659142eebb5fd48.tar.gz
ruby-c386d519a1a381ba1c7628f4e659142eebb5fd48.tar.xz
ruby-c386d519a1a381ba1c7628f4e659142eebb5fd48.zip
Allow link: in Tidylinks
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/generators/html_generator.rb32
1 files changed, 17 insertions, 15 deletions
diff --git a/lib/rdoc/generators/html_generator.rb b/lib/rdoc/generators/html_generator.rb
index 994d74b10..0016ee026 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
- # <img> tag. Otherwise a conventional <a href> 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
"<img src=\"#{url}\">"
else
- "<a href=\"#{url}\">#{url.sub(%r{^\w+:/*}, '')}</a>"
+ "<a href=\"#{url}\">#{text.sub(%r{^\w+:/*}, '')}</a>"
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
+ # <img> tag. Otherwise a conventional <a href> 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>[url]
#
@@ -171,12 +178,7 @@ module Generators
end
label = $1
url = $2
-
- unless url =~ /\w+?:/
- url = "http://#{url}"
- end
-
- "<a href=\"#{url}\">#{label}</a>"
+ gen_url(url, label)
end
end