nebulab / erb-formatter

Format ERB files with speed and precision
MIT License
135 stars 22 forks source link

Handle multiline erb comments #21

Open nevans opened 1 year ago

nevans commented 1 year ago

My code base had a few places where html had been temporarily commented out using syntax like so:

<%# See bug #1234
    <tr>
      <td>etc</td>
      <td>etc</td>
      <td>etc</td>
    </tr>
%>

I don't want the comments to be formatted (other than perhaps indentation if they are multiline). But erb-format misinterpreted the comments and seemed to get confused, treating the commented tags as real tags.

nevans commented 1 year ago

My apologies that this is just a simple "post and run" issue. Based on a quick skim of the codebase, I found it quite readable, and I'm sure I could post a PR for this... but I don't have time for it at the moment (and I worked around the issue by simply deleting the comments!)

elia commented 1 year ago

I agree… if you have time to send that PR would be awesome, the starting point would be to adjust the expected output for multiline comments in https://github.com/nebulab/erb-formatter/blob/main/test/fixtures/comments.html.expected.erb