From 76753836d1a497eefed9b2a3508893f5cf0337c5 Mon Sep 17 00:00:00 2001 From: Michel Kraemer Date: Sat, 22 Feb 2020 18:45:12 +0100 Subject: [PATCH 1/7] Update citeproc-java to 2.1.0-SNAPSHOT and enable experimental pure-Java mode --- build.gradle | 2 +- src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index e942fe2262b..c3e36616bb9 100644 --- a/build.gradle +++ b/build.gradle @@ -179,7 +179,7 @@ dependencies { compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT' annotationProcessor group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT' - compile 'de.undercouch:citeproc-java:2.0.0' + compile 'de.undercouch:citeproc-java:2.1.0-SNAPSHOT' compile group: 'jakarta.activation', name: 'jakarta.activation-api', version: '1.2.1' compile group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.2' diff --git a/src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java b/src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java index 5728839efe9..6d34c21c514 100644 --- a/src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java +++ b/src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java @@ -14,6 +14,7 @@ import org.jabref.model.strings.LatexToUnicodeAdapter; import de.undercouch.citeproc.CSL; +import de.undercouch.citeproc.DefaultAbbreviationProvider; import de.undercouch.citeproc.ItemDataProvider; import de.undercouch.citeproc.bibtex.BibTeXConverter; import de.undercouch.citeproc.csl.CSLItemData; @@ -66,7 +67,8 @@ public synchronized List makeBibliography(List bibEntries, Str private void initialize(String newStyle, CitationStyleOutputFormat newFormat) throws IOException { if ((cslInstance == null) || !Objects.equals(newStyle, style)) { // lang and forceLang are set to the default values of other CSL constructors - cslInstance = new CSL(dataProvider, new JabRefLocaleProvider(), newStyle, "en-US", false); + cslInstance = new CSL(dataProvider, new JabRefLocaleProvider(), + new DefaultAbbreviationProvider(), null, newStyle, "en-US", false, true); style = newStyle; } From 3f222be80361fd89780b1612f7f603411503e234 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 24 Feb 2020 17:35:00 +0100 Subject: [PATCH 2/7] Add graal info to module file --- src/main/java/module-info.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index a90f0226983..7dab15387c0 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -61,7 +61,12 @@ requires jbibtex; requires citeproc.java; requires antlr.runtime; - requires org.graalvm.js; + requires org.graalvm.truffle; + requires org.graalvm.sdk; + requires transitive org.graalvm.js; + requires transitive org.graalvm.js.scriptengine; + requires java.scripting; + requires jdk.internal.vm.compiler; requires org.apache.xmpbox; requires de.saxsys.mvvmfx.validation; requires com.google.gson; From ba9e97182a291859cff0c5060c2434a46b988f75 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Mon, 24 Feb 2020 22:20:25 +0100 Subject: [PATCH 3/7] Update module-info.java --- src/main/java/module-info.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 7dab15387c0..6ef392d0005 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -64,7 +64,6 @@ requires org.graalvm.truffle; requires org.graalvm.sdk; requires transitive org.graalvm.js; - requires transitive org.graalvm.js.scriptengine; requires java.scripting; requires jdk.internal.vm.compiler; requires org.apache.xmpbox; From 905e9e8fae69d1684d4b0bd5b6fc4cbffe36b7b6 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 26 Feb 2020 21:00:40 +0100 Subject: [PATCH 4/7] fix loading of CSL styles using correct path --- build.gradle | 2 +- .../logic/citationstyle/CitationStyle.java | 24 ++++++------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 34f78cc4cf3..e361dc84474 100644 --- a/build.gradle +++ b/build.gradle @@ -548,7 +548,7 @@ task deleteInstallerTemp(type: Delete) { jpackage.dependsOn deleteInstallerTemp jlink { - options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] + options = ['--compress', '2', '--no-header-files', '--no-man-pages'] launcher { name = 'JabRef' } diff --git a/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java b/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java index 05285948ccd..8fe2dce3844 100644 --- a/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java +++ b/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java @@ -6,9 +6,6 @@ import java.net.URISyntaxException; import java.net.URL; import java.nio.charset.StandardCharsets; -import java.nio.file.FileSystem; -import java.nio.file.FileSystemAlreadyExistsException; -import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; @@ -25,6 +22,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.jabref.JabRefMain; import org.jabref.logic.util.StandardFileType; import de.undercouch.citeproc.helper.CSLUtils; @@ -138,25 +136,17 @@ public static List discoverCitationStyles() { return STYLES; } - URL url = CitationStyle.class.getResource(STYLES_ROOT); + URL url = JabRefMain.class.getResource("/csl-styles/academy-of-management-review.csl"); + Objects.requireNonNull(url); if (url == null) { return Collections.emptyList(); } try { URI uri = url.toURI(); - if ("jar".equals(uri.getScheme())) { - try (FileSystem fs = FileSystems.newFileSystem(uri, Collections.emptyMap())) { - Path path = fs.getPath(STYLES_ROOT); - STYLES.addAll(discoverCitationStylesInPath(path)); - } catch (FileSystemAlreadyExistsException e) { - try (FileSystem fs = FileSystems.getFileSystem(uri)) { - Path path = fs.getPath(STYLES_ROOT); - STYLES.addAll(discoverCitationStylesInPath(path)); - } - } - } else { - STYLES.addAll(discoverCitationStylesInPath(Paths.get(uri))); - } + Path path = Path.of(uri).getParent(); + + STYLES.addAll(discoverCitationStylesInPath(path)); + return STYLES; } catch (URISyntaxException | IOException e) { LOGGER.error("something went wrong while searching available CitationStyles. Are you running directly from source code?", e); From 452bef6dd52244582bc4d2bf7dd70e82293e71ac Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Wed, 26 Feb 2020 21:48:24 +0100 Subject: [PATCH 5/7] use acm stlye as default --- .../org/jabref/logic/citationstyle/CitationStyle.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java b/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java index 8fe2dce3844..99ddd023239 100644 --- a/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java +++ b/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java @@ -136,11 +136,9 @@ public static List discoverCitationStyles() { return STYLES; } - URL url = JabRefMain.class.getResource("/csl-styles/academy-of-management-review.csl"); + URL url = JabRefMain.class.getResource(STYLES_ROOT + "/acm-siggraph.csl"); Objects.requireNonNull(url); - if (url == null) { - return Collections.emptyList(); - } + try { URI uri = url.toURI(); Path path = Path.of(uri).getParent(); @@ -149,7 +147,7 @@ public static List discoverCitationStyles() { return STYLES; } catch (URISyntaxException | IOException e) { - LOGGER.error("something went wrong while searching available CitationStyles. Are you running directly from source code?", e); + LOGGER.error("something went wrong while searching available CitationStyles", e); return Collections.emptyList(); } } From 139a749cc6c2fdcf7e49f312ee21f5cf85288deb Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 27 Feb 2020 09:02:13 +0100 Subject: [PATCH 6/7] disbale debug mode --- build.gradle | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index e361dc84474..1b69c25572e 100644 --- a/build.gradle +++ b/build.gradle @@ -181,10 +181,8 @@ dependencies { implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT' annotationProcessor group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT' - implementation 'de.undercouch:citeproc-java:2.1.0-SNAPSHOT' - implementation group: 'jakarta.activation', name: 'jakarta.activation-api', version: '1.2.1' implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '2.3.2' implementation group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.3.2' @@ -548,7 +546,7 @@ task deleteInstallerTemp(type: Delete) { jpackage.dependsOn deleteInstallerTemp jlink { - options = ['--compress', '2', '--no-header-files', '--no-man-pages'] + options = ['--strip-debug','--compress', '2', '--no-header-files', '--no-man-pages'] launcher { name = 'JabRef' } From dcf10151c05f128e8e5d87fa6d96220de4109da6 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 27 Feb 2020 09:11:46 +0100 Subject: [PATCH 7/7] add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1477782a160..49dc2aac9bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an issue where changing entry type doesn't always work when biblatex source is shown. [#5905](https://github.com/JabRef/jabref/issues/5905) - We fixed an issue where the group and the link column were not updated after changing the entry in the main table. [#5985](https://github.com/JabRef/jabref/issues/5985) - We fixed an issue where reordering the groups was not possible after inserting an article. [#6008](https://github.com/JabRef/jabref/issues/6008) +- We fixed an issue where citation styles except the default "Preview" could not be used. [#56220](https://github.com/JabRef/jabref/issues/5622) ### Removed