Search in sources :

Example 1 with NormalizeMonthFormatter

use of org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter in project jabref by JabRef.

the class CleanupWorkerTest method cleanupWithDisabledFieldFormatterChangesNothing.

@Test
public void cleanupWithDisabledFieldFormatterChangesNothing() {
    CleanupPreset preset = new CleanupPreset(new FieldFormatterCleanups(false, Collections.singletonList(new FieldFormatterCleanup("month", new NormalizeMonthFormatter()))));
    BibEntry entry = new BibEntry();
    entry.setField("month", "01");
    worker.cleanup(preset, entry);
    Assert.assertEquals(Optional.of("01"), entry.getField("month"));
}
Also used : NormalizeMonthFormatter(org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter) BibEntry(org.jabref.model.entry.BibEntry) FieldFormatterCleanups(org.jabref.model.cleanup.FieldFormatterCleanups) FieldFormatterCleanup(org.jabref.model.cleanup.FieldFormatterCleanup) Test(org.junit.Test)

Example 2 with NormalizeMonthFormatter

use of org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter in project jabref by JabRef.

the class MedlineFetcher method doPostCleanup.

@Override
public void doPostCleanup(BibEntry entry) {
    new FieldFormatterCleanup("journal-abbreviation", new ClearFormatter()).cleanup(entry);
    new FieldFormatterCleanup("status", new ClearFormatter()).cleanup(entry);
    new FieldFormatterCleanup("copyright", new ClearFormatter()).cleanup(entry);
    new FieldFormatterCleanup(FieldName.MONTH, new NormalizeMonthFormatter()).cleanup(entry);
}
Also used : NormalizeMonthFormatter(org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter) FieldFormatterCleanup(org.jabref.model.cleanup.FieldFormatterCleanup) ClearFormatter(org.jabref.logic.formatter.bibtexfields.ClearFormatter)

Example 3 with NormalizeMonthFormatter

use of org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter 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"));
}
Also used : NormalizeMonthFormatter(org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter) BibEntry(org.jabref.model.entry.BibEntry) FieldFormatterCleanups(org.jabref.model.cleanup.FieldFormatterCleanups) FieldFormatterCleanup(org.jabref.model.cleanup.FieldFormatterCleanup) Test(org.junit.Test)

Aggregations

NormalizeMonthFormatter (org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter)3 FieldFormatterCleanup (org.jabref.model.cleanup.FieldFormatterCleanup)3 FieldFormatterCleanups (org.jabref.model.cleanup.FieldFormatterCleanups)2 BibEntry (org.jabref.model.entry.BibEntry)2 Test (org.junit.Test)2 ClearFormatter (org.jabref.logic.formatter.bibtexfields.ClearFormatter)1