summaryrefslogtreecommitdiff
path: root/lib/rdoc/parser.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-10 06:36:13 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-10 06:36:13 +0000
commit1325437297539bf433904b64db63a3186e62177e (patch)
tree01608a107ec3939b1013152d961b6407a5ba9c25 /lib/rdoc/parser.rb
parentce2b574017cacc2c3f2b0e92f82a7f250639fc34 (diff)
* lib/rdoc: Import RDoc 2.5.2
* lib/rdoc/parser/ruby.rb (RDoc::Parser::Ruby): Don't parse rdoc files, reverts r24976 in favor of include directive support in C parser. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/parser.rb')
-rw-r--r--lib/rdoc/parser.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb
index a5c7de663f..01e24e5d4b 100644
--- a/lib/rdoc/parser.rb
+++ b/lib/rdoc/parser.rb
@@ -73,10 +73,10 @@ class RDoc::Parser
true
elsif file =~ /erb\.rb$/ then
false
- elsif s.scan(/<%|%>/).length >= 4 then
+ elsif s.scan(/<%|%>/).length >= 4 || s.index("\x00") then
true
else
- s.count("^ -~\t\r\n").fdiv(s.size) > 0.3 || s.index("\x00")
+ s.count("^ -~\t\r\n").fdiv(s.size) > 0.3
end
end
@@ -102,7 +102,9 @@ class RDoc::Parser
return if parser == RDoc::Parser::Simple and zip? file_name
# The default parser must not parse binary files
- return if parser == RDoc::Parser::Simple and file_name !~ /\.(txt|rdoc)$/
+ ext_name = File.extname file_name
+ return parser if ext_name.empty?
+ return if parser == RDoc::Parser::Simple and ext_name !~ /txt|rdoc/
parser
end