From 14c04240e460fec32b5a3e01dbbc429da92bfb32 Mon Sep 17 00:00:00 2001 From: tom Date: Fri, 13 Jul 2007 04:39:13 +0000 Subject: [PATCH] Simply push_text now that it doesn't have to deal with one liners. Extra test to make sure one liner related stuff is getting done. git-svn-id: svn://hamptoncatlin.com/haml/trunk@558 7063305b-7217-0410-af8c-cdc13e5119b9 --- lib/haml/buffer.rb | 17 +++++------------ test/haml/engine_test.rb | 4 ++++ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/haml/buffer.rb b/lib/haml/buffer.rb index 3621b5de..67e0aea1 100644 --- a/lib/haml/buffer.rb +++ b/lib/haml/buffer.rb @@ -43,19 +43,12 @@ module Haml # Renders +text+ with the proper tabulation. This also deals with # making a possible one-line tag one line or not. def push_text(text, tab_change = 0, try_one_liner = false) - if @one_liner_pending && Buffer.one_liner?(text) - @buffer << text - else - if @one_liner_pending - @buffer << "\n" - @one_liner_pending = false - end - if(@tabulation > 0) - text.gsub!(/^/m, ' ' * @tabulation) - end - - @buffer << "#{text}" + if(@tabulation > 0) + # Have to push every line in by the extra user set tabulation + text.gsub!(/^/m, ' ' * @tabulation) end + + @buffer << "#{text}" @real_tabs += tab_change @one_liner_pending = try_one_liner end diff --git a/test/haml/engine_test.rb b/test/haml/engine_test.rb index b417c663..382d6712 100644 --- a/test/haml/engine_test.rb +++ b/test/haml/engine_test.rb @@ -45,6 +45,10 @@ class EngineTest < Test::Unit::TestCase def test_long_liner_should_not_print_on_one_line assert_equal("
\n #{'x' * 51}\n
", render("%div #{'x' * 51}").chomp) end + + def test_non_prerendered_one_liner + assert_equal("

One line

\n", render("%p{:class => c} One line", :locals => {:c => 'awesome'})) + end def test_multi_render engine = Haml::Engine.new("%strong Hi there!")