Skip to content

Commit

Permalink
Merge branch 'JabRef:main' into fix-for-issue-10509
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn-jj authored Nov 3, 2023
2 parents eef105a + ec81fc6 commit c12cd63
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 3 deletions.
File renamed without changes.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We moved the location of the 'Open only one instance of JabRef' preference option from "Network" to "General". [#9306](https://github.com/JabRef/jabref/issues/9306)
- The two previews in the change resolver dialog now have their scrollbars synchronized. [#9576](https://github.com/JabRef/jabref/issues/9576).
- We changed the setting of the keyword separator to accept a single character only. [#177](https://github.com/koppor/jabref/issues/177)
- Short DOI formatter now checks, if the value is already formatted. If so, it returns the value instead of calling the ShortDOIService again. [#10589](https://github.com/JabRef/jabref/issues/10589)

### Fixed

- We fixed an issue where the added protected term has unwanted leading and trailing whitespaces, where the formatted text has unwanted empty brackets and where the word at the cursor in the textbox can be added to the list. [#10415](https://github.com/JabRef/jabref/issues/10415).
- We fixed an issue where the added protected term has unwanted leading and trailing whitespaces, where the formatted text has unwanted empty brackets and where the word at the cursor in the textbox can be added to the list. [#10415](https://github.com/JabRef/jabref/issues/10415)
- We fixed an issue where in the merge dialog the file field of entries was not correctly merged when the first and second entry both contained values inside the file field. [#10572](https://github.com/JabRef/jabref/issues/10572)
- We fixed some small inconsistencies in the user interface. [#10507](https://github.com/JabRef/jabref/issues/10507)

### Removed

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ dependencies {
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '3.0.2'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '3.0.2'

rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:latest.integration"))
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.4.1"))
rewrite("org.openrewrite.recipe:rewrite-static-analysis")
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks")
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks")
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1447,3 +1447,8 @@ We want to have a look that matches our icons in the tool-bar */
.table-column .rotated > .label {
-fx-content-display: graphic-only;
}

.customGenerateButton {
-fx-padding: 0.5em 2em;
-fx-min-width: 10em;
}
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/EntryTypeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public EntryTypeView(LibraryTab libraryTab, DialogService dialogService, Prefere
});

Button btnGenerate = (Button) this.getDialogPane().lookupButton(generateButton);
btnGenerate.getStyleClass().add("customGenerateButton");

btnGenerate.textProperty().bind(EasyBind.map(viewModel.searchingProperty(), searching -> searching ? Localization.lang("Searching...") : Localization.lang("Generate")));
btnGenerate.disableProperty().bind(viewModel.idFieldValidationStatus().validProperty().not().or(viewModel.searchingProperty()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.jabref.logic.formatter.bibtexfields;

import java.util.Objects;
import java.util.function.Predicate;
import java.util.regex.Pattern;

import org.jabref.logic.cleanup.Formatter;
import org.jabref.logic.importer.util.ShortDOIService;
Expand All @@ -14,6 +16,7 @@
public class ShortenDOIFormatter extends Formatter {

private static final Logger LOGGER = LoggerFactory.getLogger(ShortenDOIFormatter.class);
private static final Predicate<String> SHORT_DOI_FORMAT = Pattern.compile("^10/[a-zA-Z0-9]+$").asPredicate();

@Override
public String getName() {
Expand All @@ -28,7 +31,7 @@ public String getKey() {
@Override
public String format(String value) {
Objects.requireNonNull(value);
return DOI.parse(value)
return SHORT_DOI_FORMAT.test(value) ? value : DOI.parse(value)
.map(doi -> {
try {
return new ShortDOIService().getShortDOI(doi).getDOI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ public void formatDoi() {
public void invalidDoiIsKept() {
assertEquals("invalid-doi", formatter.format("invalid-doi"));
}

@Test
public void shortDoi() {
assertEquals("10/adc", formatter.format("10/adc"));
}
}

0 comments on commit c12cd63

Please sign in to comment.