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

HTML: Add option to not wrap collapsed tags, and bugfix #1329

Conversation

andreyvolokitin
Copy link
Contributor

See #1304

keep_collapsed_whitespace: true will keep any tag (TK_TAG_START or TK_TAG_SINGLE tokens) from wrapping on a new line if it has another tag (TK_TAG_END or TK_TAG_SINGLE tokens) as a direct previous sibling (that is, if TK_CONTENT between these tokens is empty). For the simplicity, in any other case/token sequence, this option will not take effect, including the following example:

<tag></tag>&nbsp;<tag></tag>

That is, this option won't take effect if TK_CONTENT is a string without whitespace. I am not sure if including this feature may be helpful or not, either way, it can be added later if required. Also, I did not take into account any handlebars content/tokens completely, though probably it would worth investigating, I think it may overcomplicate things...

I also made 2 bugfixes:

  • record_tag(): tag should be trimmed, because sometimes it can contain whitespace (like tag\n)
  • print_newline(): line_char_count should be reset to 0 only if wrapping is actually happening

@bitwiseman
Copy link
Member

@andreyvolokitin - Take a look at the latest release.

@andreyvolokitin
Copy link
Contributor Author

I ran tests from this PR on the latest release with unformatted: [] option, and also with no options, and these tests have failed

@bitwiseman
Copy link
Member

Inline and the new html tokenizer superceeds this. Thanks for contributing. I hope you will do so again in the future.

@bitwiseman bitwiseman closed this Aug 11, 2018
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.

2 participants