Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape all instances of " in """ delimited literals #17

Merged
merged 1 commit into from Feb 8, 2019

Conversation

no-reply
Copy link
Member

@no-reply no-reply commented Feb 8, 2019

Fixes two bugs associated with """ delimited literals.

First: such literals cannot end with a " (see STRING_LITERAL_LONG_QUOTE at
https://www.w3.org/TR/turtle/#sec-grammar-grammar).

Second: they cannot contain a sequence of three ". The prior .gsub('"""', '\"""') approach addresses this for cases where " appears in multiples of
three, but fails for other cases (e.g. """").

Both bugs are fixed by escaping all " characters.

An alternative addressing only the second bug might be: .gsub('"""', '\""\"'),
which would ensure three quotes aren't ever left in a row.

Closes #16.

Fixes two bugs associated with `"""` delimited literals.

First: such literals cannot end with a `"` (see `STRING_LITERAL_LONG_QUOTE` at
https://www.w3.org/TR/turtle/#sec-grammar-grammar).

Second: they cannot contain a sequence of three `"`. The prior `.gsub('"""',
'\"""')` approach addresses this for cases where `"` appears in multiples of
three, but fails for other cases (e.g. `""""`).

Both bugs are fixed by escaping all `"` characters.

An alternative addressing only the second bug might be: `.gsub('"""', '\""\"')`,
which would ensure three quotes aren't ever left in a row.

Closes #16.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) to 96.279% when pulling 6c90d46 on escape-quotes-in-multi-line into b382c8e on develop.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.08%) to 96.279% when pulling 6c90d46 on escape-quotes-in-multi-line into b382c8e on develop.

@gkellogg
Copy link
Member

gkellogg commented Feb 8, 2019

Thanks Tom, there was a N3 serialization test that prompted the last change, and we may need a further tweak, but let’s go with this for now.

@gkellogg gkellogg merged commit 25bb6c5 into develop Feb 8, 2019
@gkellogg gkellogg deleted the escape-quotes-in-multi-line branch February 8, 2019 23:13
@no-reply
Copy link
Member Author

no-reply commented Feb 9, 2019

Yeah, I'm pretty sure this is an improvement, but I did feel a little anxious that there might be a pile of edge cases.

@no-reply
Copy link
Member Author

no-reply commented Feb 9, 2019

What do you think about a bugfix release with this?

I could probably push one out later tonight or in the morning.

@gkellogg
Copy link
Member

gkellogg commented Feb 9, 2019 via email

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.

Literals delimited with """ are serialized in an invalid format when they end with one or more "
3 participants