diff options
Diffstat (limited to 'lib/rdoc/markup/preprocess.rb')
-rw-r--r-- | lib/rdoc/markup/preprocess.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/rdoc/markup/preprocess.rb b/lib/rdoc/markup/preprocess.rb index 00dd4be4ad..a175d179cf 100644 --- a/lib/rdoc/markup/preprocess.rb +++ b/lib/rdoc/markup/preprocess.rb @@ -7,6 +7,10 @@ require 'rdoc/markup' class RDoc::Markup::PreProcess + ## + # Creates a new pre-processor for +input_file_name+ that will look for + # included files in +include_path+ + def initialize(input_file_name, include_path) @input_file_name = input_file_name @include_path = include_path @@ -44,15 +48,16 @@ class RDoc::Markup::PreProcess def include_file(name, indent) if full_name = find_include_file(name) then - content = File.open(full_name) {|f| f.read} + content = File.read full_name + # strip leading '#'s, but only if all lines start with them - if content =~ /^[^#]/ + if content =~ /^[^#]/ then content.gsub(/^/, indent) else content.gsub(/^#?/, indent) end else - $stderr.puts "Couldn't find file to include: '#{name}'" + $stderr.puts "Couldn't find file to include '#{name}' from #{@input_file_name}" '' end end |