From 1325437297539bf433904b64db63a3186e62177e Mon Sep 17 00:00:00 2001 From: drbrain Date: Sat, 10 Apr 2010 06:36:13 +0000 Subject: * 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 --- lib/rdoc/markup/parser.rb | 2 +- lib/rdoc/markup/preprocess.rb | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/rdoc/markup') diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb index c0d6519fd5..166d8f89f7 100644 --- a/lib/rdoc/markup/parser.rb +++ b/lib/rdoc/markup/parser.rb @@ -463,7 +463,7 @@ class RDoc::Markup::Parser token when s.scan(/ +/) then [:INDENT, s.matched_size, *token_pos(pos)] - when s.scan(/(=+)\s+/) then + when s.scan(/(=+)\s*/) then level = s[1].length level = 6 if level > 6 @tokens << [:HEADER, level, *token_pos(pos)] diff --git a/lib/rdoc/markup/preprocess.rb b/lib/rdoc/markup/preprocess.rb index a175d179cf..7aac9df74a 100644 --- a/lib/rdoc/markup/preprocess.rb +++ b/lib/rdoc/markup/preprocess.rb @@ -41,14 +41,13 @@ class RDoc::Markup::PreProcess end end - private - ## # Include a file, indenting it correctly. def include_file(name, indent) if full_name = find_include_file(name) then content = File.read full_name + content = content.sub(/\A# .*coding[=:].*$/, '').lstrip # strip leading '#'s, but only if all lines start with them if content =~ /^[^#]/ then @@ -57,7 +56,7 @@ class RDoc::Markup::PreProcess content.gsub(/^#?/, indent) end else - $stderr.puts "Couldn't find file to include '#{name}' from #{@input_file_name}" + warn "Couldn't find file to include '#{name}' from #{@input_file_name}" '' end end @@ -67,7 +66,7 @@ class RDoc::Markup::PreProcess # and then in each of the directories specified in the RDOC_INCLUDE path def find_include_file(name) - to_search = [ File.dirname(@input_file_name) ].concat @include_path + to_search = [File.dirname(@input_file_name)].concat @include_path to_search.each do |dir| full_name = File.join(dir, name) stat = File.stat(full_name) rescue next -- cgit v1.2.3