Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));
}
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<CheckBox fx:id="cleanUpDOI" text="%Move DOIs from 'note' field and 'URL' field to 'DOI' field and remove http prefix" />
<CheckBox fx:id="cleanUpEprint" text="%Move preprint information from 'URL' field and 'journal' field to the 'eprint' field" />
<CheckBox fx:id="cleanUpURL" text="%Move URL in 'note' field to 'URL' field" />
<CheckBox fx:id="cleanUpISSN" text="%Reformat ISSN" />
<CheckBox fx:id="cleanUpBiblatex" text="%Convert to biblatex format (e.g., store publication date in date field)" />
<CheckBox fx:id="cleanUpBibtex" text="%Convert to BibTeX format (e.g., store publication date in year and month fields)" />
<CheckBox fx:id="cleanUpTimestampToCreationDate" text="%Convert timestamp field to field 'creationdate'" />
Expand All @@ -45,9 +44,9 @@
</VBox>
<CheckBox fx:id="cleanUpDeletedFiles" text="Remove links to non existent files" />
</VBox>
<FieldFormatterCleanupsPanel fx:id="formatterCleanupsPanel" />
<padding>
<Insets bottom="10.0" left="15.0" right="10.0" top="10.0" />
</padding>
<FieldFormatterCleanupsPanel fx:id="formatterCleanupsPanel" />
<padding>
<Insets bottom="10.0" left="15.0" right="10.0" top="10.0" />
</padding>

</fx:root>
Original file line number Diff line number Diff line change
Expand Up @@ -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());
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<FieldFormatterCleanup> recommendedBibtexFormatters = new ArrayList<>(DEFAULT_SAVE_ACTIONS);
recommendedBibtexFormatters.addAll(List.of(
Expand Down
29 changes: 0 additions & 29 deletions jablib/src/main/java/org/jabref/logic/cleanup/ISSNCleanup.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -85,9 +86,11 @@ public static List<Formatter> getOthers() {
new LatexCleanupFormatter(),
new MinifyNameListFormatter(),
new NormalizeDateFormatter(),
new NormalizeIssn(),
new NormalizeMonthFormatter(),
new NormalizeNamesFormatter(),
new NormalizePagesFormatter(),
new NormalizeUnicodeFormatter(),
new OrdinalsToSuperscriptFormatter(),
new RemoveEnclosingBracesFormatter(),
new RemoveWordEnclosingAndOuterEnclosingBracesFormatter(),
Expand All @@ -96,7 +99,6 @@ public static List<Formatter> getOthers() {
new EscapeAmpersandsFormatter(),
new EscapeDollarSignFormatter(),
new ShortenDOIFormatter(),
new NormalizeUnicodeFormatter(),
new ReplaceUnicodeLigaturesFormatter(),
new UnprotectTermsFormatter()
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
}
}
2 changes: 1 addition & 1 deletion jablib/src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand All @@ -350,6 +351,7 @@ void parsingOfDefaultSaveActions() {
month[normalize_month]
all-text-fields[replace_unicode_ligatures]
keywords[MSC_codes_to_descriptions]
issn[normalize_issn]
"""));
}

Expand Down
58 changes: 0 additions & 58 deletions jablib/src/test/java/org/jabref/logic/cleanup/ISSNCleanupTest.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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",
"'',''"
})
Comment on lines +13 to +18
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test data should use Arguments.of() instead of @CsvSource for better readability and maintainability in JUnit tests, following modern Java practices.

void issnFormatting(String input, String expected) {
assertEquals(expected, formatISSN.format(input));
}
}