sachin god
sachin god

Reputation: 685

Converting Haml code consisting anchor tag with class names to Html in Rails?

I am having haml page, I need to convert to html page. I am using https://haml2erb.org/ for converting. BUt I can't convert the below code, it is showing error at line: %a.button.dropdown-toggle.on-dark{data: { toggle: 'dropdown' }} This is my code:

.list
  .panel-title
    .primary
      %h2
        {{ title }}
    .wrapper
      .secondary
        .dropdown
          %a.button.dropdown-toggle.on-dark{data: { toggle: 'dropdown' }}
            %fa{name: 'ellipsis-v'}
            %b.caret

Upvotes: 1

Views: 159

Answers (1)

Jon
Jon

Reputation: 10898

It seems that haml2erb struggles with a nested hash for data attributes. This is what it should produce:

<div class="list">
  <div class="panel-title">
    <div class="primary">
      <h2>
        {{ title }}
      </h2>
    </div>  
    <div class="wrapper">
      <div class="secondary">
        <div class="dropdown">
          <a class="button dropdown-toggle on-dark" data-toggle="dropdown">
            <fa name="ellipsis-v"></fa>
            <b class="caret"></b>
          </a>
        </div>
      </div>
    </div>
  </div>
</div>

Upvotes: 1

Related Questions