Skip to content

Commit

Permalink
fix #657
Browse files Browse the repository at this point in the history
  • Loading branch information
minad committed Oct 12, 2015
1 parent 1bfcff1 commit 8a4abea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/slim/end_inserter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Slim
#
# @api private
class EndInserter < Filter
IF_RE = /\A(if|unless|else|elsif|when|rescue|ensure)\b|\bdo\s*(\|[^\|]*\|)?\s*$/
IF_RE = /\A(if|begin|unless|else|elsif|when|rescue|ensure)\b|\bdo\s*(\|[^\|]*\|)?\s*$/
ELSE_RE = /\A(else|elsif|when|rescue|ensure)\b/
END_RE = /\Aend\b/

Expand Down
18 changes: 18 additions & 0 deletions test/core/test_code_structure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ def test_render_with_conditional
assert_html '<div><p>The second paragraph</p></div>', source
end

def test_render_with_begin
source = %q{
- if true
- begin
p A
- if true
- begin
p B
- if true
- begin
p C
- rescue
p D
}

assert_html '<p>A</p><p>B</p><p>C</p>', source
end

def test_render_with_consecutive_conditionals
source = %q{
div
Expand Down

0 comments on commit 8a4abea

Please sign in to comment.