Permalink
Browse files

Fixing an output-indentation bug with self-closed tags. Thanks to Nic…

…olas Sanguinetti for pointing this out.

git-svn-id: svn://hamptoncatlin.com/haml/tags/stable@729 7063305b-7217-0410-af8c-cdc13e5119b9
  • Loading branch information...
nex3 committed Jan 17, 2008
1 parent 75be1d1 commit 39c6d41f1bc810275720ce1eed57cc1f142af325
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/haml/buffer.rb
  2. +4 −0 test/haml/engine_test.rb
View
@@ -115,7 +115,7 @@ def open_tag(name, atomic, try_one_line, class_id, obj_ref, content, *attributes
else
@buffer << "\n#{tabs(@real_tabs+1)}#{content}\n#{tabs(@real_tabs)}</#{name}>\n"
end
- else
+ elsif !atomic
@real_tabs += 1
end
end
View
@@ -173,6 +173,10 @@ def test_dynamic_attrs_shouldnt_register_as_literal_values
assert_equal("<p a='b2c'>\n</p>\n", render("%p{:a => 'b' + (1 + 1).to_s + 'c'}"))
end
+ def test_dynamic_attrs_with_self_closed_tag
+ assert_equal("<a b='2' />\nc\n", render("%a{'b' => 1 + 1}/\n= 'c'\n"))
+ end
+
def test_rec_merge
hash1 = {1=>2, 3=>{5=>7, 8=>9}}
hash2 = {4=>5, 3=>{5=>2, 16=>12}}

0 comments on commit 39c6d41

Please sign in to comment.