Skip to content

Commit

Permalink
Merge branch 'koppor:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
R-Zhou4 authored Oct 24, 2024
2 parents d0fb4da + a94dd11 commit e7a45a6
Show file tree
Hide file tree
Showing 213 changed files with 5,081 additions and 2,132 deletions.
5 changes: 5 additions & 0 deletions .github/ghprcomment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@
message: |
While the PR was in progress, a new version of JabRef has been released.
You have to merge `upstream/main` and move your entry in `CHANGELOG.md` up to the section `## [Unreleased]`.
- jobName: 'Unit tests'
message: |
JUnit tests are failing. In the area "Some checks were not successful", locate "Tests / Unit tests (pull_request)" and click on "Details". This brings you to the test output.
You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section [Final build system checks](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html#final-build-system-checks) in our setup guide.
17 changes: 0 additions & 17 deletions .github/workflows/on-review-submitted.yml

This file was deleted.

13 changes: 11 additions & 2 deletions .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,24 @@ jobs:
PR_NUMBER=$(cat pr_number.txt)
echo "Read PR number $PR_NUMBER"
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
- name: Checkout
- name: Determine owner
if: ${{ steps.read-pr_number.outputs.pr_number != '' }}
id: owner
run: |
owner=$(gh pr view $pr_number --json headRepositoryOwner --jq '.headRepositoryOwner')
echo "Got owner $owner"
echo owner=$owner >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}
- name: Checkout
if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.owner.owner != 'JabRef') }}
uses: actions/checkout@v4
with:
fetch-depth: '0'
show-progress: 'false'
token: ${{ secrets.GITHUB_TOKEN }}
- name: jbang
if: ${{ steps.read-pr_number.outputs.pr_number != '' }}
if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.owner.owner != 'JabRef') }}
uses: jbangdev/jbang-action@v0.119.0
with:
script: ghprcomment@koppor/ghprcomment
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ jobs:
uses: actions/github-script@v7
with:
script: |
core.setFailed('Pull requests should come from a branch other than "main"\n\n👉 Please read https://devdocs.jabref.org/contributing again carefully. 👈')
core.setFailed('Pull requests should come from a branch other than "main"\n\n👉 Please read [the CONTRIBUTING guide](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md#contributing) carefully again. 👈')
upload-pr-number:
runs-on: ubuntu-latest
Expand Down
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
### Added

