Skip to content

Broken by multiline conditional #83

Description

@agrimm

Given the following unusual, but seemingly valid, Erb code:

<% foo = 3 %>
<%
  if foo.even?
    foo = foo * 10
  end
%>
<%= foo %>

(which produces "20" if foo is 2)

the following invalid HAML is generated

- foo = 3
- if foo.even?
- foo = foo * 10
- end
= foo

Which generates the following error message:

You don't need to use "- end" in Haml. Un-indent to close a block:
- if foo?
  %strong Foo!
- else
  Not foo.

The html2haml version was as recent as possible:

GIT
  remote: git://github.com/haml/html2haml.git
  revision: 19cb7fff6fe69a9f3576773a9512322e095efe12
  specs:
    html2haml (2.2.0)
      erubis (~> 2.7.0)
      haml (>= 4.0, < 6)
      nokogiri (>= 1.6.0)
      ruby_parser (~> 3.5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions