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

ruby-changes:26763

From: drbrain <ko1@a...>
Date: Tue, 15 Jan 2013 07:44:16 +0900 (JST)
Subject: [ruby-changes:26763] drbrain:r38814 (trunk): * lib/rdoc/top_level.rb: Fixed extension trimming for page names in

drbrain	2013-01-15 07:43:21 +0900 (Tue, 15 Jan 2013)

  New Revision: 38814

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

  Log:
    * lib/rdoc/top_level.rb:  Fixed extension trimming for page names in
      RDoc HTML output.  [ruby-trunk - Bug #7673]
    * test/rdoc/test_rdoc_top_level.rb:  Test for above.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rdoc/top_level.rb
    trunk/test/rdoc/test_rdoc_top_level.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38813)
+++ ChangeLog	(revision 38814)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jan 15 07:39:21 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/rdoc/top_level.rb:  Fixed extension trimming for page names in
+	  RDoc HTML output.  [ruby-trunk - Bug #7673]
+	* test/rdoc/test_rdoc_top_level.rb:  Test for above.
+
 Mon Jan 14 23:06:41 2013  Keiju Ishitsuka  <keiju@i...>
 
 	* lib/irb/ext/save-history.rb: outputs its history to
Index: lib/rdoc/top_level.rb
===================================================================
--- lib/rdoc/top_level.rb	(revision 38813)
+++ lib/rdoc/top_level.rb	(revision 38814)
@@ -226,7 +226,7 @@ class RDoc::TopLevel < RDoc::Context https://github.com/ruby/ruby/blob/trunk/lib/rdoc/top_level.rb#L226
 
   def page_name
     basename = File.basename @relative_name
-    basename =~ /\.[^.]*$/
+    basename =~ /\.(rb|rdoc|txt|md)$/i
 
     $` || basename
   end
Index: test/rdoc/test_rdoc_top_level.rb
===================================================================
--- test/rdoc/test_rdoc_top_level.rb	(revision 38813)
+++ test/rdoc/test_rdoc_top_level.rb	(revision 38814)
@@ -214,7 +214,7 @@ class TestRDocTopLevel < XrefTestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_top_level.rb#L214
   def test_page_name
     assert_equal 'top_level', @top_level.page_name
 
-    tl = @store.add_file 'README.ja.rdoc'
+    tl = @store.add_file 'README.ja'
 
     assert_equal 'README.ja', tl.page_name
 
@@ -223,6 +223,20 @@ class TestRDocTopLevel < XrefTestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_top_level.rb#L223
     assert_equal 'Rakefile', tl.page_name
   end
 
+  def test_page_name_trim_extension
+    tl = @store.add_file 'README.ja.rdoc'
+
+    assert_equal 'README.ja', tl.page_name
+
+    tl = @store.add_file 'README.ja.md'
+
+    assert_equal 'README.ja', tl.page_name
+
+    tl = @store.add_file 'README.txt'
+
+    assert_equal 'README', tl.page_name
+  end
+
   def test_search_record
     assert_nil @xref_data.search_record
   end

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

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