Repository navigation
Don't insert hard breaks inside multi-line inline HTML tags - #755
Open
Enesuygurs wants to merge 2 commits into
Open
Enesuygurs wants to merge 2 commits into
Enesuygurs wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hard breaks are added with a plain regex over the span text, so a line ending inside an inline HTML tag gets a
<br />too. Withbreak-on-newlinethis happens to any tag whose attributes are split across lines:The browser ends the
<img>at the<br />and showsalt="A cat">as text. Inline links with a wrapped title are affected the same way (title="multi<br />\nline title"), and so are the default two-space breaks when the spaces are inside a tag.The core hard-break substitution and the
breaksextra now share a_do_hard_breakshelper. It swaps tags that contain a newline for placeholders, applies the break regex, and then restores the tags. It uses_sorta_html_tokenize_re, the same approach smarty-pants has used since #735. Single-line tags aren't touched, so theul/ol/lilookahead and everything outside tags behave as before. The extra pass only runs when the text contains both<and a newline.I ran every
.textfile in the test dirs through master and this branch withbreaksin each mode, with and without safe mode, plus a run combined with other extras. Apart from the new cases, the output is identical.I added the
break_on_newline_html_tagsandhard_break_html_tagstest cases, which both fail on master.make testoneandmake testredospass.