Fix title-related key patterns in BibtexKeyPatternUtil#2610
Conversation
Siedlerchr
left a comment
There was a problem hiding this comment.
Codewise looks good, but please take a look at the failng tests
|
Codewise looks good! 👍 Thank you very much for your contribution. Would you please check the failing tets? (Just click Details on the Red-Marked Travis Build and you are able to see the log). From what I saw there is jut another unit test which tests key generation which has to be adapted! |
|
Thanks! I'll try to fix it tomorrow 👍 |
af7b492 to
367085b
Compare
|
@Siedlerchr Some tests failed because most of the formatter classes only work if the input is a non concatenated string. |
|
From my point of view it looks good. However, another dev should take a look, too. |
tobiasdiez
left a comment
There was a problem hiding this comment.
The code looks good to me. Maybe add a changelog entry
| } | ||
|
|
||
| if (stringBuilder.length() > 0) { | ||
| stringBuilder.append(' '); |
There was a problem hiding this comment.
Normally, we would use StringJoiner to avoid this kind of code.
There was a problem hiding this comment.
Ah I copied this from some of the existing code, I'll try to change it to use a StringJoiner!
I'll also add a changelog entry.
There was a problem hiding this comment.
Thank you! 👍 We're just trying to improve the code quality wherever possible 😇
There was a problem hiding this comment.
No problem :)
I've made the suggested code change and added a change to the changelog.
Added change to changelog
|
I wonder whether it would be possible to add test cases to MakeLabelWithDatabaseTest.java with all patterns listed at http://help.jabref.org/en/BibtexKeyPatterns. I saw that you also added Strangely, If it is too much effort, we can just go ahead and merge! |
|
I have added a test for the [camel] case to MakeLabelWithDatabaseTest.java Are there any additional test cases I should add? Edit: About checking all the patterns listed at http://help.jabref.org/en/BibtexKeyPatterns |
|
Yeah, it's covered: https://codecov.io/gh/JabRef/jabref/src/6aa925b7ec6fc2e1deb497a898e076bc747630da/src/main/java/org/jabref/logic/bibtexkeypattern/BibtexKeyPatternUtil.java I'll go ahead with the merge and look forward to other tests / general improvements. We have a huge list of smaller tasks at https://github.com/koppor/jabref/issues. Thank you for the good work! |
* upstream/master: (91 commits) fixed #2613 (#2623) Add MathSciNet as ID-based fetcher (#2621) Add icon + color and description to groups (#2612) Fixed wrong logger import (#2618) Cleanup window has a scrollbar now. (#2614) Added the locale to a newly created class Move ExportComparator and CustomExportList to the correct package (only used in preferences) Fixes displaying of Mr DLib recommendations (#2616) Fix title-related key patterns in BibtexKeyPatternUtil (#2610) Remove OrdinalsToSuperscriptFormatter from recommended biblatex save actions (#2601) Update pgjdbc to new major version Update Dependenices String Similary log4j wiremock mockito Fix exception when parsing groups which contain a top level group (#2611) Add "Remove group and subgroups" option (#2587) Fix #1104: group selection is preserved under tab change Fix several File Cleanup + Rename issues (#2415) Fixed a small error in the code comments Implement #1904: filter groups (#2588) Braces checking followup (#2598) Improve braces checking (#2593) ...
|
We just discovered that our documentation was wrong and that It should work with See JabRef#237 |
|
Hmm OK, I've responded in the issue since it is not entirely clear to me what has to happen. |

Related to #2604 and #2589
In the class BibtexKeyPatternUtil I've added cases for [title] and [camel] to try and make them conform to the documentation.
@Siedlerchr was also working on this issue here. I found out that
CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entry.getField(FieldName.TITLE).orElse("").replaceAll("\\s+", ""));didn't work because to be able to transform the title into upper_camel this way the title has to be in lower_camel case initially, which is often not the case.
I've added some test cases and changed a few others to conform to the documentation.
I still need to take a look at the failing tests.
gradle localizationUpdate?