private Method

PreProcess.include_file(name, indent)

Include a file, indenting it correctly

Source Code

# File rdoc/markup/simple_markup/preprocess.rb, line 43
def include_file(name, indent)
  if (full_name = find_include_file(name))
    content = File.open(full_name) {|f| f.read}
    # strip leading '#'s, but only if all lines start with them
    if content =~ /^[^#]/
      content.gsub(/^/, indent)
    else
      content.gsub(/^#?/, indent)
    end
  else
    $stderr.puts "Couldn't find file to include: '#{name}'"
    ''
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.