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

why it broke the indentation when I put erb inside div attributes? #55

Closed buncis closed 3 years ago

buncis commented 3 years ago

what I get

  <div data-controller="autocomplete influencer-field" data-autocomplete-url-value=<%= search_influencers_path %> style="display: inline-block">
    <%= form.label :name, "name" %>
    <input type="text" data-action="influencer-field#syncInput" data-influencer-field-target="input" data-autocomplete-target="input" value='<%= params[:name] %>'/>
  <%= form.hidden_field :name, value: params[:name], data: {"autocomplete-target": "hidden", "influencer-field-target": "hidden"} %>
  <ul data-autocomplete-target="results"></ul>
</div>

what I expected

  <div data-controller="autocomplete influencer-field" data-autocomplete-url-value=<%= search_influencers_path %> style="display: inline-block">
    <%= form.label :name, "name" %>
    <input type="text" data-action="influencer-field#syncInput" data-influencer-field-target="input" data-autocomplete-target="input" value='<%= params[:name] %>'/>
    <%= form.hidden_field :name, value: params[:name], data: {"autocomplete-target": "hidden", "influencer-field-target": "hidden"} %>
    <ul data-autocomplete-target="results"></ul>
  </div>

I wondering in somefiles the < broke the indentation but somefiles not

buncis commented 3 years ago

I think its because trailing / on the input tag