summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-23 23:53:49 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-23 23:53:49 +0000
commit61920a128a2593f6fb968cfd4928499f0a3e2ed3 (patch)
tree603eb46008483ed97100d616b7f785bd86a14337
parentcede48fd403ddb0631fafc49392350bb889c38ab (diff)
* lib/rdoc: Update to RDoc 3.9.3. Fixes RDoc with `ruby -Ku`. Allows
HTTPS image paths to be turned into <img> tags. Prevents special markup inside <tt> from being processed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/rdoc.rb2
-rw-r--r--lib/rdoc/encoding.rb2
-rw-r--r--lib/rdoc/markup.rb14
-rw-r--r--lib/rdoc/markup/formatter.rb4
-rw-r--r--lib/rdoc/markup/to_html.rb2
-rw-r--r--lib/rdoc/ruby_lex.rb2
-rw-r--r--test/rdoc/test_rdoc_code_object.rb2
-rw-r--r--test/rdoc/test_rdoc_encoding.rb2
-rw-r--r--test/rdoc/test_rdoc_markup_formatter.rb57
-rw-r--r--test/rdoc/test_rdoc_markup_to_html.rb8
11 files changed, 97 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 94e3fccdc1..1e3c49ee84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Aug 24 08:53:06 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Update to RDoc 3.9.3. Fixes RDoc with `ruby -Ku`. Allows
+ HTTPS image paths to be turned into <img> tags. Prevents special
+ markup inside <tt> from being processed.
+
Wed Aug 24 07:57:43 2011 Eric Hodel <drbrain@segment7.net>
* lib/rubygems: Update to RubyGems 1.8.9. Fixes uninstalling multiple
diff --git a/lib/rdoc.rb b/lib/rdoc.rb
index ddae96f53e..effa381dbe 100644
--- a/lib/rdoc.rb
+++ b/lib/rdoc.rb
@@ -104,7 +104,7 @@ module RDoc
##
# RDoc version you are using
- VERSION = '3.9.2'
+ VERSION = '3.9.3'
##
# Method visibilities
diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb
index cfe1ba7725..813d5ea6fa 100644
--- a/lib/rdoc/encoding.rb
+++ b/lib/rdoc/encoding.rb
@@ -1,3 +1,5 @@
+# coding: US-ASCII
+
require 'rdoc'
##
diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb
index 3dd2459e61..616d6e34f3 100644
--- a/lib/rdoc/markup.rb
+++ b/lib/rdoc/markup.rb
@@ -284,7 +284,19 @@ require 'rdoc'
#
# Links can also be of the form <tt>label[url]</tt>, in which case +label+ is
# used in the displayed text, and +url+ is used as the target. If +label+
-# contains multiple words, put it in braces: <tt>{multi word label}[url]<tt>.
+# contains multiple words, put it in braces: <tt>{multi word label}[url]</tt>.
+# The +url+ may be an +http:+-type link or a cross-reference to a class,
+# module or method with a label.
+#
+# Links with the <tt>rdoc-ref:</tt> scheme will link to the referenced class,
+# module, method, file, etc. If the referenced item is does not exist
+# no link will be generated and <tt>rdoc-ref:</tt> will be removed from the
+# resulting text.
+#
+# Links starting with +link:+ refer to local files whose path is relative to
+# the <tt>--op</tt> directory. Use <tt>rdoc-ref:</tt> instead of
+# <tt>link:</tt> to link to files generated by RDoc as the link target may
+# be different across RDoc generators.
#
# Example links:
#
diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb
index bf904bba68..f42b3fc6ea 100644
--- a/lib/rdoc/markup/formatter.rb
+++ b/lib/rdoc/markup/formatter.rb
@@ -88,7 +88,9 @@ class RDoc::Markup::Formatter
##
# Converts added specials. See RDoc::Markup#add_special
- def convert_special(special)
+ def convert_special special
+ return special.text if in_tt?
+
handled = false
RDoc::Markup::Attribute.each_name_of special.type do |name|
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index ca6522352d..bd5fdb493e 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -254,7 +254,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
end
end
- if (type == "http" or type == "link") and
+ if (type == "http" or type == "https" or type == "link") and
url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then
"<img src=\"#{url}\" />"
else
diff --git a/lib/rdoc/ruby_lex.rb b/lib/rdoc/ruby_lex.rb
index 13e86728c9..4392cea9cf 100644
--- a/lib/rdoc/ruby_lex.rb
+++ b/lib/rdoc/ruby_lex.rb
@@ -1,3 +1,5 @@
+# coding: US-ASCII
+
#--
# irb/ruby-lex.rb - ruby lexcal analyzer
# $Release Version: 0.9.5$
diff --git a/test/rdoc/test_rdoc_code_object.rb b/test/rdoc/test_rdoc_code_object.rb
index 89dc4b1744..c7a37488cc 100644
--- a/test/rdoc/test_rdoc_code_object.rb
+++ b/test/rdoc/test_rdoc_code_object.rb
@@ -1,3 +1,5 @@
+# coding: US-ASCII
+
require 'rubygems'
require 'minitest/autorun'
require File.expand_path '../xref_test_case', __FILE__
diff --git a/test/rdoc/test_rdoc_encoding.rb b/test/rdoc/test_rdoc_encoding.rb
index 178f805129..b5ffd7714c 100644
--- a/test/rdoc/test_rdoc_encoding.rb
+++ b/test/rdoc/test_rdoc_encoding.rb
@@ -1,3 +1,5 @@
+# coding: US-ASCII
+
require 'rubygems'
require 'minitest/autorun'
require 'rdoc'
diff --git a/test/rdoc/test_rdoc_markup_formatter.rb b/test/rdoc/test_rdoc_markup_formatter.rb
new file mode 100644
index 0000000000..73e75e2aa1
--- /dev/null
+++ b/test/rdoc/test_rdoc_markup_formatter.rb
@@ -0,0 +1,57 @@
+require 'rubygems'
+require 'minitest/autorun'
+require 'rdoc'
+require 'rdoc/markup'
+require 'rdoc/markup/formatter'
+
+class TestRDocMarkupFormatter < MiniTest::Unit::TestCase
+
+ class ToTest < RDoc::Markup::Formatter
+
+ def initialize markup
+ super
+
+ add_tag :TT, '<tt>', '</tt>'
+ end
+
+ def accept_paragraph paragraph
+ @res << attributes(paragraph.text)
+ end
+
+ def attributes text
+ convert_flow @am.flow text.dup
+ end
+
+ def handle_special_CAPS special
+ "handled #{special.text}"
+ end
+
+ def start_accepting
+ @res = ""
+ end
+
+ def end_accepting
+ @res
+ end
+
+ end
+
+ def setup
+ @markup = RDoc::Markup.new
+ @markup.add_special(/[A-Z]+/, :CAPS)
+
+ @to = ToTest.new @markup
+
+ @caps = RDoc::Markup::Attribute.bitmap_for :CAPS
+ @special = RDoc::Markup::Attribute.bitmap_for :_SPECIAL_
+ @tt = RDoc::Markup::Attribute.bitmap_for :TT
+ end
+
+ def test_convert_tt_special
+ converted = @to.convert '<tt>AAA</tt>'
+
+ assert_equal '<tt>AAA</tt>', converted
+ end
+
+end
+
diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb
index 9c26c00906..2cb16e88ae 100644
--- a/test/rdoc/test_rdoc_markup_to_html.rb
+++ b/test/rdoc/test_rdoc_markup_to_html.rb
@@ -306,6 +306,14 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
@to.gen_url('link:example', 'example')
end
+ def test_gem_url_image_url
+ assert_equal '<img src="http://example.com/image.png" />', @to.gen_url('http://example.com/image.png', 'ignored')
+ end
+
+ def test_gem_url_ssl_image_url
+ assert_equal '<img src="https://example.com/image.png" />', @to.gen_url('https://example.com/image.png', 'ignored')
+ end
+
def test_handle_special_HYPERLINK_link
special = RDoc::Markup::Special.new 0, 'link:README.txt'