Handle invalid escaped quotes in tags more gracefully #1098
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.
Don't break the entire parsing of the template afterwards by treating escaped quotes which aren't already in quotes as not being quotes.
This means that a token like the following would break the rest of the template:
{% print \"foo\" %}
. This is because the initial slash currently does not get treated as escaping the double quote so the token scanner will think that it is inside of quotes.In this example:
The scanner currently will parse tokens like the following:
{% print \"foo\" %} I am "hungry" {% print 'x' %} " {% print 'y' %}
<- this token is broken and won't render properly"
{% print 'z' %}
But with this change it will parse like:
{% print \"foo\" %}
<- this token is broken and won't render properlyI am "hungry"
{% print 'x' %}
"
{% print 'y' %}
"
{% print 'z' %}
Essentially it limits the scope of the broken token down to just affecting the token which is broken.