diff --git a/ChangeLog b/ChangeLog index 9b1030c56e..f30812b4ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Jan 15 07:39:21 2013 Eric Hodel + + * 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 * lib/irb/ext/save-history.rb: outputs its history to diff --git a/lib/rdoc/top_level.rb b/lib/rdoc/top_level.rb index f4952fb6ff..7b291ade80 100644 --- a/lib/rdoc/top_level.rb +++ b/lib/rdoc/top_level.rb @@ -226,7 +226,7 @@ class RDoc::TopLevel < RDoc::Context def page_name basename = File.basename @relative_name - basename =~ /\.[^.]*$/ + basename =~ /\.(rb|rdoc|txt|md)$/i $` || basename end diff --git a/test/rdoc/test_rdoc_top_level.rb b/test/rdoc/test_rdoc_top_level.rb index 9c7a3db66f..99f7b22ae0 100644 --- a/test/rdoc/test_rdoc_top_level.rb +++ b/test/rdoc/test_rdoc_top_level.rb @@ -214,7 +214,7 @@ class TestRDocTopLevel < XrefTestCase 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 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