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

Fix a weird indentation bug.

Closes gh-424
This commit is contained in:
Nathan Weizenbaum 2011-11-23 17:05:39 -08:00
parent fe2ebcd53f
commit 332401a4a6
3 changed files with 22 additions and 2 deletions

View file

@ -6,6 +6,7 @@
## 3.1.4 (Unreleased)
* Fix the use of `FormBuilder#block` with a label in Haml.
* Fix indentation after a self-closing tag with dynamic attributes.
## 3.1.3

View file

@ -156,8 +156,8 @@ END
if value && !parse
concat_merged_text("#{value}</#{t[:name]}>#{t[:nuke_outer_whitespace] ? "" : "\n"}")
else
@to_merge << [:text, '', 1] unless t[:nuke_inner_whitespace]
elsif !t[:nuke_inner_whitespace] && !t[:self_closing]
@to_merge << [:text, '', 1]
end
@dont_indent_next_line = dont_indent_next_line

View file

@ -398,6 +398,25 @@ HAML
# Regression tests
unless Haml::Util.ruby1_8?
def test_indentation_after_dynamic_attr_hash
assert_equal(<<HTML, render(<<HAML))
<html>
<body>
<img src='test' />
foo
bar
</body>
</html>
HTML
%html
%body
%img{:src => 'te'+'st'}
= "foo\\nbar"
HAML
end
end
def test_whitespace_nuke_with_both_newlines
assert_equal("<p>foo</p>\n", render('%p<= "\nfoo\n"'))
assert_equal(<<HTML, render(<<HAML))