Add support for LTWA (issue #12276)#12880
Conversation
| try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/ltwa-list.mv")) { | ||
| if (resourceAsStream == null) { | ||
| LOGGER.warn("There is no ltwa-list.mv. We cannot load the LTWA repository."); | ||
| return null; |
There was a problem hiding this comment.
I changed it to make it throw instead of null and let the public method take care of that.
|
I have updated the implementation to use Antlr. I am not sure if this issue is reproducible: whenever I tried to use the Antlr-generated source to develop on my local machine after the initial |
…r-issue-12273 # Conflicts: # src/main/java/org/jabref/cli/LtwaListMvGenerator.java # src/main/java/org/jabref/gui/journals/UndoableAbbreviator.java # src/main/java/org/jabref/logic/journals/ltwa/LtwaRepository.java # src/main/java/org/jabref/logic/journals/ltwa/LtwaTsvParser.java # src/main/java/org/jabref/logic/journals/ltwa/NormalizeUtils.java # src/test/java/org/jabref/logic/journals/LtwaRepositoryTest.java
| } | ||
|
|
||
| SearchState state = new SearchState(node, index); | ||
| if (visited.contains(state)) { |
There was a problem hiding this comment.
I'm unsure where I nest the logic inside the "else" branches; this method is recursive.
| try (InputStream resourceAsStream = JournalAbbreviationRepository.class.getResourceAsStream("/journals/ltwa-list.mv")) { | ||
| if (resourceAsStream == null) { | ||
| LOGGER.warn("There is no ltwa-list.mv. We cannot load the LTWA repository."); | ||
| return null; |
There was a problem hiding this comment.
I changed it to make it throw instead of null and let the public method take care of that.
| var languageStr = matcher.group(3); | ||
|
|
||
| word = NormalizeUtils.normalize(ANNOTATION.matcher(word).replaceAll("").strip()); | ||
| var abbreviation = abbreviationStr.equals("n.a.") ? null : abbreviationStr; |
There was a problem hiding this comment.
I would like to acknowledge that it's not possible to serialize Optional, and I figured it would be unwise to store an extra field called isAbbreviationPresent and store something arbitary in the actual abbreviation. As such, I left it null.
|
@trag-bot didn't find any issues in the code! ✅✨ |
Integrate journal abbreviation toggle functionality (JabRef#12880) with the LTWA repository support from main branch. Resolve conflicts in JournalAbbreviationRepository, JournalAbbreviationLoader, and MainMenu to ensure both features work correctly together. The combined functionality allows users to enable/disable specific journal abbreviation sources while maintaining LTWA abbreviation support.
* Implement LTWA abbreviation * Create LTWA resource download in the gradle tasks * Connected the LTWA logic with the GUI * Updated the CHANGELOG.md * Fix according to Trag * Reimplement with Antlr * Fix errors from previous PR * Use Optional as Trag suggested * Fix the locale translation issue --------- Co-authored-by: Christoph <siedlerkiller@gmail.com>
* Implement LTWA abbreviation * Create LTWA resource download in the gradle tasks * Connected the LTWA logic with the GUI * Updated the CHANGELOG.md * Fix according to Trag * Reimplement with Antlr * Fix errors from previous PR * Use Optional as Trag suggested * Fix the locale translation issue --------- Co-authored-by: Christoph <siedlerkiller@gmail.com>
Closes #12273
src/main/java/org/jabref/gui/journalsto handle the UI logics.LTWARepositoryclass and integrated it as a part of theJournalAbbreviationRepositoryto handle the LTWA abbreviation logics. I am not exactly sure if it would be appropriate to change the abbreviation class since that class appears to be largely a data class, and I am hesitant to add business logics to it.Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)