Add new stripquoted keyword arg and fix stripwhitespace #112
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.
Fixes #109. As noted in that issue, stripping whitespace within quoted
strings, IMO, should be considered a bug, since one of the primary
reasons for quoting strings in various applications is to delineate the
exact characters that make up the string. This PR fixes
stripwhitespace
to preserve whitepace encountered within strings, andonly strip whitespace for non-quoted strings (leading or trailing) and
leading/trailing around quoted fields.
On the other hand, there are legitimate use-cases for also stripping
whitespace within quoted strings, so we add a new opt-in
stripquoted
keyword argument that allows the additional precision of also stripping
whitespace inside quotes. Note that passing
stripquoted=true
impliesstripwhitespace=true
, so it can be considered a "stronger" version ofstripewhitespace
.