-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Enabled configuration of citation key patterns at the CLI #14726
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
base: main
Are you sure you want to change the base?
Conversation
|
@Siedlerchr I created this draft pull request . |
|
Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Source Code Tests / Checkstyle (pull_request)" and click on it. In case of issues with the import order, double check that you activated Auto Import. You can trigger fixing imports by pressing Ctrl+Alt+O to trigger Optimize Imports. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues, commit, and push. |
| public class KeySuffixConverter | ||
| extends CaseInsensitiveEnumConverter<CitationKeyPatternPreferences.KeySuffix> { | ||
|
|
||
| public KeySuffixConverter() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class seems to be a bit superfluous to me. Or did i miss something? Can't you just inline CaseInsensitiveEnumConverter<CitationKeyPatternPreferences.KeySuffix> ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to inline CaseInsensitiveEnumConverter directly in the @option
here
@option(names = "--suffix", description = "Key suffix strategy: ${COMPLETION-CANDIDATES}", converter = CaseInsensitiveEnumConverter.class)
private CitationKeyPatternPreferences.KeySuffix keySuffix;
but i am facing some errors thats why i created a convertor for that
i will try again
|
What might be helpful would be some hint to a list of allowed entrytypes, if one could not be found. Maybe by hardcoding it or by linking to some online documentation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is good that you asked for feedback early, but please note the following comments. Breaking into multiple lines bulks the diff up.
Also, please set up Checkstyle on IntelliJ as it is one of the very first points of our contributing guidelines.
| CitationKeyPatternPreferences existingPreferences = | ||
| parentCommand.getParent().cliPreferences.getCitationKeyPatternPreferences(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently have limited time and a lot of PRs to review. Please help by not making us repeat the same comments on every PR.
#14620 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that , i will fix that before my final PR.
I only created this Draft PR just to get some reviews over my code logic if i am on the right path or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is fine, it's just that style and formatting issues get in the way when the person is trying to look through your code and trying to provide feedback on the logic.
Please set up checkstyle so that you don't have to manually format code every time.
| GlobalCitationKeyPatterns patterns = | ||
| GlobalCitationKeyPatterns.fromPattern(defaultPattern); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public class KeySuffixConverter | ||
| extends CaseInsensitiveEnumConverter<CitationKeyPatternPreferences.KeySuffix> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add a hint and i guess adding this documentation will be helpful |
I will start working on that after fixing this issue |
No sub issue. We are all in the context here. If there are no long delays in back and forth, this should be solvable. Use |
Closes #14707
Added option in Jabkit CLI to change citation key patterns per entry type , same as available in Jabref GUI
Attached Video show testing of the TestCases.
Steps to test
I am attaching the test file i created to test (test.bib)
Test 1 -
This Will check Global pattern
Test 2 -
This Will check per entry type changing for article and book
Test 3 -
This Will check invalid entry type
there is no entry like invalid type so it should through an error
Test 4 -
This Will check invalid map syntax
Screenshots
Screen.Recording.2025-12-26.at.6.09.41.PM-converted-converted.mp4
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)