aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-03 23:32:39 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-03 23:32:39 +0000
commitec05ade5312881296891949e05afa3ace8754207 (patch)
tree3ccec7dced8a747cab17119b09159cf708039f97
parentf8f5a9eb4e628814803f98bceb9e4437241a7746 (diff)
downloadruby-ec05ade5312881296891949e05afa3ace8754207.tar.gz
* lib/rdoc/ri/driver.rb: Fixed ri page display for files with
extensions. * test/rdoc/test_rdoc_ri_driver.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/rdoc/ri/driver.rb6
-rw-r--r--test/rdoc/test_rdoc_ri_driver.rb27
3 files changed, 38 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3affabdf28..a3cfbba6c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Dec 4 08:32:10 2012 Eric Hodel <drbrain@segment7.net>
+
+ * 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@segment7.net>
* .document: Add NEWS for `ri ruby:NEWS`
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index 4f5e13034e..88d87f8084 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -1331,12 +1331,16 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
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
diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb
index 37f29fbdfc..92403e12f4 100644
--- a/test/rdoc/test_rdoc_ri_driver.rb
+++ b/test/rdoc/test_rdoc_ri_driver.rb
@@ -747,6 +747,25 @@ Foo::Bar#bother
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 @@ Foo::Bar#bother
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'