Skip to content
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

Merged
merged 7 commits into from
Apr 12, 2017

Conversation

jhaines
Copy link
Contributor

@jhaines jhaines commented Mar 14, 2017

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" />.

Copy link
Member

@bitwiseman bitwiseman left a 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).

@jhaines
Copy link
Contributor Author

jhaines commented Mar 16, 2017

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.

@TheSpyder
Copy link

Github hasn't linked them due to the lack of a # in the title, but this fixes #1153

@bitwiseman
Copy link
Member

@jhaines - thanks, I'm going to wait a few more days on to merge this, but it looks good to me.

@TheSpyder
Copy link

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 :)

@bitwiseman bitwiseman merged commit 3273c6d into beautifier:master Apr 12, 2017
jwgoh added a commit to nugit/inky that referenced this pull request May 2, 2018
Fixes failing test because assert-html-equal/js-beautify v1.6.13 fixed
newlines bug beautifier/js-beautify#1158
jwgoh added a commit to nugit/inky that referenced this pull request May 2, 2018
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants