-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for issue 1153: Newlines are inserted between anchor tags around images #1158
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very interesting. Basically, someone thought they implemented this feature and didn't. 😱
Please add some more tests - more than two unformatted elements, elements other than <a />
(found at https://github.com/beautify-web/js-beautify/pull/1158/files#diff-e697c50f16270c0b96dcdf2c3cbd79d7L156), similar test inputs when line wrap is enabled, and similar tests when attribute reformatting is enabled (added to the appropriate existing test groups).
I've added some more tests. Also one of the previous tests had a typo of "fragement" instead of "fragment". I don't think it was causing issues, but I've fixed it regardless. |
Github hasn't linked them due to the lack of a # in the title, but this fixes #1153 |
@jhaines - thanks, I'm going to wait a few more days on to merge this, but it looks good to me. |
Has enough time passed? This triggers a minor bug in our editor and it would be nice to have an updated JS Beautifier release to fix it :) |
Fixes failing test because assert-html-equal/js-beautify v1.6.13 fixed newlines bug beautifier/js-beautify#1158
- assert-html-equal/js-beautify v1.6.13 fixed newlines bug when formatting html beautifier/js-beautify#1158 - Test case is actually fixed in `v2` branch of upstream zurb/inky foundation@71bb4e1
The tag variable in this function is presently an array, returned from the match called on the next tag.
Since the Utils.in_array function called on the list of unformatted tags requires a string, we need the second value of the array, which returns the subgroup with the tag name, such as "img" in "<img src="test.jpg" />.