1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Merge branch 'stable'

This commit is contained in:
Nathan Weizenbaum 2010-03-31 15:47:31 -07:00
commit 005472a421
4 changed files with 17 additions and 2 deletions

View file

@ -70,7 +70,7 @@ at_exit { File.delete(scope('REVISION')) rescue nil }
desc "Install Haml as a gem."
task :install => [:package] do
sudo = RUBY_PLATFORM =~ /win32/ ? '' : 'sudo'
sudo = RUBY_PLATFORM =~ /win32|mingw/ ? '' : 'sudo'
gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem'
sh %{#{sudo} #{gem} install --no-ri pkg/haml-#{File.read(scope('VERSION')).strip}}
end

View file

@ -264,6 +264,8 @@ Thanks to [Josh Peek](http://joshpeek.com/).
* Don't crash when `rake gems` is run in Rails with Haml installed.
Thanks to [Florian Frank](http://github.com/flori).
* Don't remove `\n` in filters with interpolation.
## 2.2.22
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.22).

View file

@ -100,7 +100,11 @@ module Haml
if contains_interpolation?(text)
return if options[:suppress_eval]
text = unescape_interpolation(text).gsub("\\n", "\n")
text = unescape_interpolation(text).gsub(/(\\+)n/) do |s|
escapes = $1.size
next s if escapes % 2 == 0
("\\" * (escapes - 1)) + "\n"
end
newline if text.gsub!(/\n"\Z/, "\\n\"")
push_script <<RUBY.strip, :escape_html => false
find_and_preserve(#{filter.inspect}.render_with_options(#{text}, _hamlout.options))

View file

@ -671,6 +671,15 @@ HAML
assert_equal("<a href='#\"'></a>\n", render('%a(href="#\\"")'))
end
def test_filter_with_newline_and_interp
assert_equal(<<HTML, render(<<HAML))
\\n
HTML
:plain
\\n\#{""}
HAML
end
# HTML escaping tests
def test_ampersand_equals_should_escape