Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fix-issue-10124
Browse files Browse the repository at this point in the history
* upstream/main:
  Make generate button wider (JabRef#10588)
  make openRewrite stable again
  Rename cleanup_pr.yml to cleanup-pr.yml
  Changelog
  Fix failing fetcher tests (JabRef#10613)
  ShortDoi
  • Loading branch information
Siedlerchr committed Nov 4, 2023
2 parents b74f5d1 + ec81fc6 commit 08211ef
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 6 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 @@ -19,11 +19,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"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public void setUp() throws Exception {
.withField(StandardField.TITLE, "Multiyear On-Orbit Calibration and Performance of Terra MODIS Reflective Solar Bands")
.withField(StandardField.VOLUME, "45")
.withField(StandardField.YEAR, "2007")
.withField(StandardField.KEYWORDS, "Earth Science")
.withField(StandardField.URL, "https://ui.adsabs.harvard.edu/abs/2007ITGRS..45..879X");

ingersollPollardEntry = new BibEntry(StandardEntryType.Article)
Expand All @@ -125,7 +126,7 @@ public void setUp() throws Exception {
.withField(StandardField.AUTHOR, "Lucey, Paul G. and Blewett, David T. and Jolliff, Bradley L.")
.withField(StandardField.DOI, "10.1029/1999JE001117")
.withField(StandardField.JOURNAL, "\\jgr")
.withField(StandardField.KEYWORDS, "Planetology: Solid Surface Planets: Composition, Planetology: Solid Surface Planets: Remote sensing, Planetology: Solid Surface Planets: Surface materials and properties, Planetology: Solar System Objects: Moon (1221)")
.withField(StandardField.KEYWORDS, "Planetology: Solid Surface Planets: Composition, Planetology: Solid Surface Planets: Remote sensing, Planetology: Solid Surface Planets: Surface materials and properties, Planetology: Solar System Objects: Moon (1221), Earth Science")
.withField(StandardField.PAGES, "20297-20306")
.withField(StandardField.TITLE, "Lunar iron and titanium abundance algorithms based on final processing of Clementine ultraviolet-visible images")
.withField(StandardField.VOLUME, "105")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
import org.apache.lucene.queryparser.flexible.core.QueryNodeParseException;
import org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.mockito.Answers;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@Disabled("https://github.com/JabRef/jabref-issue-melting-pot/issues/259")
@FetcherTest
class CollectionOfComputerScienceBibliographiesFetcherTest {
private CollectionOfComputerScienceBibliographiesFetcher fetcher;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/jabref/logic/net/URLDownloadTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ public void downloadToTemporaryFilePathWithoutFileSavesAsTmpFile() throws IOExce

@Test
public void downloadToTemporaryFileKeepsName() throws IOException {
URLDownload google = new URLDownload(new URL("https://github.com/JabRef/jabref/blob/main/LICENSE.md"));
URLDownload google = new URLDownload(new URL("https://github.com/JabRef/jabref/blob/main/LICENSE"));

String path = google.toTemporaryFile().toString();
assertTrue(path.contains("LICENSE") && path.endsWith(".md"), path);
assertTrue(path.contains("LICENSE"), path);
}

@Test
Expand Down

0 comments on commit 08211ef

Please sign in to comment.