ruby-changes:26112
From: drbrain <ko1@a...>
Date: Tue, 4 Dec 2012 08:33:17 +0900 (JST)
Subject: [ruby-changes:26112] drbrain:r38169 (trunk): * lib/rdoc/ri/driver.rb: Fixed ri page display for files with
drbrain 2012-12-04 08:32:39 +0900 (Tue, 04 Dec 2012) New Revision: 38169 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38169 Log: * lib/rdoc/ri/driver.rb: Fixed ri page display for files with extensions. * test/rdoc/test_rdoc_ri_driver.rb: Test for above Modified files: trunk/ChangeLog trunk/lib/rdoc/ri/driver.rb trunk/test/rdoc/test_rdoc_ri_driver.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38168) +++ ChangeLog (revision 38169) @@ -1,3 +1,9 @@ +Tue Dec 4 08:32:10 2012 Eric Hodel <drbrain@s...> + + * lib/rdoc/ri/driver.rb: Fixed ri page display for files with + extensions. + * test/rdoc/test_rdoc_ri_driver.rb: Test for above + Tue Dec 4 04:11:50 2012 Eric Hodel <drbrain@s...> * .document: Add NEWS for `ri ruby:NEWS` Index: lib/rdoc/ri/driver.rb =================================================================== --- lib/rdoc/ri/driver.rb (revision 38168) +++ lib/rdoc/ri/driver.rb (revision 38169) @@ -1331,12 +1331,16 @@ elsif parts.length == 2 or parts.last =~ /::|#|\./ then type = parts.pop meth = nil + elsif parts[1] == ':' then + klass = parts.shift + type = parts.shift + meth = parts.join elsif parts[-2] != '::' or parts.last !~ /^[A-Z]/ then meth = parts.pop type = parts.pop end - klass = parts.join + klass ||= parts.join [klass, type, meth] end Index: test/rdoc/test_rdoc_ri_driver.rb =================================================================== --- test/rdoc/test_rdoc_ri_driver.rb (revision 38168) +++ test/rdoc/test_rdoc_ri_driver.rb (revision 38169) @@ -747,6 +747,25 @@ assert_match %r%README\.md%, out end + def test_display_page_extension + util_store + + other = @store1.add_file 'README.EXT' + other.parser = RDoc::Parser::Simple + other.comment = + doc( + head(1, 'README.EXT'), + para('This is the other README')) + + @store1.save_page other + + out, = capture_io do + @driver.display_page 'home:README.EXT' + end + + assert_match 'other README', out + end + def test_display_page_ignore_directory util_store @@ -1147,6 +1166,14 @@ assert_equal nil, meth, 'ruby page' end + def test_parse_name_page_extenson + klass, type, meth = @driver.parse_name 'ruby:README.EXT' + + assert_equal 'ruby', klass, 'ruby project' + assert_equal ':', type, 'ruby type' + assert_equal 'README.EXT', meth, 'ruby page' + end + def test_parse_name_single_class klass, type, meth = @driver.parse_name 'Foo' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/