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:
parent
fe2ebcd53f
commit
332401a4a6
3 changed files with 22 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue