-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add recovery method to solve unbalanced brackets #14488
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
base: main
Are you sure you want to change the base?
Changes from 11 commits
1f5e19c
f4ba7ba
f32fe49
317449a
225e9fd
0503dab
301ffa7
831c444
ffa7529
08b14a5
9129e37
be01642
1c70dd2
161d9ae
ad64562
ede48b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2247,4 +2247,38 @@ void parseInvalidBibDeskFilesResultsInWarnings() throws IOException { | |
|
|
||
| assertEquals(List.of(firstEntry, secondEntry), result.getDatabase().getEntries()); | ||
| } | ||
|
|
||
| @Test | ||
| public void unmatchedBracketsDoesNotStopParsing() throws Exception { | ||
| String entries = """ | ||
| @Article{ok1, | ||
| title = {AAA}, | ||
| } | ||
|
|
||
| @Article{bad, | ||
| title = {accuracy by 3 to 15{{\\%}. | ||
| } | ||
|
Comment on lines
2258
to
2260
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is lost. - can it recovered partially?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My rescue is always to put the thing in the "comment" field of a new entry. - I am not sure at which point escapings should be done. The other alternative is to copy the whole string as user comment to the next entry - usercomment is the part above |
||
|
|
||
| @Article{ok2, | ||
| title = {BBB}, | ||
| } | ||
| """; | ||
|
|
||
| ParserResult result = parser.parse(Reader.of(entries)); | ||
| BibDatabase database = result.getDatabase(); | ||
| List<BibEntry> entryList = database.getEntries(); | ||
|
|
||
| BibEntry firstEntry = new BibEntry(StandardEntryType.Article) | ||
| .withCitationKey("ok1") | ||
| .withField(StandardField.TITLE, "AAA"); | ||
|
|
||
| BibEntry secondEntry = new BibEntry(StandardEntryType.Article) | ||
| .withCitationKey("ok2") | ||
| .withField(StandardField.TITLE, "BBB"); | ||
|
|
||
| assertEquals( | ||
| List.of(firstEntry, secondEntry), | ||
| result.getDatabase().getEntries() | ||
| ); | ||
| } | ||
| } | ||

Uh oh!
There was an error while loading. Please reload this page.