Update KeywordEditor to work with escaping#14929
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||
|
Why dont you want to keep the converter static and reusable? |
Because the converter needs access to the object's data to convert the strings. |
|
Did it occur to you, that a keyword is different from a keywordlist? |
What do you mean by that? |
|
The String converter for keywords is not meant to be used to parse a list of keywords, hoping that I ly the first one is the one you are looking for. Only clear defined keywords as strings to be converted are expected. Parsing for shg else must be done beforehand. |
|
That's why the String converter was static. To keep the code clean. |
|
To create a Keyword from a string, the string must be parsed first. However, the logic in KeywordList#parse already returns a KeywordList populated with created Keywords. If we introduce a separate method to parse a single Keyword while keeping StringConverter static, the fromString method becomes redundant. This approach seems overcomplicated and leads to unused code. |
|
Your pull request conflicts with the target branch. Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line. |
I understand your concern, but I don't see how to achieve this. I spent some time looking at the code and couldn't find a solution other than making the String converter non static. I would really appreciate it if you could share your thoughts on this. |
|
Will do in a few days. Busy with day job. |
✅ All tests passed ✅🏷️ Commit: b3ed3a7 Learn more about TestLens at testlens.app. |
|
Looks good, thanks for coming back for this one. |
Head branch was pushed to by a user without write access
Resolve merge conflicts from main merge into fix/issue-15108 branch. KeywordsEditor now properly extends TagsEditor and overrides the separator key handler to preserve the escaped keyword support added in main (JabRef#14929). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refs/heads/main: Increase max assignments from 2 to 3 Chore(deps): Bump io.zonky.test:embedded-postgres in /versions (#15213) Chore(deps): Bump jablib/src/main/resources/csl-styles (#15211) New Crowdin updates (#15208) Fix: Prevent creating empty or duplicate fields (#15168) chore(deps): update jackson monorepo to v3.1.0 (#15203) Update KeywordEditor to work with escaping (#14929) Chore(deps): Bump com.dlsc.gemsfx:gemsfx in /versions (#15205) Chore(deps): Bump tools.jackson:jackson-bom in /versions (#15206) Fix: Reset External File Type to default (#15167) docs: fix link formatting in ADR 0012 (#15201)
* add default escape symbol constant to Keyword * refactor getStringConverter to use new parsing logic * refactor KeywordsEditor to use non-static viewModel.getStringConverter() * update keyword separating logic * fix fromString method * add serialization for tag editing * add tests for KeywordsEditorViewModel * add CHANGELOG.md entry * add check for missing separator * add check for null and simplify loop * update KeywordsEditor to use KeywordsEditorViewModel#parseKeyword instead of StringConverter for creating Keywords * fix CHANGELOG.md * update tests * move CHANGELOG.md entry to unreleased --------- Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
* add default escape symbol constant to Keyword * refactor getStringConverter to use new parsing logic * refactor KeywordsEditor to use non-static viewModel.getStringConverter() * update keyword separating logic * fix fromString method * add serialization for tag editing * add tests for KeywordsEditorViewModel * add CHANGELOG.md entry * add check for missing separator * add check for null and simplify loop * update KeywordsEditor to use KeywordsEditorViewModel#parseKeyword instead of StringConverter for creating Keywords * fix CHANGELOG.md * update tests * move CHANGELOG.md entry to unreleased --------- Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
Closes #14780
Follow up for #14637
Update KeywordEditor to work with escaping logic throught jablib/src/main/java/org/jabref/model/entry/KeywordList#Parse and jablib/src/main/java/org/jabref/model/entry/KeywordList#Serialize
Steps to test
This should work the same way both when pasting and entering manualy. Also, when using suggestions, suggested text should be added as tag and serialized version saved to "BibTeX sorce".
Proposed documntation changes JabRef/user-documentation#615
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)