Skip to content

Added "DOI" and URL to entry preview [#14193]#15121

Merged
Siedlerchr merged 11 commits intoJabRef:mainfrom
ustmd:fix-for-issue-14193
Feb 20, 2026
Merged

Added "DOI" and URL to entry preview [#14193]#15121
Siedlerchr merged 11 commits intoJabRef:mainfrom
ustmd:fix-for-issue-14193

Conversation

@ustmd
Copy link
Copy Markdown
Contributor

@ustmd ustmd commented Feb 15, 2026

Related issues and pull requests

Closes #14193

PR Description

I've added a "DOI" replacement if entry preview has default value. Added tests to check the merge.

Screenshots:

image image

Steps to test

  1. Reset custom preview style to default
  2. Remove "doi" string
  3. Save
  4. Restart app
  5. Check "DOI" was added

Checklist

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef
  • I added JUnit tests for changes
  • I added screenshots in the PR description
  • I added a screenshot in the PR description showing a library with a single entry with me as author and as title the issue number
  • I described the change in CHANGELOG.md in a way that can be understood by the average user
  • I checked the user documentation

@github-actions
Copy link
Copy Markdown
Contributor

Hey @cursedesigner! 👋

Thank you for contributing to JabRef!

We have automated checks in place, based on which you will soon get feedback if any of them are failing. We also use Qodo for review assistance. It will update your pull request description with a review help and offer suggestions to improve the pull request.

After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs. You can read about the whole pull request process in our contribution guide.

Please ensure that your pull request is in line with our AI Usage Policy and make necessary disclosures.

@github-actions github-actions Bot added first contrib status: changes-required Pull requests that are not yet complete labels Feb 15, 2026
@ustmd ustmd marked this pull request as ready for review February 15, 2026 20:54
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add DOI field to default entry preview style

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Added DOI field display to default entry preview style
• Implemented migration to inject DOI section into existing preview layouts
• Added test coverage for preview style migration with DOI field
• Updated changelog with feature documentation
Diagram
flowchart LR
  A["Default Preview Style"] -->|Add DOI section| B["Updated Preview Template"]
  C["Existing Preview Layouts"] -->|Migration: inject DOI| D["Migrated Layouts with DOI"]
  B -->|Applied to| E["Entry Preview Display"]
  D -->|Applied to| E
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java ✨ Enhancement +1/-0

Add DOI section to default preview template

• Added DOI field rendering to the default preview style template
• Displays DOI as a clickable link using https://doi.org/ URL format
• Uses DOIStrip formatter to clean the DOI value for display

jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java


2. jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java ✨ Enhancement +3/-2

Implement preview style migration for DOI field

• Modified upgradePreviewStyle() to normalize newlines in preview style strings
• Added migration rule to inject DOI section into existing preview layouts
• Inserts DOI field between pages and abstract sections
• Handles both new installations and existing user preferences

jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java


3. jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java 🧪 Tests +7/-2

Update preview style migration test with DOI

• Updated previewStyleReviewToComment() test to include pages and abstract sections
• Added verification that DOI field is correctly injected during migration
• Validates the complete migration path from old to new preview style format

jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java


View more (1)
4. CHANGELOG.md 📝 Documentation +1/-0

Document DOI preview feature addition

• Added entry documenting the new DOI field feature in entry preview
• References issue #14193 for tracking purposes

CHANGELOG.md


Grey Divider

Qodo Logo

@koppor koppor marked this pull request as draft February 15, 2026 20:54
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

qodo-free-for-open-source-projects Bot commented Feb 15, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment thread jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java Outdated
Comment thread jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java Outdated
Comment thread jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java Outdated
Comment thread jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java Outdated
@Siedlerchr
Copy link
Copy Markdown
Member

looks good already on a first look

@testlens-app
Copy link
Copy Markdown

testlens-app Bot commented Feb 15, 2026

✅ All tests passed ✅

🏷️ Commit: bd6d43b
▶️ Tests: 11193 executed
⚪️ Checks: 51/51 completed


Learn more about TestLens at testlens.app.

@ustmd
Copy link
Copy Markdown
Contributor Author

ustmd commented Feb 15, 2026

in my opinion, everything works fine, but I don’t understand why in
org.jabref.migrations.PreferencesMigrations#upgradePreviewStyle

prefs.get(JabRefGuiPreferences.PREVIEW_STYLE) return a value where "__NEWLINE__" has already been replaced with "\n"

then during the next migration step we replace values that store "__NEWLINE__", not "\n"

to fix this, I added a .replace("\n", "__NEWLINE__") call, but I think this might be wrong

image there is not a single "\_\_NEWLINE\_\_" in the `currentPreviewStyle`

@Siedlerchr
Copy link
Copy Markdown
Member

I will try to look into it tomorrow

@koppor
Copy link
Copy Markdown
Member

koppor commented Feb 16, 2026

prefs.get(JabRefGuiPreferences.PREVIEW_STYLE) return a value where "NEWLINE" has already been replaced with "\n"

You could dig into with git blame and think why some changes have been introduced. This is, what I would do.

@github-actions github-actions Bot added status: no-bot-comments and removed status: changes-required Pull requests that are not yet complete labels Feb 17, 2026
@ustmd ustmd marked this pull request as ready for review February 17, 2026 20:55
@koppor koppor marked this pull request as draft February 17, 2026 20:56
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add DOI field to default entry preview style

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add DOI field display to default entry preview style
• Implement automatic migration for existing custom preview styles
• Include DOI formatting with clickable link to doi.org
• Add comprehensive test coverage for preview style migration
Diagram
flowchart LR
  A["Default Preview Style"] -->|Add DOI section| B["Updated Preview with DOI"]
  C["Custom Preview Styles"] -->|Migration Logic| D["Migrated with DOI"]
  B -->|Display in UI| E["Entry Preview"]
  D -->|Display in UI| E
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java ✨ Enhancement +1/-0

Add DOI field to default preview template

• Added DOI field rendering to the default preview style template
• Includes formatted DOI with clickable link to doi.org using DOIStrip formatter
• Positioned between pages and abstract sections in preview layout

jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java


2. jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java ✨ Enhancement +3/-2

Implement preview style migration for DOI field

• Modified upgradePreviewStyle() to normalize newlines in preview styles
• Added migration rule to inject DOI section into existing custom preview styles
• Ensures backward compatibility by inserting DOI between pages and abstract sections
• Handles both default and custom preview style configurations

jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java


3. jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java 🧪 Tests +7/-2

Update preview style migration test coverage

• Updated previewStyleReviewToComment() test with pages and abstract sections
• Added expected DOI section to migrated preview style output
• Validates that DOI field is correctly inserted during migration process
• Ensures migration preserves existing content while adding new DOI section

jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java


View more (1)
4. CHANGELOG.md 📝 Documentation +1/-0

Document DOI preview feature addition

• Added entry documenting the new DOI field feature in entry preview
• References issue #14193 for tracking purposes

CHANGELOG.md


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 2baa92b

@ustmd ustmd changed the title feat: added "DOI" replace if entry preview has default value Added "DOI" and URL to entry preview Feb 18, 2026
@ustmd ustmd marked this pull request as ready for review February 18, 2026 22:00
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add DOI and URL fields to entry preview with migration support

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Added DOI and URL fields to default entry preview layout
• Implemented automatic migration for existing custom preview styles
• Added test coverage for preview style migration scenarios
• Updated CHANGELOG with feature description

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java ✨ Enhancement +2/-0

Add DOI and URL to default preview layout

• Added DOI field with clickable link to doi.org using DOIStrip formatter
• Added URL field with clickable hyperlink
• Both fields inserted before abstract section in default preview layout

jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java


2. jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java ✨ Enhancement +6/-2

Implement preview style migration for DOI and URL

• Modified upgradePreviewStyle method to normalize newlines to __NEWLINE__ tokens
• Added migration pattern to inject DOI and URL fields into existing preview styles
• Handles insertion between pages and abstract sections for backward compatibility

jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java


3. jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java 🧪 Tests +25/-2

Add tests for preview style migration scenarios

• Updated existing previewStyleReviewToComment test to include DOI and URL in expected output
• Added new test previewStyleUnchangedWhenMigrationPatternIsMissing to verify migration doesn't
 affect styles without migration patterns
• Ensures backward compatibility for custom preview styles

jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java


View more (1)
4. CHANGELOG.md 📝 Documentation +1/-0

Document DOI and URL preview feature

• Added entry documenting the new DOI and URL preview fields feature
• References issue #14193

CHANGELOG.md


Grey Divider

Qodo Logo

@koppor koppor marked this pull request as draft February 18, 2026 22:00
@ustmd ustmd changed the title Added "DOI" and URL to entry preview Added "DOI" and URL to entry preview [#14193] Feb 18, 2026
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit a30142d

Comment thread jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java Outdated
@koppor koppor marked this pull request as draft February 20, 2026 14:39
Siedlerchr
Siedlerchr previously approved these changes Feb 20, 2026
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 10f859c

Comment on lines +282 to +283
"\\begin{doi}<BR>doi <a href=\"https://doi.org/\\format[DOIStrip]{\\doi}\">\\format[DOIStrip]{\\doi}</a>\\end{doi}__NEWLINE__" +
"\\begin{url}<BR>URL <a href=\"\\url\">\\url</a>\\end{url}__NEWLINE__" +
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

1. Url block text mismatches patch 📎 Requirement gap ✓ Correctness

The added URL block uses the label URL instead of the required patch text (doi in the URL block
as specified), so the default preview style does not match the mandated formatting. This can lead to
non-compliant rendering relative to the specified patch content.
Agent Prompt
## Issue description
The default preview style URL block content does not match the exact DOI+URL patch text required by the compliance checklist.

## Issue Context
The compliance requirement expects the default preview style in `JabRefGuiPreferences` to include DOI and URL blocks consistent with the ticket-provided patch.

## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java[282-283]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +83 to 104
String oldPreviewStyle = """
<font face="sans-serif">__NEWLINE__\
Customized preview style using reviews and comments:__NEWLINE__\
\\begin{review}<BR><BR><b>Review: </b> \\format[HTMLChars]{\\review} \\end{review}__NEWLINE__\
\\begin{comment} Something: \\format[HTMLChars]{\\comment} special \\end{comment}__NEWLINE__\
</font>__NEWLINE__\
\\begin{pages}<BR> p. \\format[FormatPagesForHTML]{\\pages}\\end{pages}__NEWLINE__\
\\begin{abstract}<BR><BR><b>Abstract: </b>\\format[HTMLChars]{\\abstract} \\end{abstract}__NEWLINE__""";

String newPreviewStyle = """
<font face="sans-serif">__NEWLINE__\
Customized preview style using reviews and comments:__NEWLINE__\
\\begin{comment}<BR><BR><b>Comment: </b> \\format[Markdown,HTMLChars(keepCurlyBraces)]{\\comment} \\end{comment}__NEWLINE__\
\\begin{comment} Something: \\format[Markdown,HTMLChars(keepCurlyBraces)]{\\comment} special \\end{comment}__NEWLINE__\
</font>__NEWLINE__\
\\begin{pages}<BR> p. \\format[FormatPagesForHTML]{\\pages}\\end{pages}__NEWLINE__\
\\begin{doi}<BR>doi <a href="https://doi.org/\\format[DOIStrip]{\\doi}">\\format[DOIStrip]{\\doi}</a>\\end{doi}__NEWLINE__\
\\begin{url}<BR>URL <a href="\\url">\\url</a>\\end{url}__NEWLINE__\
\\begin{abstract}<BR><BR><b>Abstract: </b>\\format[HTMLChars]{\\abstract} \\end{abstract}__NEWLINE__""";

when(preferences.get(JabRefGuiPreferences.PREVIEW_STYLE)).thenReturn(oldPreviewStyle);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

2. Tests miss \end{doi} case 📎 Requirement gap ⛯ Reliability

The added/updated tests validate migration behavior around \end{pages}__NEWLINE__\begin{abstract}
and a non-matching case, but they do not cover the required matching trigger
\end{doi}\n\begin{abstract}. This leaves the mandated conditional migration behavior unverified
and risks regressions.
Agent Prompt
## Issue description
The migration tests do not verify the required conditional trigger based on `\\end{doi}` followed by a newline and then `\\begin{abstract}`.

## Issue Context
Compliance requires coverage for both:
- matching `\\end{doi}\\n\\begin{abstract}` (migration inserts DOI+URL patch)
- non-matching variants (migration leaves preview unchanged)

## Fix Focus Areas
- jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java[83-126]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@github-actions github-actions Bot added status: no-bot-comments and removed status: changes-required Pull requests that are not yet complete labels Feb 20, 2026
@Siedlerchr Siedlerchr marked this pull request as ready for review February 20, 2026 15:00
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add DOI and URL to default entry preview layout

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Added DOI and URL fields to default entry preview layout
• Implemented automatic migration for existing preview styles
• Updated preview style storage to use __NEWLINE__ for proper migration
• Added comprehensive tests for preview style migration scenarios
Diagram
flowchart LR
  A["Default Preview Layout"] -->|Add DOI field| B["DOI with link"]
  A -->|Add URL field| C["URL with link"]
  D["Existing Preview Styles"] -->|Migration triggered| E["Updated with DOI/URL"]
  F["Preview Storage"] -->|Replace newlines| G["__NEWLINE__ format"]
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java ✨ Enhancement +4/-1

Add DOI and URL to default preview layout

• Added DOI field with clickable link to doi.org in default preview layout
• Added URL field with clickable link in default preview layout
• Modified preview style storage to replace newlines with __NEWLINE__ for proper migration handling

jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java


2. jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java ✨ Enhancement +7/-1

Implement preview style migration for DOI/URL

• Added migration logic to insert DOI and URL fields into existing preview styles
• Migration targets the section between pages and abstract fields
• Uses text block format for improved readability of migration pattern

jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java


3. jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java 🧪 Tests +37/-11

Add tests for preview style migration

• Updated existing test to verify DOI and URL fields are added during migration
• Added new test case to verify migration is skipped when pattern is not found
• Converted test strings to use text blocks for better readability

jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java


View more (1)
4. CHANGELOG.md 📝 Documentation +1/-0

Document DOI and URL preview feature

• Added entry documenting the new DOI and URL fields in entry preview
• Referenced issue #14193

CHANGELOG.md


Grey Divider

Qodo Logo

@github-actions
Copy link
Copy Markdown
Contributor

Do not mark a PR as ready-for-review while the CI is running. CI checks need to be completed and passed.

@koppor koppor marked this pull request as draft February 20, 2026 15:00
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 10f859c

@koppor koppor marked this pull request as ready for review February 20, 2026 15:09
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add DOI and URL fields to default entry preview

✨ Enhancement 🧪 Tests

Grey Divider

Walkthroughs

Description
• Added DOI and URL fields to default entry preview style
• Implemented migration logic to update existing preview styles
• Enhanced preview style storage to use __NEWLINE__ for proper migration
• Added comprehensive tests for preview style migration scenarios
Diagram
flowchart LR
  A["Default Preview Style"] -->|"Add DOI/URL fields"| B["Updated Preview Template"]
  C["User Custom Preview"] -->|"Migration Logic"| D["Migrated Preview Style"]
  B -->|"Store with __NEWLINE__"| E["Preferences Storage"]
  D -->|"Validation Tests"| F["Test Coverage"]
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java ✨ Enhancement +4/-1

Add DOI and URL to default preview style

• Added DOI field with clickable link to doi.org using DOIStrip formatter
• Added URL field with clickable hyperlink
• Modified preview style storage to replace newlines with __NEWLINE__ for proper migration handling

jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java


2. jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java ✨ Enhancement +7/-1

Implement preview style migration for DOI/URL

• Added migration pattern to insert DOI and URL fields between pages and abstract sections
• Uses text block syntax for cleaner multi-line replacement string
• Ensures existing custom preview styles are updated with new fields

jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java


3. jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java 🧪 Tests +37/-11

Add migration tests for DOI/URL fields

• Updated existing test to verify DOI and URL fields are added during migration
• Converted test strings to text blocks for improved readability
• Added new test case to verify migration is skipped when pattern is not found

jabgui/src/test/java/org/jabref/migrations/GuiPreferencesMigrationsTest.java


View more (1)
4. CHANGELOG.md 📝 Documentation +1/-0

Document DOI/URL preview enhancement

• Added entry documenting the new DOI and URL fields in default preview style
• References issue #14193

CHANGELOG.md


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 18644c1

@Siedlerchr Siedlerchr enabled auto-merge February 20, 2026 15:31
@Siedlerchr Siedlerchr added this pull request to the merge queue Feb 20, 2026
@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label Feb 20, 2026
@ustmd
Copy link
Copy Markdown
Contributor Author

ustmd commented Feb 20, 2026

thanks for the help!
qodo and its strange issues have me completely stumped

@Siedlerchr
Copy link
Copy Markdown
Member

Qodo is an AI bot, so you have to take it always with a bit of grain at salt but it helps to see potential issues that need a second look.

Merged via the queue into JabRef:main with commit 58278bf Feb 20, 2026
51 checks passed
Siedlerchr added a commit that referenced this pull request Feb 22, 2026
…anner

* upstream/tryToFixBanner: (194 commits)
  Enable loading of main.wxs
  Fix icon on Linux (#15188)
  chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.5 (#15178)
  New Crowdin updates (#15173)
  Reduce complexity in dependencies setup (#15169)
  Start new development cycle
  snapcraft
  snapcraft
  use snapctl
  update metadata fiels
  try with  mesa candidate
  fix snapcraft and skmanrc to use correct version
  Release v6.0-alpha.5
  chore(sbom): update CycloneDX SBOM files (#15172)
  Chore(deps): Bump jablib/src/main/resources/csl-styles (#15171)
  Added "DOI" and URL to entry preview [#14193] (#15121)
  Fix condition to check running CI in workflow
  Add maintainer permission check to workflow
  Add debug output for running checks
  Fix matrix
  ...
RakockiW pushed a commit to RakockiW/jabref that referenced this pull request Mar 1, 2026
* feat: added "DOI" replace if entry preview has default value

* fix: remove multiple consecutive blank lines

* feat: add URL replace for default entry preview and negative migration test

* refactor: use text block in preview style migration

* fix newlines in preview prefs

* use textblock

* refine changelog

---------

Co-authored-by: Siedlerchr <siedlerkiller@gmail.com>
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first contrib status: no-bot-comments status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "DOI" and URL to entry preview

3 participants