[前][次][番号順一覧][スレッド一覧]

ruby-changes:27102

From: drbrain <ko1@a...>
Date: Fri, 8 Feb 2013 13:13:08 +0900 (JST)
Subject: [ruby-changes:27102] drbrain:r39154 (trunk): * lib/rdoc/generator/darkfish.rb: Set encoding on output template to

drbrain	2013-02-08 13:12:56 +0900 (Fri, 08 Feb 2013)

  New Revision: 39154

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39154

  Log:
    * lib/rdoc/generator/darkfish.rb:  Set encoding on output template to
      user-specified encoding.
    * test/rdoc/test_rdoc_generator_darkfish.rb:  Test for above.
    
    * lib/rdoc.rb:  Bump version

  Modified files:
    trunk/ChangeLog
    trunk/lib/rdoc/generator/darkfish.rb
    trunk/lib/rdoc.rb
    trunk/test/rdoc/test_rdoc_generator_darkfish.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39153)
+++ ChangeLog	(revision 39154)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Feb  8 13:12:04 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/rdoc/generator/darkfish.rb:  Set encoding on output template to
+	  user-specified encoding.
+	* test/rdoc/test_rdoc_generator_darkfish.rb:  Test for above.
+
+	* lib/rdoc.rb:  Bump version
+
 Fri Feb  8 11:53:33 2013  Eric Hodel  <drbrain@s...>
 
 	* lib/rubygems/security/policy.rb:  Raise proper exceptions when
Index: lib/rdoc.rb
===================================================================
--- lib/rdoc.rb	(revision 39153)
+++ lib/rdoc.rb	(revision 39154)
@@ -64,7 +64,7 @@ module RDoc https://github.com/ruby/ruby/blob/trunk/lib/rdoc.rb#L64
   ##
   # RDoc version you are using
 
-  VERSION = '4.0.0.rc.2'
+  VERSION = '4.0.0.rc.2.1'
 
   ##
   # Method visibilities
Index: lib/rdoc/generator/darkfish.rb
===================================================================
--- lib/rdoc/generator/darkfish.rb	(revision 39153)
+++ lib/rdoc/generator/darkfish.rb	(revision 39154)
@@ -698,18 +698,18 @@ class RDoc::Generator::Darkfish https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/darkfish.rb#L698
 
     return template if template
 
-    template = if page then
-                 assemble_template file
-               else
-                 file.read
-               end
+    if page then
+      template = assemble_template file
+      erbout = 'io'
+    else
+      template = file.read
+      template = template.encode @options.encoding if
+        Object.const_defined? :Encoding
 
-    erbout = if page then
-               'io'
-             else
-               file_var = File.basename(file).sub(/\..*/, '')
-               "_erbout_#{file_var}"
-             end
+      file_var = File.basename(file).sub(/\..*/, '')
+
+      erbout = "_erbout_#{file_var}"
+    end
 
     template = klass.new template, nil, '<>', erbout
     @template_cache[file] = template
Index: test/rdoc/test_rdoc_generator_darkfish.rb
===================================================================
--- test/rdoc/test_rdoc_generator_darkfish.rb	(revision 39153)
+++ test/rdoc/test_rdoc_generator_darkfish.rb	(revision 39154)
@@ -173,5 +173,15 @@ class TestRDocGeneratorDarkfish < RDoc:: https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_generator_darkfish.rb#L173
     assert_same template, @g.send(:template_for, classpage)
   end
 
+  def test_template_for_partial
+    partial = Pathname.new @options.template_dir + '_sidebar_classes.rhtml'
+
+    template = @g.send(:template_for, partial, false, RDoc::ERBPartial)
+
+    assert_kind_of RDoc::ERBPartial, template
+
+    assert_same template, @g.send(:template_for, partial)
+  end
+
 end
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]