Nested silent script works.

git-svn-id: svn://hamptoncatlin.com/haml/branches/edge@98 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2006-10-22 19:28:54 +00:00
parent 0105ca02c9
commit 6cee0a2259
5 changed files with 25 additions and 4 deletions

View File

@ -159,12 +159,18 @@ module Haml
@to_close_stack.push '_haml_end_block'
end
elsif count <= @to_close_stack.size && @to_close_stack.size > 0 &&
(line.length == 0 || line[0] != SILENT_SCRIPT || !MID_BLOCK_KEYWORDS.include?(line[1..-1].split[0]))
elsif count <= @to_close_stack.size && @to_close_stack.size > 0
# The tabulation has gone down, and it's not because of one of
# Ruby's mid-block keywords
(@to_close_stack.size - count).times { close }
to_close = @to_close_stack.size - count
to_close.times do |i|
offset = to_close - 1 - i
unless offset == 0 && line.length > 2 && line[0] == SILENT_SCRIPT &&
MID_BLOCK_KEYWORDS.include?(line[1..-1].split[0])
close
end
end
end
if line.length > 0

View File

@ -1,3 +1,4 @@
! Not a Doctype !
<ul>
<li>a</li>
<li>b</li>

View File

@ -55,4 +55,9 @@
"false" is:
false
</p>
Even!
Odd!
Even!
Odd!
Even!
</div>

View File

@ -1,3 +1,4 @@
! Not a Doctype !
%ul
%li a
%li b

View File

@ -17,3 +17,11 @@
= "true"
- else
= "false"
- if true
- 5.times do |i|
- if i % 2 == 1
Odd!
- else
Even!
- else
= "This can't happen!"