Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Collection of Comp Sci Bibliographies fetcher #6664

Merged
merged 18 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public String getKey() {
@Override
public String format(String value) {
Objects.requireNonNull(value);

return MULTIPLE_SPACES.matcher(value).replaceAll(" ");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
/**
* Replaces any tab with a space
*/
public class RemoveTabsFormatter extends Formatter {
public class ReplaceTabsBySpaceFormater extends Formatter {

private static final Pattern TAB = Pattern.compile("\t+");

@Override
public String getName() {
return Localization.lang("Remove tabs");
return Localization.lang("Replace tabs with space");
daniel-price marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
Expand All @@ -26,13 +26,12 @@ public String getKey() {
@Override
public String format(String value) {
Objects.requireNonNull(value);

return TAB.matcher(value).replaceAll(" ");
}

@Override
public String getDescription() {
return Localization.lang("Removes tabs in the field content.");
return Localization.lang("Replace tabs with space in the field content.");
daniel-price marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.jabref.logic.formatter.bibtexfields.RemoveDigitsFormatter;
import org.jabref.logic.formatter.bibtexfields.RemoveNewlinesFormatter;
import org.jabref.logic.formatter.bibtexfields.RemoveRedundantSpacesFormatter;
import org.jabref.logic.formatter.bibtexfields.RemoveTabsFormatter;
import org.jabref.logic.formatter.bibtexfields.ReplaceTabsBySpaceFormater;
import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.logic.importer.Parser;
Expand Down Expand Up @@ -50,7 +50,7 @@ public String getName() {
@Override
public void doPostCleanup(BibEntry entry) {
new FieldFormatterCleanup(StandardField.ABSTRACT, new RemoveNewlinesFormatter()).cleanup(entry);
new FieldFormatterCleanup(StandardField.ABSTRACT, new RemoveTabsFormatter()).cleanup(entry);
new FieldFormatterCleanup(StandardField.ABSTRACT, new ReplaceTabsBySpaceFormater()).cleanup(entry);
new FieldFormatterCleanup(StandardField.ABSTRACT, new RemoveRedundantSpacesFormatter()).cleanup(entry);
new FieldFormatterCleanup(StandardField.EDITOR, new RemoveDigitsFormatter()).cleanup(entry);
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2255,3 +2255,10 @@ Reveal\ in\ file\ explorer=Reveal in file explorer
Reset=Reset
Reset\ entry\ types\ and\ fields\ to\ defaults=Reset entry types and fields to defaults
This\ will\ reset\ all\ entry\ types\ to\ their\ default\ values\ and\ remove\ all\ custom\ entry\ types=This will reset all entry types to their default values and remove all custom entry types

Replace\ tabs\ with\ space=Replace tabs with space
Replace\ tabs\ with\ space\ in\ the\ field\ content.=Replace tabs with space in the field content.
Remove\ redundant\ spaces=Remove redundant spaces
Replaces\ consecutive\ spaces\ with\ a\ single\ space\ in\ the\ field\ content.=Replaces consecutive spaces with a single space in the field content.
Remove\ digits=Remove digits
Removes\ digits.=Removes digits.
daniel-price marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

public class RemoveTabsFormatterTest {
public class ReplaceTabsBySpaceFormaterTest {

private RemoveTabsFormatter formatter;
private ReplaceTabsBySpaceFormater formatter;

@BeforeEach
public void setUp() {
formatter = new RemoveTabsFormatter();
formatter = new ReplaceTabsBySpaceFormater();
}

@Test
Expand Down