diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-01 02:05:35 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-01 02:05:35 +0000 |
commit | f058f2d8451abb25c149ab5fca31ffa497d13121 (patch) | |
tree | a8ea6203a6c2eb2d23d73d5edcd8008b6ee0fb7b | |
parent | 2a43e8983da9b7efbe03e910e0ce41acf003abfa (diff) |
merges r28455 and r28460 from trunk into ruby_1_9_2.
--
* lib/rdoc/ri/driver.rb (RDoc::RI::Driver#formatter): should use bs
format when stdout is piped. [ruby-core:30734]
--
* test/rdoc/test_rdoc_ri_driver.rb (TestRDocRIDriver#test_formatter):
fix a test accordingly to r28455.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | lib/rdoc/ri/driver.rb | 6 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_ri_driver.rb | 9 |
3 files changed, 19 insertions, 6 deletions
@@ -1,3 +1,13 @@ +Mon Jun 28 22:14:22 2010 Yusuke Endoh <mame@tsg.ne.jp> + + * test/rdoc/test_rdoc_ri_driver.rb (TestRDocRIDriver#test_formatter): + fix a test accordingly to r28455. + +Mon Jun 28 05:32:51 2010 Yusuke Endoh <mame@tsg.ne.jp> + + * lib/rdoc/ri/driver.rb (RDoc::RI::Driver#formatter): should use bs + format when stdout is piped. [ruby-core:30734] + Mon Jun 28 03:12:03 2010 Yusuke Endoh <mame@tsg.ne.jp> * bootstraptest/test_class.rb: add a test for [ruby-core:30843]. diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index b5523355d5..90fbc7c7a2 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -546,7 +546,7 @@ Options may also be set in the 'RI' environment variable. def display document page do |io| - text = document.accept formatter + text = document.accept formatter(io) io.write text end @@ -795,10 +795,10 @@ Options may also be set in the 'RI' environment variable. # Creates a new RDoc::Markup::Formatter. If a formatter is given with -f, # use it. If we're outputting to a pager, use bs, otherwise ansi. - def formatter + def formatter(io) if @formatter_klass then @formatter_klass.new - elsif paging? then + elsif paging? or !io.tty? then RDoc::Markup::ToBs.new else RDoc::Markup::ToAnsi.new diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb index 51f2576cb4..8d64916088 100644 --- a/test/rdoc/test_rdoc_ri_driver.rb +++ b/test/rdoc/test_rdoc_ri_driver.rb @@ -498,15 +498,18 @@ Foo::Bar#bother def test_formatter driver = RDoc::RI::Driver.new - assert_instance_of @RM::ToAnsi, driver.formatter + io = Object.new + def io.tty?; true; end + + assert_instance_of @RM::ToAnsi, driver.formatter(io) driver.instance_variable_set :@paging, true - assert_instance_of @RM::ToBs, driver.formatter + assert_instance_of @RM::ToBs, driver.formatter(io) driver.instance_variable_set :@formatter_klass, @RM::ToHtml - assert_instance_of @RM::ToHtml, driver.formatter + assert_instance_of @RM::ToHtml, driver.formatter(io) end def test_method_type |