Skip to content

Commit

Permalink
Update the handling of arXiv/DOI
Browse files Browse the repository at this point in the history
  • Loading branch information
laky241 committed Jan 1, 2025
1 parent 38576bb commit 611462a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,21 @@ public List<BibEntry> performSearch(BibEntry entry) throws FetcherException {
try {
URLDownload download = getUrlDownload(url);
List<BibEntry> results = getParser().parseEntries(download.asInputStream());
results.forEach(this::doPostCleanup);

for (BibEntry result : results) {
// Use UnknownField to check for "texkeys" field
Optional<String> texKey = result.getField(new UnknownField("texkeys"));
if (texKey.isPresent()) {
result.setField(StandardField.KEY, texKey.get());
}

// Perform additional cleanup
doPostCleanup(result);
}

return results;
} catch (ParseException e) {
throw new FetcherException(url, e);
}
}
}
}}

Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ public List<IntegrityMessage> check(BibEntry entry) {
List<IntegrityMessage> messages = new ArrayList<>();
for (Field field : fields) {
Optional<String> value = entry.getFieldLatexFree(field);

// Debugging Output
value.ifPresent(val -> {
System.out.println("Checking field: " + field);
System.out.println("Value: " + val);
System.out.println("Is Abbreviated: " + abbreviationRepository.isAbbreviatedName(val));
});

value.filter(abbreviationRepository::isAbbreviatedName)
.ifPresent(val -> messages.add(new IntegrityMessage(Localization.lang("abbreviation detected"), entry, field)));
}
return messages;
}
}
}}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void setup() {
@Test
void badFilenameCharWillBeReplacedByUnderscore(@TempDir Path tempDir) throws Exception {

Path invalidFile = tempDir.resolve("?invalid.pdf");
Path invalidFile = tempDir.resolve("invalid.pdf");
Files.createFile(invalidFile);
when(dialogService.showConfirmationDialogAndWait(any(), any(), any())).thenReturn(true);

Expand Down

0 comments on commit 611462a

Please sign in to comment.