Skip to content

Commit

Permalink
Fixed an issue with multiline and empty lines.
Browse files Browse the repository at this point in the history
git-svn-id: svn://hamptoncatlin.com/haml/branches/edge@170 7063305b-7217-0410-af8c-cdc13e5119b9
  • Loading branch information
nex3 committed Nov 27, 2006
1 parent 4e64513 commit 6bdf315
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 6 additions & 4 deletions lib/haml/engine.rb
Expand Up @@ -162,7 +162,7 @@ def _haml_render

suppress_render = handle_multiline(old_tabs, old_line, old_index)

if !suppress_render && old_spaces
if !suppress_render
line_empty = old_line.empty?
process_indent(old_tabs, old_line) unless line_empty
flat = @flat_spaces != -1
Expand Down Expand Up @@ -250,6 +250,7 @@ def mid_block_keyword?(line)
# This returns whether or not the line should be
# rendered normally.
def handle_multiline(count, line, index)
suppress_render = false
# Multilines are denoting by ending with a `|` (124)
if is_multiline?(line) && @multiline_buffer
# A multiline string is active, and is being continued
Expand All @@ -264,9 +265,10 @@ def handle_multiline(count, line, index)
suppress_render = true
elsif @multiline_buffer
# A multiline string has just ended, make line into the result
process_line(@multiline_buffer, @multiline_index, count > @multiline_count)
@multiline_buffer = nil
suppress_render = false
unless line.empty?
process_line(@multiline_buffer, @multiline_index, count > @multiline_count)
@multiline_buffer = nil
end
end

return suppress_render
Expand Down
4 changes: 3 additions & 1 deletion test/results/silent_script.xhtml
Expand Up @@ -69,4 +69,6 @@
<strong>2</strong>
<strong>3</strong>
<strong>4</strong>

<div class='test'>
<p>boom</p>
</div>
6 changes: 6 additions & 0 deletions test/templates/silent_script.haml
Expand Up @@ -32,3 +32,9 @@
do |
|a| |
%strong= a
.test
- "foo |
bar |
baz" |

%p boom

0 comments on commit 6bdf315

Please sign in to comment.