ruby-changes:20995
From: drbrain <ko1@a...>
Date: Wed, 24 Aug 2011 09:02:30 +0900 (JST)
Subject: [ruby-changes:20995] drbrain:r33044 (ruby_1_9_3): * backport r33043 from trunk.
drbrain 2011-08-24 09:02:17 +0900 (Wed, 24 Aug 2011) New Revision: 33044 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33044 Log: * backport r33043 from trunk. * 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. Added files: branches/ruby_1_9_3/test/rdoc/test_rdoc_markup_formatter.rb Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/NEWS branches/ruby_1_9_3/lib/rdoc/encoding.rb branches/ruby_1_9_3/lib/rdoc/markup/formatter.rb branches/ruby_1_9_3/lib/rdoc/markup/to_html.rb branches/ruby_1_9_3/lib/rdoc/markup.rb branches/ruby_1_9_3/lib/rdoc/ruby_lex.rb branches/ruby_1_9_3/lib/rdoc.rb branches/ruby_1_9_3/test/rdoc/test_rdoc_code_object.rb branches/ruby_1_9_3/test/rdoc/test_rdoc_encoding.rb branches/ruby_1_9_3/test/rdoc/test_rdoc_markup_to_html.rb Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 33043) +++ ruby_1_9_3/ChangeLog (revision 33044) @@ -1,3 +1,11 @@ +Wed Aug 24 08:53:06 2011 Eric Hodel <drbrain@s...> + + * backport r33043 from trunk. + + * 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@s...> * backport r33040 from trunk. Index: ruby_1_9_3/lib/rdoc.rb =================================================================== --- ruby_1_9_3/lib/rdoc.rb (revision 33043) +++ ruby_1_9_3/lib/rdoc.rb (revision 33044) @@ -104,7 +104,7 @@ ## # RDoc version you are using - VERSION = '3.9.2' + VERSION = '3.9.3' ## # Method visibilities Index: ruby_1_9_3/lib/rdoc/markup/formatter.rb =================================================================== --- ruby_1_9_3/lib/rdoc/markup/formatter.rb (revision 33043) +++ ruby_1_9_3/lib/rdoc/markup/formatter.rb (revision 33044) @@ -88,7 +88,9 @@ ## # 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| Index: ruby_1_9_3/lib/rdoc/markup/to_html.rb =================================================================== --- ruby_1_9_3/lib/rdoc/markup/to_html.rb (revision 33043) +++ ruby_1_9_3/lib/rdoc/markup/to_html.rb (revision 33044) @@ -254,7 +254,7 @@ 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 Index: ruby_1_9_3/lib/rdoc/markup.rb =================================================================== --- ruby_1_9_3/lib/rdoc/markup.rb (revision 33043) +++ ruby_1_9_3/lib/rdoc/markup.rb (revision 33044) @@ -284,8 +284,20 @@ # # 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: # # https://github.com/rdoc/rdoc Index: ruby_1_9_3/lib/rdoc/encoding.rb =================================================================== --- ruby_1_9_3/lib/rdoc/encoding.rb (revision 33043) +++ ruby_1_9_3/lib/rdoc/encoding.rb (revision 33044) @@ -1,3 +1,5 @@ +# coding: US-ASCII + require 'rdoc' ## Index: ruby_1_9_3/lib/rdoc/ruby_lex.rb =================================================================== --- ruby_1_9_3/lib/rdoc/ruby_lex.rb (revision 33043) +++ ruby_1_9_3/lib/rdoc/ruby_lex.rb (revision 33044) @@ -1,3 +1,5 @@ +# coding: US-ASCII + #-- # irb/ruby-lex.rb - ruby lexcal analyzer # $Release Version: 0.9.5$ Index: ruby_1_9_3/NEWS =================================================================== --- ruby_1_9_3/NEWS (revision 33043) +++ ruby_1_9_3/NEWS (revision 33044) @@ -258,7 +258,7 @@ https://github.com/jimweirich/rake/blob/master/CHANGES * RDoc - * RDoc has been upgraded from 2.5.8 to 3.8. For full release notes see + * RDoc has been upgraded to version 3.9.2. For full release notes see http://docs.seattlerb.org/rdoc/History_txt.html * rexml Index: ruby_1_9_3/test/rdoc/test_rdoc_markup_to_html.rb =================================================================== --- ruby_1_9_3/test/rdoc/test_rdoc_markup_to_html.rb (revision 33043) +++ ruby_1_9_3/test/rdoc/test_rdoc_markup_to_html.rb (revision 33044) @@ -306,6 +306,14 @@ @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' Index: ruby_1_9_3/test/rdoc/test_rdoc_code_object.rb =================================================================== --- ruby_1_9_3/test/rdoc/test_rdoc_code_object.rb (revision 33043) +++ ruby_1_9_3/test/rdoc/test_rdoc_code_object.rb (revision 33044) @@ -1,3 +1,5 @@ +# coding: US-ASCII + require 'rubygems' require 'minitest/autorun' require File.expand_path '../xref_test_case', __FILE__ Index: ruby_1_9_3/test/rdoc/test_rdoc_markup_formatter.rb =================================================================== --- ruby_1_9_3/test/rdoc/test_rdoc_markup_formatter.rb (revision 0) +++ ruby_1_9_3/test/rdoc/test_rdoc_markup_formatter.rb (revision 33044) @@ -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 + Index: ruby_1_9_3/test/rdoc/test_rdoc_encoding.rb =================================================================== --- ruby_1_9_3/test/rdoc/test_rdoc_encoding.rb (revision 33043) +++ ruby_1_9_3/test/rdoc/test_rdoc_encoding.rb (revision 33044) @@ -1,3 +1,5 @@ +# coding: US-ASCII + require 'rubygems' require 'minitest/autorun' require 'rdoc' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/