Refactor writing of bib files#1472
Merged
Merged
Conversation
3 tasks
Member
Author
|
Any comments? Can I merge this in (of course after fixing compile errors)? |
| List<FieldChange> changes = new ArrayList<>(); | ||
|
|
||
| Optional<FieldFormatterCleanups> saveActions = metaData.getSaveActions(); | ||
| if (saveActions.isPresent()) { |
Member
There was a problem hiding this comment.
Maybe use the lambda version: ifPresent
Member
Author
There was a problem hiding this comment.
Yeah, but I find the old-style version more readable.
Contributor
There was a problem hiding this comment.
Optional only make sense if one uses ifPresent or map/flatMap. Otherwise, it does not really help that much, from my perspective, as one still requires an if check and a get, making it even more complicated to use instead of a null check and just using it.
Member
|
Overall looks good, just some small remarks from my side 👍 |
1f5a31d to
892c593
Compare
Member
Author
|
@Siedlerchr Thanks for you feedback. Incorporated it and rebased. |
| * (such as the exportDatabase call), we do not wish to use the | ||
| * global preference of saving in standard order. | ||
| */ | ||
| * We have begun to use getSortedEntries() for both database save operations |
Contributor
|
@tobiasdiez after rebase and successful tests, this can be merged as well. |
- Abstract class BibDatabaseWriter, which controls the generic things of writing a database (i.e. sorting entries, applying save actions, some basic conversations, ...) - Derived class BibtexDatabaseWriter, which only contains logic how to actually write to in BibTeX format (should be simple to write similar classes for other export formats like ris) - Make SaveSession abstract and introduce two implementations which write to a temporary file (FileSaveSession) or two a string/buffer (StringSaveSession) - Move code related to lock files to FileBasedLock
a00f7ac to
013c27c
Compare
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.
The main aim of this PR is to simplify the implementation of #1451 (sql export) and other exporters.
writing a database (i.e. sorting entries, applying save actions, some
basic conversations, ...)
actually write to in BibTeX format (should be simple to write similar
classes for other export formats like ris)
write to a temporary file (FileSaveSession) or two a string/buffer
(StringSaveSession)