Skip to content

Commit

Permalink
Change default behavior of resolve bibtex strings
Browse files Browse the repository at this point in the history
Fixes #7010
Fixes #7012
Fixes #8303
  • Loading branch information
Siedlerchr committed Jan 3, 2022
1 parent 617c5a1 commit e69c84f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
### Changed

- We integrated the external file types dialog directly inside the preferences. [#8341](https://github.com/JabRef/jabref/pull/8341)
- We disabled BibTeX String resolving by default for the fields `url`, `abstract`, `note`, `comment`, `doi` and `file` to keep #-chars [#7010](https://github.com/JabRef/jabref/issues/7010), [#7102](https://github.com/JabRef/jabref/issues/7012), [#8303]((https://github.com/JabRef/jabref/issues/8303))

### Fixed

- We fixed an issue where #-chars in certain fields would be interpreted as BibTeX-Strings [#7010](https://github.com/JabRef/jabref/issues/7010), [#7102](https://github.com/JabRef/jabref/issues/7012), [#8303]((https://github.com/JabRef/jabref/issues/8303))
- We fixed an issue where clicking on "Accept changes" in the merge dialog would lead to an exception [forum#2418](https://discourse.jabref.org/t/the-library-has-been-modified-by-another-program/2418/8)
- We fixed an issue where clicking on headings in the entry preview could lead to an exception. [#8292](https://github.com/JabRef/jabref/issues/8292)
- We fixed an issue where IntegrityCheck used the system's character encoding instead of the one set by the library or in preferences [#8022](https://github.com/JabRef/jabref/issues/8022)
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/jabref/migrations/PreferencesMigrations.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public static void runMigrations() {
upgradeColumnPreferences(Globals.prefs);
restoreVariablesForBackwardCompatibility(Globals.prefs);
upgradePreviewStyleAllowMarkdown(Globals.prefs);
migrateDoNotResolveFields(Globals.prefs);
}

/**
Expand Down Expand Up @@ -290,6 +291,18 @@ private static void addCrossRefRelatedFieldsForAutoComplete(JabRefPreferences pr
prefs.putStringList(JabRefPreferences.AUTOCOMPLETER_COMPLETE_FIELDS, new ArrayList<>(keys));
}

private static void migrateDoNotResolveFields(JabRefPreferences prefs) {
Set<String> keys = new LinkedHashSet<>(prefs.getStringList(JabRefPreferences.DO_NOT_RESOLVE_STRINGS_FOR));
keys.add("url");
keys.add("abstract");
keys.add("note");
keys.add("comment");
keys.add("doi");
keys.add("eprint");
keys.add("file");
prefs.putStringList(JabRefPreferences.DO_NOT_RESOLVE_STRINGS_FOR, new ArrayList<>(keys));
}

private static void migrateTypedKeyPrefs(JabRefPreferences prefs, Preferences oldPatternPrefs)
throws BackingStoreException {
LOGGER.info("Found old Bibtex Key patterns which will be migrated to new version.");
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public class JabRefPreferences implements PreferencesService {

public static final String WARN_ABOUT_DUPLICATES_IN_INSPECTION = "warnAboutDuplicatesInInspection";
public static final String NON_WRAPPABLE_FIELDS = "nonWrappableFields";
public static final String RESOLVE_STRINGS_ALL_FIELDS = "resolveStringsAllFields";
public static final String RESOLVE_STRINGS_ALL_FIELDS = "resolveStringsAllFields55";
public static final String DO_NOT_RESOLVE_STRINGS_FOR = "doNotResolveStringsFor";
public static final String MERGE_ENTRIES_DIFF_MODE = "mergeEntriesDiffMode";
public static final String CUSTOM_EXPORT_FORMAT = "customExportFormat";
Expand Down Expand Up @@ -631,8 +631,8 @@ private JabRefPreferences() {
defaults.put(CONFIRM_DELETE, Boolean.TRUE);
defaults.put(DEFAULT_CITATION_KEY_PATTERN, "[auth][year]");
defaults.put(UNWANTED_CITATION_KEY_CHARACTERS, "-`ʹ:!;?^+");
defaults.put(DO_NOT_RESOLVE_STRINGS_FOR, StandardField.URL.getName());
defaults.put(RESOLVE_STRINGS_ALL_FIELDS, Boolean.FALSE);
defaults.put(DO_NOT_RESOLVE_STRINGS_FOR, "url;abstract;note;comment;doi;eprint;file");
defaults.put(RESOLVE_STRINGS_ALL_FIELDS, Boolean.TRUE);
defaults.put(NON_WRAPPABLE_FIELDS, "pdf;ps;url;doi;file;isbn;issn");
defaults.put(WARN_ABOUT_DUPLICATES_IN_INSPECTION, Boolean.TRUE);
defaults.put(ADD_CREATION_DATE, Boolean.FALSE);
Expand Down

0 comments on commit e69c84f

Please sign in to comment.