threedaymonk / htmlbeautifier

A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.
MIT License
325 stars 59 forks source link

Problem of beautifier handlebars inside html #11

Closed EJIqpEP closed 9 years ago

EJIqpEP commented 9 years ago

As you can see when I use handlebars inside html htmlbeautifier position correctly only html tags, but not handlebars. All handlebars tags are inline. What you can suggest?

  <script type="text/x-handlebars" data-template-name="lists">
    <section id="lists-container" class="lists-container">
      <div class="row">
        {{#each controller itemController="list"}}
        <section class="list list-inline">
          <h1>{{listName}}</h1> {{#each card in cards itemController="card"}}
          <div class="card">
            {{#if isEditing}} {{ view App.EditCardView }} {{else}}
            <label>{{card.description}}</label>
            <div class="edit-small edit-card hand" {{action "editCard" on="click" }}>Edit</div>
            <div {{action "deleteCard" card}} class="remove-small remove-card hand">X</div>
            {{/if}}
          </div>
          {{/each}}
          <a {{action "removeList"}} class="hand">
            <div class="remove remove-list">X</div>
          </a>
          <section class="new-card">
            {{input type="text" value=cardDescription action="createCard" class="card-input" placeholder="New Card"}}
          </section>
        </section>
        {{/each}}
        <section class="list new-list list-inline">
          {{input type="text" value=listName action="createList" id="new-list" class="list-input" placeholder="New List"}}
        </section>
      </div>
    </section>
  </script>
threedaymonk commented 9 years ago

Well, it doesn't know anything about Handlebars. If you're interested in adding support, you could look at html_parser.rb and builder.rb, and I'd happily accept any such contributions.

However, supporting Handlebars is outside the scope of this project as it's currently defined.