- We added a "view as BibTeX" option before importing an entry from the citation relation tab. [#11826](https://github.com/JabRef/jabref/issues/11826)
- We added probable search hits instead of exact matches. Sorting by hit score can be done by the new score table column. [#11542](https://github.com/JabRef/jabref/pull/11542)
- We added support finding LaTeX-encoded special characters based on plain Unicode and vice versa. [#11542](https://github.com/JabRef/jabref/pull/11542)
- When a search hits a file, the file icon of that entry is changed accordingly. [#11542](https://github.com/JabRef/jabref/pull/11542)
- We added an AI-based chat for entries with linked PDF files. [#11430](https://github.com/JabRef/jabref/pull/11430)
Expand All @@ -31,25 +30,27 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We added a switch not to store the linked file URL, because it caused troubles at other apps. [#11735](https://github.com/JabRef/jabref/pull/11735)
- When starting a new SLR, the selected catalogs now persist within and across JabRef sessions. [koppor#614](https://github.com/koppor/jabref/issues/614)
- We added support for drag'n'drop on an entry in the maintable to an external application to get the entry preview dropped. [#11846](https://github.com/JabRef/jabref/pull/11846)
- We added the functionality to double click on a [LaTeX citation](https://docs.jabref.org/advanced/entryeditor/latex-citations) to jump to the respective line in the LaTeX editor. [#11996](https://github.com/JabRef/jabref/issues/11996)
- We added a different background color to the search bar to indicate when the search syntax is wrong. [#11658](https://github.com/JabRef/jabref/pull/11658)
- We added a setting which always adds the literal "Cited on pages" text before each JStyle citation. [#11691](https://github.com/JabRef/jabref/pull/11732)
- We added a new plain citation parser that uses LLMs. [#11825](https://github.com/JabRef/jabref/issues/11825)
- We added support for modifier keys when dropping a file on an entry in the main table. [#12001](https://github.com/JabRef/jabref/pull/12001)
- We added an importer for SSRN URLs. [#12021](https://github.com/JabRef/jabref/pull/12021)
- We added a compare button to the duplicates in the citation relations tab to open the "Possible duplicate entries" window. [#11192](https://github.com/JabRef/jabref/issues/11192)
- We added automatic browser extension install on Windows for Chrome and Edge. [#6076](https://github.com/JabRef/jabref/issues/6076)
- We added a search bar for filtering keyboard shortcuts. [#11686](https://github.com/JabRef/jabref/issues/11686)
- By double clicking on a local citation in the Citation Relations Tab you can now jump the linked entry. [#11955](https://github.com/JabRef/jabref/pull/11955)

### Changed

- The search syntax is changed to [Apache Lucene syntax](https://lucene.apache.org/core/9_11_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Overview) (also to be similar to the [online search syntax](https://docs.jabref.org/collect/import-using-online-bibliographic-database#search-syntax)). [#11542](https://github.com/JabRef/jabref/pull/11542/)
- When searching using a regular expression, one needs to enclose the search string in `/`. [#11542](https://github.com/JabRef/jabref/pull/11542/)
- A search in "any" fields ignores the [groups](https://docs.jabref.org/finding-sorting-and-cleaning-entries/groups). [#7996](https://github.com/JabRef/jabref/issues/7996)
- When a communication error with an [online service](https://docs.jabref.org/collect/import-using-online-bibliographic-database) occurs, JabRef displays the HTTP error. [#11223](https://github.com/JabRef/jabref/issues/11223)
- The Pubmed/Medline Plain importer now imports the PMID field as well [#11488](https://github.com/JabRef/jabref/issues/11488)
- The 'Check for updates' menu bar button is now always enabled. [#11485](https://github.com/JabRef/jabref/pull/11485)
- JabRef respects the [configuration for storing files relative to the .bib file](https://docs.jabref.org/finding-sorting-and-cleaning-entries/filelinks#directories-for-files) in more cases. [#11492](https://github.com/JabRef/jabref/pull/11492)
- JabRef does not show finished background tasks in the status bar popup. [#11821](https://github.com/JabRef/jabref/pull/11821)
- We enhanced the indexing speed. [#11502](https://github.com/JabRef/jabref/pull/11502)
- When dropping a file into the main table, after copy or move, the file is now put in the [configured directory and renamed according to the configured patterns](https://docs.jabref.org/finding-sorting-and-cleaning-entries/filelinks#filename-format-and-file-directory-pattern). [#12001](https://github.com/JabRef/jabref/pull/12001)
- ⚠️ Renamed command line parameters `embeddBibfileInPdf` to `embedBibFileInPdf`, `writeMetadatatoPdf` to `writeMetadataToPdf`, and `writeXMPtoPdf` to `writeXmpToPdf`. [#11575](https://github.com/JabRef/jabref/pull/11575)
- The browse button for a Custom theme now opens in the directory of the current used CSS file. [#11597](https://github.com/JabRef/jabref/pull/11597)
- The browse button for a Custom exporter now opens in the directory of the current used exporter file. [#11717](https://github.com/JabRef/jabref/pull/11717)
Expand Down Expand Up @@ -97,11 +98,12 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where recently opened files were not displayed in the main menu properly. [#9042](https://github.com/JabRef/jabref/issues/9042)
- We fixed an issue where the DOI lookup would show an error when a DOI was found for an entry. [#11850](https://github.com/JabRef/jabref/issues/11850)
- We fixed an issue where <kbd>Tab</kbd> cannot be used to jump to next field in some single-line fields. [#11785](https://github.com/JabRef/jabref/issues/11785)
- We fixed an issue where it was not possible to select selecting content of other user's comments.[#11106](https://github.com/JabRef/jabref/issues/11106)
- We fixed an issue where web search preferences "Custom API key" table modifications not discarded. [#11925](https://github.com/JabRef/jabref/issues/11925)
- We fixed an issue where trying to open a library from a failed mounted directory on Mac would cause an error. [#10548](https://github.com/JabRef/jabref/issues/10548)

### Removed

- We removed support for case-sensitive and exact search. [#11542](https://github.com/JabRef/jabref/pull/11542)
- We removed the description of search strings. [#11542](https://github.com/JabRef/jabref/pull/11542)
- We removed support for importing using the SilverPlatterImporter (`Record INSPEC`). [#11576](https://github.com/JabRef/jabref/pull/11576)
- We removed support for automatically generating file links using the CLI (`--automaticallySetFileLinks`).
Expand Down
20 changes: 12 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,22 @@ We reserve the right to reject pull requests that contain little or no genuine a
### After submission of a pull request

After you submitted a pull request, automated checks will run.
You will maybe see "Some checks were not successful".
You may see "Some checks were not successful".
You can click on failing checks to see more information about why they failed.
Then, please look into them and handle accordingly.

Afterwards, you will receive comments on it.
Maybe, the pull request is approved immediatly, maybe changes are requested.
In case changes are requested, please implement them.
Afterwards, you will receive comments on your pull request.
The pull request may be approved immediatly, or a reviewer may request changes.
In that case, please implement the requested changes.

After changing your code, commit on the branch and push.
The pull request will update automatically.
After implementing changes, commit to the branch your pull request is *from* and push.
The pull request will automatically be updated with your changes.
Your commits will also be automatically squashed upon the pull request being accepted.

Never ever close the pull request and open a new one.
This causes much load on our side and is not the style of the GitHub open source community.
Please – **Never ever close a pull request and open a new one** -
This causes unessesary work on our side, and is not in the the style of the GitHub open source community.
You can push any changes you need to make to the branch your pull request is *from*.
These changes will be automatically added to your pull request.

### Development hints

Expand Down
18 changes: 13 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ plugins {

id 'idea'

id 'org.openrewrite.rewrite' version '6.23.4'
id 'org.openrewrite.rewrite' version '6.25.1'

id "org.itsallcode.openfasttrace" version "3.0.0"
id "org.itsallcode.openfasttrace" version "3.0.1"
}

// Enable following for debugging
Expand Down Expand Up @@ -238,7 +238,7 @@ dependencies {
}
implementation 'org.fxmisc.flowless:flowless:0.7.3'
implementation 'org.fxmisc.richtext:richtextfx:0.11.3'
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.58.0') {
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.60.0') {
exclude module: 'javax.inject' // Split package, use only jakarta.inject
exclude module: 'commons-lang3'
exclude group: 'org.apache.commons.validator'
Expand Down Expand Up @@ -304,7 +304,7 @@ dependencies {
// Implementation of the API
implementation 'org.glassfish.jersey.core:jersey-server:3.1.9'
// injection framework
implementation 'org.glassfish.jersey.inject:jersey-hk2:3.1.8'
implementation 'org.glassfish.jersey.inject:jersey-hk2:3.1.9'
implementation 'org.glassfish.hk2:hk2-api:3.1.1'
// testImplementation 'org.glassfish.hk2:hk2-testing:3.0.4'
// implementation 'org.glassfish.hk2:hk2-testing-jersey:3.0.4'
Expand Down Expand Up @@ -370,11 +370,14 @@ dependencies {
// Even if "compileOnly" is used, IntelliJ always adds to module-info.java. To avoid issues during committing, we use "implementation" instead of "compileOnly"
implementation 'io.github.adr:e-adr:2.0.0-SNAPSHOT'

implementation 'io.zonky.test:embedded-postgres:2.0.7'
implementation enforcedPlatform('io.zonky.test.postgres:embedded-postgres-binaries-bom:17.0.0')

testImplementation 'io.github.classgraph:classgraph:4.8.177'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.3'

testImplementation 'org.mockito:mockito-core:5.14.1'
testImplementation 'org.mockito:mockito-core:5.14.2'
testImplementation 'org.xmlunit:xmlunit-core:2.10.0'
testImplementation 'org.xmlunit:xmlunit-matchers:2.10.0'
testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.3.0'
Expand Down Expand Up @@ -793,9 +796,13 @@ jlink {
requires 'org.apache.commons.lang3'
requires 'org.apache.commons.logging'
requires 'org.apache.commons.text'
requires 'org.apache.commons.codec'
requires 'org.apache.commons.io'
requires 'org.apache.commons.compress'
requires 'org.freedesktop.dbus'
requires 'org.jsoup'
requires 'org.slf4j'
requires 'org.tukaani.xz';
uses 'ai.djl.engine.EngineProvider'
uses 'ai.djl.repository.RepositoryFactory'
uses 'ai.djl.repository.zoo.ZooProvider'
Expand All @@ -807,6 +814,7 @@ jlink {
uses 'org.mariadb.jdbc.authentication.AuthenticationPlugin'
uses 'org.mariadb.jdbc.credential.CredentialPlugin'
uses 'org.mariadb.jdbc.tls.TlsSocketPlugin'
uses 'org.postgresql.shaded.com.ongres.stringprep.Profile'

provides 'org.mariadb.jdbc.tls.TlsSocketPlugin' with 'org.mariadb.jdbc.internal.protocol.tls.DefaultTlsSocketPlugin'
provides 'java.sql.Driver' with 'org.postgresql.Driver'
Expand Down
110 changes: 110 additions & 0 deletions docs/decisions/0039-use-apache-velocity-as-template-engine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
nav_order: 39
parent: Decision Records
---

# Use Apache Velocity as template engine

## Context and Problem Statement

We need to choose a template engine for [custom export filters](https://docs.jabref.org/collaborative-work/export/customexports) and [AI features](https://github.com/JabRef/jabref/pull/11884).

A discussion of template engines was also in [one of the JabRef repos](https://github.com/koppor/jabref/issues/392).

A discussion was raised on StackOverflow ["Velocity vs. FreeMarker vs. Thymeleaf"](https://stackoverflow.com/q/1459426/10037342).

## Decision Drivers

* It should be fast.
* It should be possible to provide templates out of `String`s (required by the AI feature).
* It should have short and understandable syntax. Especially, it should work well with unset fields and empty `Optional`s.

## Considered Options

* Apache Velocity
* Apache FreeMarker
* Thymeleaf

## Decision Outcome

Chosen option: "Apache Velocity", because "Velocity's goal is to keep templates as simple as possible" ([source](https://stackoverflow.com/a/1984458/873282)). It is sufficient for our use case.
Furthermore, Apache Velocity is lightweight, and it allows to generate text output. This is a good fit for the AI feature.

## Pros and Cons of the Options

### Apache Velocity

- Main page: <https://velocity.apache.org/>.
- User guide: <https://velocity.apache.org/engine/devel/user-guide.html>.
- Developer guide: <https://velocity.apache.org/engine/devel/developer-guide.html>.

Example:

```text
You are an AI assistant that analyses research papers. You answer questions about papers.
Here are the papers you are analyzing:
#foreach( $entry in $entries )
${CanonicalBibEntry.getCanonicalRepresentation($entry)}
#end
```

* Good, because supports plain text templating.
* Good, because it is possible to use `String` as a template.
* Good, because it has simple syntax, and it is designed for simple template workflows.
* Good, because it has a stable syntax ([source](https://stackoverflow.com/a/1984458/10037342)).
* Bad, because it is in maintenance mode.

### Apache FreeMarker

- Main page: <https://freemarker.apache.org/index.html>.
- User guide: <https://freemarker.apache.org/docs/dgui.html>.
- Developer guide: <https://freemarker.apache.org/docs/pgui_quickstart.html>.

Example:

```text
You are an AI assistant that analyzes research papers. You answer questions about papers.
Here are the papers you are analyzing:
<#list entries as entry>
${CanonicalBibEntry.getCanonicalRepresentation(entry)}
</#list>
```

* Good, because supports plain text templating.
* Good, because it is possible to use `String` as a template.
* Good, because in active development.
* Good, because it is powerful and flexible.
* Good, because it has extensive documentation ([source](https://stackoverflow.com/a/1984458/10037342)).
* Neutral, because it has received some API and syntax changes recently ([source](https://stackoverflow.com/a/1984458/10037342)).
* Neutral, because FreeMarker is used for complex template workflow, which we do not need in JabRef.

### Thymeleaf

- Main page: <https://www.thymeleaf.org/>.
- Documentation: <https://www.thymeleaf.org/doc/tutorials/3.1/usingthymeleaf.html>.

Example:

```text
You are an AI assistant that analyzes research papers. You answer questions about papers.
Here are the papers you are analyzing:
[# th:each="entry : ${entries}"]
[(${CanonicalBibEntry.getCanonicalRepresentation(entry)})]
[/]
```

* Good, because supports plain text templating.
* Good, because it is possible to use `String` as a template.
* Good, because it has [several template modes](https://www.thymeleaf.org/doc/tutorials/3.1/usingthymeleaf.html#what-kind-of-templates-can-thymeleaf-process), that helps to make HTML, XML, and other templates.
* Good, because it is powerful and flexible.
* Neutral, because the API is a bit more complex than the other options.
* Bad, because the syntax is more complex than the other options. Especially for text output.

## More Information

As stated in [the template discussion issue](https://github.com/koppor/jabref/issues/392), we should choose a template engine, and then slowly migrate previous code and templates to the chosen engine.

<!-- markdownlint-disable-file MD004 -->
Loading

0 comments on commit e7a45a6

Please sign in to comment.