mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Support https in hyperlinks
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
18aa4b526a
commit
84d34ed4f9
2 changed files with 31 additions and 16 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Fri Feb 6 22:48:16 2004 Dave Thomas <dave@pragprog.com>
|
||||
|
||||
* lib/rdoc/generators/html_generator.rb (gen_url): Support
|
||||
https in RDoc hyperlinks
|
||||
|
||||
<<<<<<< ChangeLog
|
||||
Thu Jan 29 22:41:53 2004 Dave Thomas <dave@pragprog.com>
|
||||
|
||||
* lib/rdoc/generators/html_generator.rb: Allow 'link:' in Tidylinks.
|
||||
THis means you can write "see f1[link:files/f1_rb.html]".
|
||||
|
||||
=======
|
||||
Fri Feb 6 22:41:22 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
|
||||
|
||||
* lib/pp.rb (PPInspectTest#test_to_s_with_iv): rollback the previous
|
||||
|
@ -127,6 +139,7 @@ Thu Jan 29 15:33:23 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
|||
|
||||
* sample/openssl/gen_csr.rb: use OpenSSL::X509::Name.parse.
|
||||
|
||||
>>>>>>> 1.2673.2.103
|
||||
Tue Jan 27 11:09:29 2004 FUKUMOTO Atsushi <fukumoto@nospam.imasy.or.jp>
|
||||
|
||||
* ext/socket/socket.c (s_recvfrom): sending length should be an
|
||||
|
|
|
@ -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
|
||||
|
@ -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 <text>[<url>]
|
||||
@markup.add_special(/\b(\S+?\[\S+?\.\S+?\])/, :TIDYLINK)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue