Don't trim when migrating review field#3761
Conversation
|
This does not help, because IN THE MIDDLE the newlines are deleted. |
| if (entry.getField(FieldName.COMMENT).isPresent()) { | ||
| LOGGER.info(String.format("Both Comment and Review fields are present in %s! Merging them into the comment field.", entry.getAuthorTitleYear(150))); | ||
| return String.format("%s\n%s:\n%s", entry.getField(FieldName.COMMENT).get().trim(), Localization.lang("Review"), review.trim()); | ||
| return String.format("%s\n%s:\n%s", entry.getField(FieldName.COMMENT).get(), Localization.lang("Review"), review); |
There was a problem hiding this comment.
Maybe, %s does something magic? Or does the get() do magic?
There was a problem hiding this comment.
wow. well I'll write a unit test for that and then we'll see.
There was a problem hiding this comment.
I always forget the specifc string arguments formatter, too
%$1s etc- Maybe that helps?
An argument index is specified as a number ending with a “$” after the “%” and selects the specified argument in the argument list.
https://dzone.com/articles/java-string-format-examples
There was a problem hiding this comment.
No, we just forgot that COMMENT is a mutli line field. We decided two or three years ago that JabRef rewraps all field values to have a good looking bibtex file. We make exceptions for predefined multi line fields. I am working on an update.
|
I reverted the revert of trimming. I think, that is a good thing to do! |
|
I'm approving this as well. Whoever merges, don't squash so @koppor gets credit as well! |
| @@ -28,6 +28,7 @@ public FieldContentParser(FieldContentParserPreferences prefs) { | |||
| multiLineFields = new HashSet<>(); | |||
| // the following two are also coded in org.jabref.logic.bibtex.LatexFieldFormatter.format(String, String) | |||
| multiLineFields.add(FieldName.ABSTRACT); | |||
There was a problem hiding this comment.
Please extract these fields that should be treated as multilines to InternalBibtexFields (or a better location). Moreover, a few places still work with
comments. This should be changed too.
|
I treat this at hotfix. I copied the comment by @tobiasdiez to JabRef#314 |
|
@LinusDietz I used the Co-authored-by: feature: https://github.com/blog/2496-commit-together-with-co-authors |
* upstream/master: (94 commits) Add missing localization for Any file Refactor dublin core utility (#3756) Add Localization Update Architecture Tests to catch static imports (#3766) Added <any file type> to the Import File Filter Dialog. Don't trim when migrating review field (#3761) Reorder again Rename confirmation into "Merge fields" Fix logic Reorder checklist in PR template and add "good commit message" Replace x11 by unity7 Include desktop, desktop-legacy, wayland in snapcraft.yaml Improve Dublin Core (#3710) Incorporate suggestions by @Siedlerchr Update JUnit from 5.1.0-M2 -> 5.1.0 Update Mockito from 2.13.0 -> 2.15.0 Update wiremock from 2.14.0 -> 2.15.0 Fix exceptions for jacoco update gradle Add link to contribute.jabref.org (#3748) ... # Conflicts: # src/main/java/org/jabref/gui/JabRefFrame.java
fixes JabRef#311