ippachi / prettier-plugin-eruby

2 stars 0 forks source link

Tags with <%- or -%> not handled #1

Open studious opened 3 weeks ago

studious commented 3 weeks ago

I can successfully run this plugin on some templates but not others

After looking at the source I figured it might be that the trimming notation on tags hasn't been catered for

https://www.puppet.com/docs/puppet/5.5/lang_template_erb#tags

ippachi commented 3 weeks ago

I can't reproduce. Could you give me not working erb file?

studious commented 3 weeks ago

Oh before I forget, your install instruction seems to reference a misspelled version of your npm package. I had to search for it on the npm registry even though your prettierrc snippet listed it correctly.

Onto the parsing issue. Here is the smallest reproducible portion that caused the error I was seeing.

<%- if !!flash[:errors] %>
  <%- flash[:errors].each do |error| %>
    <p style="color: red"><%= error %></p>
  <% end -%>
<% end -%>

You can see two attempts in my screenshot below.

  1. Attempt using the code block as seen above
  2. Attempt after removing the - from the erb start and end tags.
Screenshot 2024-06-11 at 9 18 52 AM