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

Allow for angular expressions #21

Closed mkozono closed 9 years ago

mkozono commented 9 years ago

First of all, thank you for maintaining this project, I ran it on a large set of files and it worked great for getting everything consistent again (it successfully beautified over 400 files).

However, I had to make a change to get it to not raise an error for a few Angular templates we have. This change didn't affect the beautifier's behavior on our other ~400 files.

Please let me know if I'm going about this appropriately, I've only ever PR'd typos. Thanks!

threedaymonk commented 9 years ago

Thanks for this. 65ff462 needed fixing anyway, so I'll cherry-pick that straight away.

You've fixed your specific problem of using < in an attribute, but it ought also to be possible to use > in a double-quoted string, which will be very difficult with this parser. Maybe it's time to rewrite it with something more robust.

threedaymonk commented 9 years ago

I take that back! ng-show="foo > 1" does work.

mkozono commented 9 years ago

:) I neglected to mention that that worked without needing a fix

threedaymonk commented 9 years ago

Merged in e9fd433. I moved the ng-show sample into behavior_spec.rb and wrote a couple of specs there instead, as I felt that explained itself a bit better.

Thank you!

mkozono commented 9 years ago

Yeah, I was unsure about my change to the test. I agree that's clearer. Thanks for getting this in so quickly!

threedaymonk commented 9 years ago

Released 1.0.2.