use of org.jabref.model.cleanup.FieldFormatterCleanup in project jabref by JabRef.
the class zbMATH method doPostCleanup.
@Override
public void doPostCleanup(BibEntry entry) {
new MoveFieldCleanup("msc2010", FieldName.KEYWORDS).cleanup(entry);
new MoveFieldCleanup("fjournal", FieldName.JOURNAL).cleanup(entry);
new FieldFormatterCleanup(FieldName.JOURNAL, new RemoveBracesFormatter()).cleanup(entry);
new FieldFormatterCleanup(FieldName.TITLE, new RemoveBracesFormatter()).cleanup(entry);
}
use of org.jabref.model.cleanup.FieldFormatterCleanup in project jabref by JabRef.
the class IsbnViaEbookDeFetcher method doPostCleanup.
@Override
public void doPostCleanup(BibEntry entry) {
// We MUST NOT clean the URL. this is the deal with ebook.de
// DO NOT add following code:
// new FieldFormatterCleanup(FieldName.URL, new ClearFormatter()).cleanup(entry);
// Fetcher returns page numbers as "30 Seiten" -> remove every non-digit character in the PAGETOTAL field
entry.getField(FieldName.PAGETOTAL).ifPresent(pages -> entry.setField(FieldName.PAGETOTAL, pages.replaceAll("[\\D]", "")));
new FieldFormatterCleanup(FieldName.PAGETOTAL, new NormalizePagesFormatter()).cleanup(entry);
new FieldFormatterCleanup(FieldName.AUTHOR, new NormalizeNamesFormatter()).cleanup(entry);
}
use of org.jabref.model.cleanup.FieldFormatterCleanup in project jabref by JabRef.
the class CleanupActionsListModelTest method resetSetsFormattersToPassedList.
@Test
public void resetSetsFormattersToPassedList() throws Exception {
CleanupActionsListModel model = new CleanupActionsListModel(Collections.emptyList());
FieldFormatterCleanups defaultFormatters = mock(FieldFormatterCleanups.class);
List<FieldFormatterCleanup> formatters = Arrays.asList(new FieldFormatterCleanup("test", new ClearFormatter()));
when(defaultFormatters.getConfiguredActions()).thenReturn(formatters);
model.reset(defaultFormatters);
assertEquals(formatters, model.getAllActions());
}
use of org.jabref.model.cleanup.FieldFormatterCleanup in project jabref by JabRef.
the class CleanupWorkerTest method cleanupMonthChangesNumberToBibtex.
@Test
public void cleanupMonthChangesNumberToBibtex() {
CleanupPreset preset = new CleanupPreset(new FieldFormatterCleanups(true, Collections.singletonList(new FieldFormatterCleanup("month", new NormalizeMonthFormatter()))));
BibEntry entry = new BibEntry();
entry.setField("month", "01");
worker.cleanup(preset, entry);
Assert.assertEquals(Optional.of("#jan#"), entry.getField("month"));
}
use of org.jabref.model.cleanup.FieldFormatterCleanup in project jabref by JabRef.
the class CleanupWorkerTest method cleanupDatesConvertsToCorrectFormat.
@Test
public void cleanupDatesConvertsToCorrectFormat() {
CleanupPreset preset = new CleanupPreset(new FieldFormatterCleanups(true, Collections.singletonList(new FieldFormatterCleanup("date", new NormalizeDateFormatter()))));
BibEntry entry = new BibEntry();
entry.setField("date", "01/1999");
worker.cleanup(preset, entry);
Assert.assertEquals(Optional.of("1999-01"), entry.getField("date"));
}
Aggregations