mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
[Haml] Fix a bug with '- end if foo'.
This commit is contained in:
parent
bbca715be5
commit
13ff32ea74
3 changed files with 22 additions and 1 deletions
|
@ -14,6 +14,9 @@
|
|||
* Add `<code>` to the list of tags that's
|
||||
{file:HAML_REFERENCE.md#preserve-option automatically whitespace-preserved}.
|
||||
|
||||
* Fixed a bug with `end` being followed by code in silent scripts -
|
||||
it no longer throws an error when it's nested beneath tags.
|
||||
|
||||
## [2.2.6](http://github.com/nex3/haml/commit/2.2.6)
|
||||
|
||||
* Made the error message when unable to load a dependency for html2haml
|
||||
|
|
|
@ -228,7 +228,7 @@ END
|
|||
newline_now
|
||||
|
||||
# Handle stuff like - end.join("|")
|
||||
@to_close_stack.first << false if text =~ /^-\s*end\b/ && !block_opened?
|
||||
@to_close_stack.last << false if text =~ /^-\s*end\b/ && !block_opened?
|
||||
|
||||
case_stmt = text =~ /^-\s*case\b/
|
||||
block = block_opened? && !mid_block_keyword?(text)
|
||||
|
|
|
@ -342,6 +342,24 @@ HTML
|
|||
HAML
|
||||
end
|
||||
|
||||
def test_nested_end_with_method_call
|
||||
assert_equal(<<HTML, render(<<HAML))
|
||||
<p>
|
||||
2|3|4
|
||||
b-a-r
|
||||
</p>
|
||||
HTML
|
||||
%p
|
||||
= [1, 2, 3].map do |i|
|
||||
- i + 1
|
||||
- end.join("|")
|
||||
= "bar".gsub(/./) do |s|
|
||||
- s + "-"
|
||||
- end.gsub(/-$/) do |s|
|
||||
- ''
|
||||
HAML
|
||||
end
|
||||
|
||||
def test_silent_end_with_stuff
|
||||
assert_equal(<<HTML, render(<<HAML))
|
||||
e
|
||||
|
|
Loading…
Add table
Reference in a new issue