Skip to content

better handling of interpolated spans in html (addresses #70)#71

Merged
blake-regalia merged 4 commits intomasterfrom
html-recovery-tweaks
Jul 28, 2019
Merged

better handling of interpolated spans in html (addresses #70)#71
blake-regalia merged 4 commits intomasterfrom
html-recovery-tweaks

Conversation

@bathos
Copy link
Owner

@bathos bathos commented Jul 27, 2019

Two tweaks for the baked-in HTML def used for tagged templates. Even though ${ pops out of HTML, we can still perform a lookahead for it in the HTML def. This lets us make special exceptions that handle real world usage patterns from ES without really giving up on correctness for uninterpolated HTML source.

image

image

It hadn’t occurred to me previously that this was possible. This approach could probably help in a few other places, too (or maybe we’re already doing it elsewhere and I just didn’t notice).

@bathos bathos requested a review from blake-regalia July 27, 2019 04:23
@bathos
Copy link
Owner Author

bathos commented Jul 27, 2019

Oh, derp. This didn’t fix the first case, only the second. Mixed up the tests.

Fixed.

@blake-regalia
Copy link
Collaborator

just ported your edits into the generator until the diffs were the same. Would like to keep this going so that it works in any other case that seems reasonable as well as other syntaxes.

@bathos
Copy link
Owner Author

bathos commented Jul 27, 2019

Ah, didn’t realize that one was being generated. Thanks (I’m still on windows in any case as it turns out).


// If we did not include this case, the ‘<’ would be scoped as ordinary
// chardata.
match: /* syntax: sublime-syntax.regexp */ `(</?)(?=\\$\{)`,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not important, but in case you would prefer not to have to worry about double escaping, you may like one of these alternatives:

match: String.raw /* syntax: sublime-syntax.regexp */ `(</?)(?=\$\{)`,
match: /(<\/?)(?=\$\{)/.source,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

@blake-regalia blake-regalia merged commit c4fe082 into master Jul 28, 2019
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