From 19e835f952baed4f466fbc0eb836460cd86264e9 Mon Sep 17 00:00:00 2001 From: mame Date: Sun, 27 Jun 2010 20:36:12 +0000 Subject: [PATCH] * lib/rdoc/ri/driver.rb (RDoc::RI::Driver#formatter): should use bs format when stdout is piped. [ruby-core:30734] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/rdoc/ri/driver.rb | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a50a159a43..c9569d307d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jun 28 05:32:51 2010 Yusuke Endoh + + * 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 * 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