Don't push all text in :ruby filters onto one line.

This commit is contained in:
Nathan Weizenbaum 2008-07-15 23:35:08 -04:00
parent b54ff8dbe6
commit 9016da55f5
2 changed files with 4 additions and 3 deletions

View File

@ -187,13 +187,13 @@ END
def compile(precompiler, text) def compile(precompiler, text)
return if precompiler.options[:suppress_eval] return if precompiler.options[:suppress_eval]
precompiler.instance_eval do precompiler.instance_eval do
push_silent <<-END.gsub("\n", ';') push_silent <<-FIRST.gsub("\n", ';') + text + <<-LAST.gsub("\n", ';')
_haml_old_stdout = $stdout _haml_old_stdout = $stdout
$stdout = StringIO.new(_hamlout.buffer, 'a') $stdout = StringIO.new(_hamlout.buffer, 'a')
#{text} FIRST
_haml_old_stdout, $stdout = $stdout, _haml_old_stdout _haml_old_stdout, $stdout = $stdout, _haml_old_stdout
_haml_old_stdout.close _haml_old_stdout.close
END LAST
end end
end end
end end

View File

@ -56,6 +56,7 @@ END
A tab character was used for indentation. Haml must be indented using two spaces. A tab character was used for indentation. Haml must be indented using two spaces.
Are you sure you have soft tabs enabled in your editor? Are you sure you have soft tabs enabled in your editor?
END END
"foo\n:ruby\n 1\n 2\n 3\n- raise 'foo'" => ["foo", 6],
} }
User = Struct.new('User', :id) User = Struct.new('User', :id)