-
Notifications
You must be signed in to change notification settings - Fork 8
Update dotstrings parser to handle entries with multi-line values #12
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
Open
fla-t
wants to merge
4
commits into
microsoft:master
Choose a base branch
from
fla-t:flat/support-for-multiline-strings
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b00d8d0
feat: Update dotstrings parser to handle multi-line entries
fla-t 94cef1c
tests: Add tests to make sure that everything is working fine
fla-t 507b8de
suggestion: revert formatting change
fla-t 84ff6d3
revert: keep the dotstring import as is
fla-t File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| "key-case1" = "value | ||
| that | ||
| has | ||
| newlines"; | ||
|
|
||
| "key-case2" = "Major text in one line and just the closing in next line | ||
| "; | ||
|
|
||
| "key-case3" = "A paragraph like text structure | ||
|
|
||
| that goes like this and goes on and on | ||
|
|
||
| and ends here"; |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this will break on strings that contain quotes. e.g.
NSLocalizedString("Hello \"World\"", "Some Comment")gets turned into"Hello \"World\"" = "Hello \"World\"";.I think the second change on this line will also stop the string containing
;.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first change is there so that the first match group doesn't end up matching the whole string (even matching the "value" part).
But yeah it wouldn't work when there are more than two quotes, in the "key" part of the string (the two quotes around the key itself). This was intentional because I didn't thought there would be any "key" that would have more quotes than two.
If we really want to cater keys that have quotes inside of them, we can replicate the regex that we have for value part, but without the semicolon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second change is finding a ";" to match the value part of the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change the test file I have here to contain edge cases?