Keep an explicit quote marker from rewriting the shared default. - #145
Merged
Merged
Conversation
`defaultmatch` is a parameter of the outer betweenMatched factory,
captured by the matcher it returns. The matcher assigned to it when
adjusting for an explicit `{` or `}` marker, but the matchers table is
built once at module load, so that binding lives for the lifetime of
the module and the rewrite stuck.
One `"}` therefore flipped left_double_quote to right_double_quote for
every later unmatched `"` -- in the rest of that document, and in every
document parsed afterwards in the same process:
He said "hello"}
Later an unmatched "quote here.
rendered the second paragraph's quote as `”`, though it is unmatched
and renders as `“` when that paragraph is parsed on its own. `{'` does
the same in the other direction, turning later unmatched `'` into `‘`.
Only the quote matchers were affected; every other betweenMatched
caller passes "str", which matches neither /^right/ nor /^left/.
Hoist the adjustment into a local so it applies only to the delimiter
being handled.
Owner
|
good, thanks |
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.
defaultmatchis a parameter of the outer betweenMatched factory, captured by the matcher it returns. The matcher assigned to it when adjusting for an explicit{or}marker, but the matchers table is built once at module load, so that binding lives for the lifetime of the module and the rewrite stuck.One
"}therefore flipped left_double_quote to right_double_quote for every later unmatched"-- in the rest of that document, and in every document parsed afterwards in the same process:rendered the second paragraph's quote as
”, though it is unmatched and renders as“when that paragraph is parsed on its own.{'does the same in the other direction, turning later unmatched'into‘.Only the quote matchers were affected; every other betweenMatched caller passes "str", which matches neither /^right/ nor /^left/.
Hoist the adjustment into a local so it applies only to the delimiter being handled.