From 54f47300fcb1a7daf927c6907f5753acc13144c8 Mon Sep 17 00:00:00 2001 From: nex3 Date: Thu, 17 Jan 2008 18:41:27 +0000 Subject: [PATCH] Fixing an output-indentation bug with self-closed tags. Thanks to Nicolas Sanguinetti for pointing this out. git-svn-id: svn://hamptoncatlin.com/haml/trunk@729 7063305b-7217-0410-af8c-cdc13e5119b9 --- lib/haml/buffer.rb | 2 +- test/haml/engine_test.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/haml/buffer.rb b/lib/haml/buffer.rb index 3906296c..4bdac1d3 100644 --- a/lib/haml/buffer.rb +++ b/lib/haml/buffer.rb @@ -115,7 +115,7 @@ module Haml else @buffer << "\n#{tabs(@real_tabs+1)}#{content}\n#{tabs(@real_tabs)}\n" end - else + elsif !atomic @real_tabs += 1 end end diff --git a/test/haml/engine_test.rb b/test/haml/engine_test.rb index b1850017..6c8d619f 100644 --- a/test/haml/engine_test.rb +++ b/test/haml/engine_test.rb @@ -173,6 +173,10 @@ class EngineTest < Test::Unit::TestCase assert_equal("

\n

\n", render("%p{:a => 'b' + (1 + 1).to_s + 'c'}")) end + def test_dynamic_attrs_with_self_closed_tag + assert_equal("\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}}