HTML: Add option to not wrap collapsed tags, and bugfix #1329
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #1304
keep_collapsed_whitespace: true
will keep any tag (TK_TAG_START
orTK_TAG_SINGLE
tokens) from wrapping on a new line if it has another tag (TK_TAG_END
orTK_TAG_SINGLE
tokens) as a direct previous sibling (that is, ifTK_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: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 (liketag\n
)print_newline()
:line_char_count
should be reset to 0 only if wrapping is actually happening