Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update citeproc-java to 2.1.0-SNAPSHOT and enable experimental pure-Java mode #5997

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/logic/citationstyle/CSLAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -66,7 +67,8 @@ public synchronized List<String> makeBibliography(List<BibEntry> 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Does CSL also provide a builder pattern (see https://github.com/HugoMatilla/Effective-JAVA-Summary#2-use-builders-when-faced-with-many-constructors). Passing "null" and "false" and "true" is wired ^^.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Actually, almost all classes from citeproc-java provide a Builder except for the most important one 😂I'll add this in the next version.

style = newStyle;
}

Expand Down