Repository navigation
Keep organization authors containing "and" intact in RIS export. - #17876
Conversation
Sort citationcount, day, and dayfiled numerically
PR Summary by QodoPreserve organization names containing “and” in RIS exports
AI Description
Merge Risk
|
Code Review by Qodo
1. Accented name prefixes move into given names
|
…m/AnishKmSingh/jabref into fix-17821-ris-organization-author
|
Can you take a look at the qodo issues? Are they still valid?` |
|
I checked the Qodo findings:
|
|
Hi @Siedlerchr. gentle ping on this one. I addressed the review comments and the Qodo findings (1 and 3 are fixed, all checks pass). For Qodo point 2 (accented prefixes like |
|
Created backport PR for
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin port-17876-to-black-forest
git worktree add --checkout .worktree/port-17876-to-black-forest port-17876-to-black-forest
cd .worktree/port-17876-to-black-forest
git reset --hard HEAD^
git cherry-pick -x 8080099db172feb038a7c7638ec37a1454cf4773 |
* refs/heads/main: Keep organization authors containing "and" intact in RIS export. (JabRef#17876)
### Summary RIS export splits page ranges even when the pages field starts with whitespace, and preserves literal labels such as `App.1`. RIS import keeps editors, identifiers, and PDF attachments in their own fields and recognizes record terminators at line boundaries. RIS export writes serial numbers as `SN` and retains the three separators in `Y1` dates. The [RIS requirements](https://github.com/JabRef/jabref/blob/8fb0c4056aab1884055568832cbc93cb825c7585/docs/requirements/export.md#ris-import-must-preserve-secondary-authors-as-editors) link each behavior to the relevant section of the Reference Manager specification. ### Alternatives considered - `replace('\u00A0', ' ')` + `strip()` (the previous version): discarded because it only covered one non-breaking space (U+00A0) and duplicated logic that already exists in the project. - `NormalizeUnicodeFormatter`: uses NFC, which does not convert U+00A0 into a regular space. - `TrimWhitespaceFormatter` / `trim()`: do not remove U+00A0. - `\h` in the split regex: would also handle non-breaking spaces, but adds custom logic instead of reusing existing classes. ### Steps to test 1. Create an article through the GUI. 2. Insert ` 345-350` (with a leading space) in the pages field. 3. Export it with the RIS format. 4. Check that the exported file contains `SP - 345` and `EP - 350`. 5. Change the pages field to `App.1-App.3` and export again. Confirm that the file contains `SP - App.1` and `EP - App.3`. 6. Create a book with distinct author and editor names, an ISBN, an ISSN, and a linked PDF. Export it as RIS and import that file into a new library. Confirm that the editor appears in the editor field, both identifiers return to their respective fields, and the PDF appears under linked files. 7. Export an article dated May 2024 and check for `Y1 - 2024/05//`. Clear the month, export again, and check for `Y1 - 2024///`. 8. In a two-record RIS file, replace the first record's title line with `TI - LASER - calibration` and import the file. Confirm that the first title is `LASER - calibration` and the second record is still present. Pages field with a leading space: <img width="554" height="312" alt="1795454859519_image" src="https://github.com/user-attachments/assets/2aa578c4-6db3-4144-8511-253e0a45e493" /> Exported RIS after the fix: <img width="264" height="236" alt="1795454838371_image" src="https://github.com/user-attachments/assets/8633b5cd-f948-4f27-ae7a-969d4c3dccf9" /> Before this fix, the export contained `SP - 345-350` and an empty `EP - `. Automated verification covered the expanded cases. All 149 targeted tests passed after integrating JabRef#17876, and OpenFastTrace passed. JabLib main and test Checkstyle, Markdown linting, and textlint passed for the local RIS changes before that merge. The screenshots show the original page-range reproduction. Manual verification and screenshots for the follow-up cases are pending. ### Related issues and pull requests Closes JabRef#17774 Based on the approach in JabRef#17775 and JabRef#17808, whose authors are credited as co-authors. The branch also includes the RIS organization author fix from JabRef#17876. The identifier changes build on JabRef#17891. ### AI usage Original contributor's disclosure: > Claude (model claude-opus-5-5), AIL2. I used it to understand the code and the bug, to suggest a test case, and to help with the English of the CHANGELOG entry, the documentation comment, the commit message, and this PR description. I reproduced the bug in the GUI, wrote the fix and the tests myself, and ran them locally. Follow-up changes in `8fb0c4056a` (AIL5 for the follow-up implementation). OpenAI Codex (model `gpt-6.2-sol`) identified the additional RIS issues, implemented the fixes and tests, added specification references, verified the combined change, and updated this PR description. Contributor review and manual verification of those follow-up changes are pending. <details> <summary>AI CHECKLIST.md walkthrough</summary> **Code checklist** > [!IMPORTANT] > **This is a mandatory final gate.** When the implementation is finished and before you open a PR, work through **every** box below and tick it. If a box cannot be ticked, fix the code first; mark a box `[/]` only if the point genuinely does not apply. > > `AGENTS.md` describes how to write code *while* developing — this file confirms the finished result. Do not skip the checklist and do not skip individual points. **1. Code self-review** Read your own diff once, top to bottom, and confirm each point. **Nullability and control flow** - [x] No `== null` / `!= null` checks — JSpecify annotations (`@NullMarked`, `@Nullable`, `@NonNull`) used instead. - [x] No `Objects.requireNonNull(...)` — nullability expressed via JSpecify annotations. - [x] New classes annotated with `@NullMarked` (`org.jspecify.annotations.NullMarked`). - [/] New packages annotated with `@NullMarked` (`org.jspecify.annotations.NullMarked`). - [x] `Optional` consumed with `ifPresent` / `ifPresentOrElse` / `map` / `orElseThrow` — never `orElse(unusedValue)` nor an `isPresent()` + `get()` block. - [/] `StringUtil.isBlank(...)` used instead of `s == null || s.isBlank()`. **Exceptions** - [x] No `catch (Exception e)` — only specific exceptions are caught. - [x] No `throw new RuntimeException(...)` / `IllegalStateException(...)` — these tear down the whole application. - [/] Logged exceptions are passed as the **last** logger argument (`LOGGER.info("...", e)`), not concatenated into the message string. **Style and idioms** - [x] New `BibEntry` objects built with withers (`withField`, not `setField`). - [x] Modern Java used: `List.of()` / `Map.of()` / `Set.of()`, `Path.of()`, `SequencedCollection` / `SequencedSet`, text blocks. - [x] Regexes use a precompiled `Pattern.compile(...)` constant, not `String.matches(...)`. - [ ] Keep alphabetical ordering when adding variables or enum items. - [/] Background work uses `org.jabref.logic.util.BackgroundTask`, not `new Thread()`. - [x] No commented-out code, no trivial comments restating the code, no AI-disclosure comments in source. - [/] Markdown Javadoc (`///`) uses Markdown syntax, not JavaDoc inline tags: `` `code` `` instead of `{@code}`, `[ClassName]` instead of `{@link}`. **User-facing text** - [/] All user-facing text localized (`Localization.lang` in Java, `%` prefix in FXML). - [/] Sentence case (not Title Case); no trailing `!`; labels do not end with `:`. - [/] Variance expressed with placeholders (`"...: %0"`), not string concatenation. **Security** - [/] User-controlled data (request params, entry fields, file contents) is HTML-escaped before being written into any `text/html` response — including exception/error messages, not just the success body (XSS). **Tests** - [x] In case issue lists an example, this concrete example is covered by a test case. - [x] Behavior changes in `org.jabref.model` / `org.jabref.logic` have added or updated tests. - [x] Tests assert object contents (`assertEquals`), use plain JUnit asserts (not AssertJ), have no `@DisplayName`, do not catch exceptions (let them propagate so JUnit reports setup/teardown failures directly), and use `@TempDir` instead of manual temp directories. - [/] Fetcher tests hit the live endpoints — the remote API is not mocked or stubbed (automated-review suggestions to mock it are rejected on purpose). **2. Verification commands** Run in this order — cheapest first. Each must pass. - [ ] `./gradlew :jablib:check` (or `./gradlew check` for all modules). - [ ] `./gradlew checkstyleMain checkstyleTest checkstyleJmh`. - [ ] `./gradlew modernizer`. - [ ] `./gradlew --no-configuration-cache :rewriteDryRun` reports no changes (run `./gradlew rewriteRun` to fix). - [ ] `./gradlew javadoc`. - [ ] `npx markdownlint-cli2 "docs/**/*.md" "*.md"` (only if Markdown changed). - [ ] `npm ci && npm run textlint` reports no misspellings (only if Markdown changed). - [/] Only if formatting is still off after `rewriteRun`: `docker run -v $(pwd):/github/workspace ghcr.io/leventebajczi/intellij-format:master "*.java" "" ".idea/codeStyles/Project.xml"`. **3. Documentation** - [x] `CHANGELOG.md` entry added if the change is visible to the user (end-user wording, no extra blank lines, sorted in next to existing entries about the same component/feature). Link the issue if one exists; link the PR only when no issue exists. Use `TODO` as the placeholder when neither is known yet — never a fake number. No entry for fixes to changes that were themselves introduced after the last release (feature only in `## [Unreleased]`) — update the existing unreleased entry instead if needed. - [x] Searched [jabref/issues](https://github.com/JabRef/jabref/issues) and [jabref-koppor/issues](https://github.com/JabRef/jabref-koppor/issues) for a related issue; linked only on a confident match, otherwise kept `TODO` (no `closes`/`fixes` for merely-similar issues). - [x] Requirement added to `docs/requirements/<area>.md` if the change is a new feature or significant bug fix (skip for refactors, minor fixes, and internal changes). - [x] Developer documentation under `docs/` updated if behavior or architecture changed. **4. Pull request** - [x] PR body built from `.github/PULL_REQUEST_TEMPLATE.md`, every section filled. - [x] All checklist items kept and marked `[x]`, `[ ]`, or `[/]`. - [ ] "Steps to test" is a numbered list with a cropped screenshot of the result for every visible change; no video (only allowed when another program is involved, e.g. drag and drop or push to an external application). - [x] All HTML comments removed from the PR body. - [/] PR created with `gh pr create --body-file <file>` (not `--body`). - [/] If `CHANGELOG.md` used a `TODO` placeholder (no issue confidently identified yet — an existing issue link always stays), the PR was opened as draft, the placeholder was replaced with the real PR-number link after PR creation, committed and pushed, and only then was the PR marked ready for review. If an issue is identified or created later, the link is switched to the issue. </details> ### Checklist - [x] I own the copyright of the code submitted and I license it under the [MIT license](https://github.com/JabRef/jabref/blob/main/LICENSE) - [ ] If AI tools were used, I disclosed them in the "AI usage" section and reviewed, understood, and take full ownership of all AI-generated code - [ ] I manually tested my changes in running JabRef (always required) - [x] I added JUnit tests for changes (if applicable) - [ ] I added screenshots in the PR description (if change is visible to the user) - [x] I added **one sentence (max 20 words)** to `CHANGELOG.md` describing the change from the user's point of view (if the change is visible to the user) - [/] I checked the [user documentation](https://docs.jabref.org/) for up to dateness and submitted a pull request to our [user documentation repository](https://github.com/JabRef/user-documentation/tree/main/en) --------- Co-authored-by: Aman Gautam <148102821+Gautam-aman@users.noreply.github.com> Co-authored-by: Vadim Lazuk <8135225+Inf1mum@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Siedlerchr <siedlerkiller@gmail.com>
* main: (58 commits) Keep organization authors containing "and" intact in RIS export. (JabRef#17876) Fix author and editor name export in MODS format (JabRef#17936) Fix LaTeX conversion in exported PDF metadata (JabRef#17810) Fix preferences menu text (JabRef#17966) Skip forced full-text index merges on shutdown (JabRef#17961) Fix wrong bibo namespace in RDF export (JabRef#17842) New Crowdin updates (JabRef#17956) chore(deps): update dependency com.konghq:unirest-modules-gson to v4.12.4 (JabRef#17955) Let Renovate update JavaFX in the jabsrv launcher (JabRef#17954) chore(deps): update dependency com.konghq:unirest-modules-gson to v4.12.3 (JabRef#17953) Import the RIS serial number of books and chapters as ISBN (JabRef#17891) Share nested LaTeX conversion with Writer (JabRef#17921) Render BST preview italics and bold as text, not math letters (JabRef#17902) Chore(deps): Bump com.konghq:unirest-java-bom from 4.11.11 to 4.12.0 in /versions (JabRef#17951) Inject NativeDesktop into its callers and remove the deprecated static helpers (JabRef#17947) New Crowdin updates (JabRef#17945) Chore(deps): Bump org.graalvm.sdk:nativeimage from 25.5.5.0.3 to 25.6.5.1 in /versions (JabRef#17944) Chore(deps): Bump com.googlecode.plist:dd-plist from 1.30 to 1.31 in /versions (JabRef#17943) Chore(deps): Bump JetBrains/junie-github-action from 1.10.1 to 1.10.2 (JabRef#17942) Chore(deps): Bump softprops/action-gh-release from 3.0.3 to 3.0.4 (JabRef#17941) ...
Summary
When exporting to RIS, brace protected organization authors whose names contain "and" (e.g.
{Research and Development Institute}) were split into multiple authors . Two things caused this -> the RIS layouts appliedFormatCharsbeforeRisAuthorswhich removed the protecting braces andRisAuthorsitself split the formatted author string on" and ".RisAuthorsnow parses the field withAuthorListwhich respects brace protected names , converts each author from LaTeX to Unicode vialatexFree()and writes one RIS line per author. Accordingly,FormatCharswas removed in front ofRisAuthorsin all RIS layouts; all other fields keepFormatChars.Regular author lists and LaTeX-encoded names (e.g.
M{\"u}ller→Müller) are exported as before. Editors (A2) benefit from the same fix.Steps to test
author = {{Food and Agriculture Organization} and John Smith}Before fix:
After fix:
Related issues and pull requests
Closes #17821
AI usage
I used CLAUDE Anthropic (opus 5.5 medium) find the root cause and drafted the code, tests and CHANGELOG entry. I reproduced the bug, applied the changes, ran the tests locally, verified the fix manually in JabRef (screenshots above) and reviewed and understood all changes. I take full ownership of the code.
Checklist
CHANGELOG.mddescribing the change from the user's point of view (if the change is visible to the user)