diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1c64e30e43c..f16749a9be4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
### Changed
+- We changed `ISSNCleanup` into `NormalizeIssn` a `ISSN` formatter. [#13748](https://github.com/JabRef/jabref/issues/13748)
- We changed Citation Relations tab and gave tab panes more descriptive titles and tooltips. [#13619](https://github.com/JabRef/jabref/issues/13619)
- We changed the name from Open AI Provider to Open AI (or API compatible). [#13585](https://github.com/JabRef/jabref/issues/13585)
- We improved the citations relations caching by implementing an offline storage. [#11189](https://github.com/JabRef/jabref/issues/11189)
diff --git a/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java b/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java
index 20d818d9b04..b0bbc74dc6d 100644
--- a/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java
+++ b/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java
@@ -28,7 +28,6 @@ public class CleanupPresetPanel extends VBox {
@FXML private CheckBox cleanUpDOI;
@FXML private CheckBox cleanUpEprint;
@FXML private CheckBox cleanUpURL;
- @FXML private CheckBox cleanUpISSN;
@FXML private CheckBox cleanUpMovePDF;
@FXML private CheckBox cleanUpMakePathsRelative;
@FXML private CheckBox cleanUpRenamePDF;
@@ -117,7 +116,6 @@ private void updateDisplay(CleanupPreferences preset) {
cleanUpTimestampToCreationDate.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CONVERT_TIMESTAMP_TO_CREATIONDATE));
cleanUpTimestampToModificationDate.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CONVERT_TIMESTAMP_TO_MODIFICATIONDATE));
cleanUpTimestampToModificationDate.setSelected(preset.isActive(CleanupPreferences.CleanupStep.DO_NOT_CONVERT_TIMESTAMP));
- cleanUpISSN.setSelected(preset.isActive(CleanupPreferences.CleanupStep.CLEAN_UP_ISSN));
formatterCleanupsPanel.cleanupsDisableProperty().setValue(!preset.getFieldFormatterCleanups().isEnabled());
formatterCleanupsPanel.cleanupsProperty().setValue(FXCollections.observableArrayList(preset.getFieldFormatterCleanups().getConfiguredActions()));
}
@@ -137,9 +135,6 @@ public CleanupPreferences getCleanupPreset() {
if (cleanUpURL.isSelected()) {
activeJobs.add(CleanupPreferences.CleanupStep.CLEAN_UP_URL);
}
- if (cleanUpISSN.isSelected()) {
- activeJobs.add(CleanupPreferences.CleanupStep.CLEAN_UP_ISSN);
- }
if (cleanUpMakePathsRelative.isSelected()) {
activeJobs.add(CleanupPreferences.CleanupStep.MAKE_PATHS_RELATIVE);
}
diff --git a/jabgui/src/main/resources/org/jabref/gui/cleanup/CleanupPresetPanel.fxml b/jabgui/src/main/resources/org/jabref/gui/cleanup/CleanupPresetPanel.fxml
index 86c4af68002..f6421d75a4d 100644
--- a/jabgui/src/main/resources/org/jabref/gui/cleanup/CleanupPresetPanel.fxml
+++ b/jabgui/src/main/resources/org/jabref/gui/cleanup/CleanupPresetPanel.fxml
@@ -20,7 +20,6 @@
-
@@ -45,9 +44,9 @@
-
-
-
-
+
+
+
+
diff --git a/jablib/src/main/java/org/jabref/logic/cleanup/CleanupWorker.java b/jablib/src/main/java/org/jabref/logic/cleanup/CleanupWorker.java
index 1290f3417d6..1e4bd868f97 100644
--- a/jablib/src/main/java/org/jabref/logic/cleanup/CleanupWorker.java
+++ b/jablib/src/main/java/org/jabref/logic/cleanup/CleanupWorker.java
@@ -90,8 +90,6 @@ private CleanupJob toJob(CleanupPreferences.CleanupStep action) {
new MoveFilesCleanup(() -> databaseContext, filePreferences);
case FIX_FILE_LINKS ->
new FileLinksCleanup();
- case CLEAN_UP_ISSN ->
- new ISSNCleanup();
default ->
throw new UnsupportedOperationException(action.name());
};
diff --git a/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanups.java b/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanups.java
index 5bf2a008a19..8063b15a67b 100644
--- a/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanups.java
+++ b/jablib/src/main/java/org/jabref/logic/cleanup/FieldFormatterCleanups.java
@@ -17,6 +17,7 @@
import org.jabref.logic.formatter.bibtexfields.HtmlToLatexFormatter;
import org.jabref.logic.formatter.bibtexfields.HtmlToUnicodeFormatter;
import org.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter;
+import org.jabref.logic.formatter.bibtexfields.NormalizeIssn;
import org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter;
import org.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter;
import org.jabref.logic.formatter.bibtexfields.OrdinalsToSuperscriptFormatter;
@@ -64,7 +65,8 @@ public class FieldFormatterCleanups {
new FieldFormatterCleanup(StandardField.DATE, new NormalizeDateFormatter()),
new FieldFormatterCleanup(StandardField.MONTH, new NormalizeMonthFormatter()),
new FieldFormatterCleanup(InternalField.INTERNAL_ALL_TEXT_FIELDS_FIELD, new ReplaceUnicodeLigaturesFormatter()),
- new FieldFormatterCleanup(StandardField.KEYWORDS, new ConvertMSCCodesFormatter()));
+ new FieldFormatterCleanup(StandardField.KEYWORDS, new ConvertMSCCodesFormatter()),
+ new FieldFormatterCleanup(StandardField.ISSN, new NormalizeIssn()));
List recommendedBibtexFormatters = new ArrayList<>(DEFAULT_SAVE_ACTIONS);
recommendedBibtexFormatters.addAll(List.of(
diff --git a/jablib/src/main/java/org/jabref/logic/cleanup/ISSNCleanup.java b/jablib/src/main/java/org/jabref/logic/cleanup/ISSNCleanup.java
deleted file mode 100644
index 602048469fa..00000000000
--- a/jablib/src/main/java/org/jabref/logic/cleanup/ISSNCleanup.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.jabref.logic.cleanup;
-
-import java.util.List;
-import java.util.Optional;
-
-import org.jabref.model.FieldChange;
-import org.jabref.model.entry.BibEntry;
-import org.jabref.model.entry.field.StandardField;
-import org.jabref.model.entry.identifier.ISSN;
-
-public class ISSNCleanup implements CleanupJob {
-
- @Override
- public List cleanup(BibEntry entry) {
- Optional issnString = entry.getField(StandardField.ISSN);
- if (issnString.isEmpty()) {
- return List.of();
- }
-
- ISSN issn = new ISSN(issnString.get());
- if (issn.isCanBeCleaned()) {
- String newValue = issn.getCleanedISSN();
- FieldChange change = new FieldChange(entry, StandardField.ISSN, issnString.get(), newValue);
- entry.setField(StandardField.ISSN, newValue);
- return List.of(change);
- }
- return List.of();
- }
-}
diff --git a/jablib/src/main/java/org/jabref/logic/formatter/Formatters.java b/jablib/src/main/java/org/jabref/logic/formatter/Formatters.java
index a830762f5a5..f7fa786fc19 100644
--- a/jablib/src/main/java/org/jabref/logic/formatter/Formatters.java
+++ b/jablib/src/main/java/org/jabref/logic/formatter/Formatters.java
@@ -20,6 +20,7 @@
import org.jabref.logic.formatter.bibtexfields.HtmlToUnicodeFormatter;
import org.jabref.logic.formatter.bibtexfields.LatexCleanupFormatter;
import org.jabref.logic.formatter.bibtexfields.NormalizeDateFormatter;
+import org.jabref.logic.formatter.bibtexfields.NormalizeIssn;
import org.jabref.logic.formatter.bibtexfields.NormalizeMonthFormatter;
import org.jabref.logic.formatter.bibtexfields.NormalizeNamesFormatter;
import org.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter;
@@ -85,9 +86,11 @@ public static List getOthers() {
new LatexCleanupFormatter(),
new MinifyNameListFormatter(),
new NormalizeDateFormatter(),
+ new NormalizeIssn(),
new NormalizeMonthFormatter(),
new NormalizeNamesFormatter(),
new NormalizePagesFormatter(),
+ new NormalizeUnicodeFormatter(),
new OrdinalsToSuperscriptFormatter(),
new RemoveEnclosingBracesFormatter(),
new RemoveWordEnclosingAndOuterEnclosingBracesFormatter(),
@@ -96,7 +99,6 @@ public static List getOthers() {
new EscapeAmpersandsFormatter(),
new EscapeDollarSignFormatter(),
new ShortenDOIFormatter(),
- new NormalizeUnicodeFormatter(),
new ReplaceUnicodeLigaturesFormatter(),
new UnprotectTermsFormatter()
);
diff --git a/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssn.java b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssn.java
new file mode 100644
index 00000000000..6c8e82f757d
--- /dev/null
+++ b/jablib/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssn.java
@@ -0,0 +1,44 @@
+package org.jabref.logic.formatter.bibtexfields;
+
+import org.jabref.logic.cleanup.Formatter;
+import org.jabref.logic.l10n.Localization;
+import org.jabref.model.entry.identifier.ISSN;
+
+import org.jspecify.annotations.NonNull;
+
+public class NormalizeIssn extends Formatter {
+
+ @Override
+ public String getName() {
+ return Localization.lang("Normalize ISSN");
+ }
+
+ @Override
+ public String getKey() {
+ return "normalize_issn";
+ }
+
+ @Override
+ public String format(@NonNull String value) {
+ if (value.isBlank()) {
+ return value;
+ }
+
+ ISSN issn = new ISSN(value);
+
+ if (issn.isCanBeCleaned()) {
+ return issn.getCleanedISSN();
+ }
+ return value;
+ }
+
+ @Override
+ public String getDescription() {
+ return "Normalizes ISSNs by ensuring they contain a dash (e.g., 12345678 → 1234-5678)";
+ }
+
+ @Override
+ public String getExampleInput() {
+ return "12345678";
+ }
+}
diff --git a/jablib/src/main/resources/l10n/JabRef_en.properties b/jablib/src/main/resources/l10n/JabRef_en.properties
index 0473ea5ff3b..5a3c48724f2 100644
--- a/jablib/src/main/resources/l10n/JabRef_en.properties
+++ b/jablib/src/main/resources/l10n/JabRef_en.properties
@@ -1731,7 +1731,7 @@ Found\ touching\ ranges=Found touching ranges
Note\:\ Use\ the\ placeholder\ %DIR%\ for\ the\ location\ of\ the\ opened\ library\ file.=Note: Use the placeholder %DIR% for the location of the opened library file.
Error\ occurred\ while\ executing\ the\ command\ \"%0\".=Error occurred while executing the command \"%0\".
-Reformat\ ISSN=Reformat ISSN
+Normalize\ ISSN=Normalize ISSN
Computer\ science=Computer science
Countries\ and\ territories\ in\ English=Countries and territories in English
diff --git a/jablib/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java b/jablib/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java
index 95b6aca99bf..a36c7cb2a2f 100644
--- a/jablib/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java
+++ b/jablib/src/test/java/org/jabref/logic/cleanup/FieldFormatterCleanupsTest.java
@@ -339,6 +339,7 @@ void getMetaDataStringWorks() {
month[normalize_month]
all-text-fields[replace_unicode_ligatures]
keywords[MSC_codes_to_descriptions]
+ issn[normalize_issn]
""", FieldFormatterCleanups.getMetaDataString(FieldFormatterCleanups.DEFAULT_SAVE_ACTIONS, "\n"));
}
@@ -350,6 +351,7 @@ void parsingOfDefaultSaveActions() {
month[normalize_month]
all-text-fields[replace_unicode_ligatures]
keywords[MSC_codes_to_descriptions]
+ issn[normalize_issn]
"""));
}
diff --git a/jablib/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java b/jablib/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java
deleted file mode 100644
index 4bcadcde1c9..00000000000
--- a/jablib/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.jabref.logic.cleanup;
-
-import java.util.Optional;
-
-import org.jabref.logic.FilePreferences;
-import org.jabref.logic.preferences.TimestampPreferences;
-import org.jabref.model.database.BibDatabaseContext;
-import org.jabref.model.entry.BibEntry;
-import org.jabref.model.entry.field.StandardField;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.mock;
-
-class ISSNCleanupTest {
-
- private CleanupWorker worker;
-
- @BeforeEach
- void setUp() {
- worker = new CleanupWorker(
- mock(BibDatabaseContext.class),
- mock(FilePreferences.class),
- mock(TimestampPreferences.class));
- }
-
- @Test
- void cleanupISSNReturnsCorrectISSN() {
- CleanupPreferences preset = new CleanupPreferences(CleanupPreferences.CleanupStep.CLEAN_UP_ISSN);
- BibEntry entry = new BibEntry();
- entry.setField(StandardField.ISSN, "0123-4567");
-
- worker.cleanup(preset, entry);
- assertEquals(Optional.of("0123-4567"), entry.getField(StandardField.ISSN));
- }
-
- @Test
- void cleanupISSNAddsMissingDash() {
- CleanupPreferences preset = new CleanupPreferences(CleanupPreferences.CleanupStep.CLEAN_UP_ISSN);
- BibEntry entry = new BibEntry();
- entry.setField(StandardField.ISSN, "01234567");
-
- worker.cleanup(preset, entry);
- assertEquals(Optional.of("0123-4567"), entry.getField(StandardField.ISSN));
- }
-
- @Test
- void cleanupISSNJunkStaysJunk() {
- CleanupPreferences preset = new CleanupPreferences(CleanupPreferences.CleanupStep.CLEAN_UP_ISSN);
- BibEntry entry = new BibEntry();
- entry.setField(StandardField.ISSN, "Banana");
-
- worker.cleanup(preset, entry);
- assertEquals(Optional.of("Banana"), entry.getField(StandardField.ISSN));
- }
-}
diff --git a/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssnTest.java b/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssnTest.java
new file mode 100644
index 00000000000..c631df53df3
--- /dev/null
+++ b/jablib/src/test/java/org/jabref/logic/formatter/bibtexfields/NormalizeIssnTest.java
@@ -0,0 +1,22 @@
+package org.jabref.logic.formatter.bibtexfields;
+
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class NormalizeISSNTest {
+
+ private final NormalizeIssn formatISSN = new NormalizeIssn();
+
+ @ParameterizedTest
+ @CsvSource({
+ "0123-4567, 0123-4567",
+ "01234567, 0123-4567",
+ "Banana, Banana",
+ "'',''"
+ })
+ void issnFormatting(String input, String expected) {
+ assertEquals(expected, formatISSN.format(input));
+ }
+}