Add configurable delimiter detection during import - #15521
Conversation
Add KeywordList.parseImport with default delimiters (checking semicolons first, then commas). It detects the default delimiters and normalize keywords with user's customized delimiter in preference during import.
PR Summary by QodoHeuristically detect BibTeX keyword delimiters and normalize on import
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Code Review by Qodo
1.
|
|
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. |
|
Please consider qodo comments |
|
Thanks for the reminder and sorry for the delay! I have gone through qodo's comments, and all of them are valid concerns. I am updating the PR by replacing the manual |
…rocess and use escape-aware delimiter detection approach
|
Please also look at the failing tests. |
|
Got it! I have changed it to a draft PR. For future case like this, I will convert back to a draft PR if I cannot finish in three or four days. Thanks for your guidance! |
|
I found some tests failing. After a brief inspection, I think many previous JUnit tests use bib that contains ";" in the keywords field, and their expected outputs keep ";". This PR will changes the parser in the importing process so that those ";" are replaced, causing the mismatched between expected and actual outputs in the unit tests. I am a little bit uncertain of how to proceed next. Should I add a flag so that the changes only affect BibtexImporter? |
|
The keyword normalization during import will henceforth convert the separators to the configured/default separator. So the logic isn't wrong. |
Yeah, roundtrip. Should still work...
Yeah, maybe, the configured separator should be adapted then? JabRef should have a sensible default. Maybe, we need to think at JabCon... Maybe, we should st ";" - or have some auto-detection in place? Meaning: If I as user open a library of someone else, the library should not be trashed... |
|
I had read up on bibtex default being |
Signed-off-by: subhramit <subhramit.bb@live.in>
|
MS bib Tests with import+export renamed to round trip, including their xml resources that were being used in them. |
Refs. plk/biblatex#241
Emphasis on "some circumstances" (although the link to those circumstances returns 404 12 years later). Also refs. the biblatex standard - https://mirror.niser.ac.in/ctan/macros/latex/contrib/biblatex/doc/biblatex.pdf
If we adapt the separator as per every instance of import, it is no longer a user-configurable preference, and also then there is no concept of a "default". As long as we allow it to be configurable,
It is not trashed - until you export/save. |
|
Which is our existing default? We should not break users libraries! |
|
Also even if that was not the default, this will not break anything that already exists - but normalize to that default for new imports. If the new import is from a bib file, only on save will it be modified. |
| @@ -8,7 +8,7 @@ | |||
| <b:SourceType>Report</b:SourceType> | |||
| <b:Title>Agile Entwicklung Web-basierter Systeme</b:Title> | |||
| <b:Publisher>Gabler Verlag</b:Publisher> | |||
| <b:BIBTEX_KeyWords>software development processes; agile software development environments; time-to-market; Extreme Programming; Crystal methods family; Adaptive Software Development</b:BIBTEX_KeyWords> | |||
| <b:BIBTEX_KeyWords>software development processes, agile software development environments, time-to-market, Extreme Programming, Crystal methods family, Adaptive Software Development</b:BIBTEX_KeyWords> | |||
There was a problem hiding this comment.
Is it really impossible to configure JabRef to keep the ; ?
koppor
left a comment
There was a problem hiding this comment.
The ";" seem to be hand-crafted by some MS Word user / tester.
Thus, the change is correct.
Thank you all for the work.


Related issues and pull requests
Closes #12974
PR Description
Delimiters are now separate, where default delimiters
IMPORT_KEYWORD_DELIMITERSare used in the importing process and user's preferred delimiters are used for displaying. Thus, the default delimiters can be flexible and accommodate";".Things to note:
[";", ","]. This list is flexible and can be connected/replaced by user's preferred delimiters later if needed.";"is detected,","will no longer be considered as a delimiter in the importing process. This addresses the concern of having","as a valid part of the keyword. #12974 Comment""" @Article{, Keywords={asdf,asdf,asdf}, } """inBibtexParserTestwill be deduplicated during importing process. The previous unit test preserved the duplicated keywords.Steps to test
Please ignore what's below, please see #15521 (comment)
";".","in this case).Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)