diff --git a/CHANGELOG.md b/CHANGELOG.md index fe7c548e02f..355c620c2b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,12 +14,14 @@ 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 inverted the logic for resolving [BibTeX strings](https://docs.jabref.org/advanced/strings). This helps to keep `#` chars. By default String resolving is only activated for a couple of standard fields. The list of fields can be modified in the preferences. [#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 moved the search box in preview preferences closer to the available citation styles list. [#8370](https://github.com/JabRef/jabref/pull/8370) - Changing the preference to show the preview panel as a separate tab now has effect without restarting JabRef. [#8370](https://github.com/JabRef/jabref/pull/8370) - We enabled switching themes in JabRef without the need to restart JabRef. [#7335](https://github.com/JabRef/jabref/pull/7335) ### 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 the fulltext search on an empty library with no documents would lead to an exception [koppor#522](https://github.com/koppor/jabref/issues/522) - 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) diff --git a/docs/adr.md b/docs/adr.md index cd80bb6457c..856d60a72b9 100644 --- a/docs/adr.md +++ b/docs/adr.md @@ -21,10 +21,11 @@ Architectural decisions for JabRef: * [ADR-0016](https://github.com/JabRef/jabref/tree/main/docs/adr/0016-mutable-preferences-objects.md) - Mutable preferences objects * [ADR-0017](https://github.com/JabRef/jabref/tree/main/docs/adr/0017-allow-model-access-logic.md) - Allow org.jabref.model to access org.jabref.logic * [ADR-0018](https://github.com/JabRef/jabref/blob/main/docs/adr/0018-use-regular-expression-to-split-multiple-sentence-titles.md) - Use regular expression to split multiple-sentence titles -* [ADR-0019](https://github.com/JabRef/jabref/blob/main/docs/adr/0019-implement-special-fields-as-seperate-fields.md) - Implement special fields as seperate fields +* [ADR-0019](https://github.com/JabRef/jabref/blob/main/docs/adr/0019-implement-special-fields-as-seperate-fields.md) - Implement special fields as separate fields * [ADR-0020](https://github.com/JabRef/jabref/blob/main/docs/adr/0020-use-Jackson-to-parse-study-yml.md) - Use Jackson to parse study.yml * [ADR-0021](https://github.com/JabRef/jabref/blob/main/docs/adr/0021-keep-study-as-a-dto.md) - Keep study as a DTO * [ADR-0022](https://github.com/JabRef/jabref/blob/main/docs/adr/0022-remove-stop-words-during-query-transformation.md) - Remove stop words during query transformation * [ADR-0023](https://github.com/JabRef/jabref/blob/main/docs/adr/0023-localized-preferences.md) - Localized Preferences +* [ADR-0024](https://github.com/JabRef/jabref/blob/main/docs/adr/0024-use-#-as-indicator-for-BibTeX-string-constants.md) - Use `#` as indicator for BibTeX string constants For new ADRs, please use [template.md](https://github.com/JabRef/jabref/tree/main/docs/adr/template.md) as basis. More information on the used format is available at [https://adr.github.io/madr/](https://adr.github.io/madr/). General information about architectural decision records is available at [https://adr.github.io/](https://adr.github.io/). Then add them to the above list. diff --git a/docs/adr/0019-implement-special-fields-as-seperate-fields.md b/docs/adr/0019-implement-special-fields-as-separate-fields.md similarity index 98% rename from docs/adr/0019-implement-special-fields-as-seperate-fields.md rename to docs/adr/0019-implement-special-fields-as-separate-fields.md index 06ef4760e91..2083c9eb73b 100644 --- a/docs/adr/0019-implement-special-fields-as-seperate-fields.md +++ b/docs/adr/0019-implement-special-fields-as-separate-fields.md @@ -1,4 +1,4 @@ -# Implement special fields as seperate fields +# Implement special fields as separate fields ## Context and Problem Statement diff --git a/docs/adr/0024-use-#-as-indicator-for-BibTeX-string-constants.md b/docs/adr/0024-use-#-as-indicator-for-BibTeX-string-constants.md new file mode 100644 index 00000000000..edeb27c150c --- /dev/null +++ b/docs/adr/0024-use-#-as-indicator-for-BibTeX-string-constants.md @@ -0,0 +1,133 @@ +# Use `#` as indicator for BibTeX string constants + +Bibtex supports string constants. The entry editor should support that, too. +Affected code is (at least) `org.jabref.logic.importer.fileformat.BibtexParser#parseFieldContent` and `org.jabref.logic.bibtex.FieldWriter#formatAndResolveStrings` + +## Decision Drivers + +* Full BibTeX compatibility +* Intuitive for the user +* UI backwards compatible + +## Considered Options + +* Wrap string constants in `#` +* Replace the internal `#` in JabRef by the non-used character `§` +* Replace the internal `#` in JabRef by the non-used character `%` +* Replace the internal `#` in JabRef by the non-used character `&` +* Replace the internal `#` in JabRef by a single `&` +* Change the data type of a field value +* Wrap plan # in curly braces: `{#}` + +## Decision Outcome + +Chosen option: "Wrap string constants in #", because already existing behavior + +## Pros and Cons of the Options + +### Wrap string constants in `#` + +When BibTeX on the disk contains `field = value`, it is rendered as `field = #value#` in the entry editor. The user then knows that `value` is a BibTeX string. + +Example: + +left: BibTeX; right: Entry Editor + +```text +@String{ value = "example" } + +field1 = value -> #value# +field2 = {value} -> value + +field1 = value # value --> #value# # #value# +``` + +* Good, because In place in JabRef since more than 10 years +* Bad, because `#` is used in BibTeX for string concatenation +* Bad, because `#` is used in Markdown to indicate headings. When using Markdown in fields such as comments, this causes writing errors +* Bad, because `#` could appear in URLs + +### Replace the internal `#` in JabRef by the non-used character `§` + +When BibTeX on the disk contains `field = value`, it is rendered as `field = §value§` in the entry editor. The user then knows that `value` is a BibTeX string. + +Example: + +left: BibTeX; right: Entry Editor + +```text +field1 = value -> §value§ +field2 = {value} -> value + +field1 = value # value --> §value§ # §value§ +``` + +* Good, because Easy to implement +* Good, because No conflict with BibTeX's `#` sign +* Bad, because Documentation needs to be updated +* Bad, because `§` is not available on an US keyboard + +### Replace the internal `#` in JabRef by the non-used character `%` + +Similar to "Replace the internal # in JabRef by the non-used character §" + +Example: + +left: BibTeX; right: Entry Editor + +```text +field1 = value -> %value% +field2 = {value} -> value + +field1 = value # value --> %value% # %value% +``` + +* Good, because A user does not write LaTeX comments inside a string +* Bad, because `%` could be used in Markdown, too +* Bad, because `%` is used for comments in LaTeX and thus migtht cause confusion +* Bad, because `%` could appear in URLs: There is [url percent encoding](https://www.w3schools.com/tags/ref_urlencode.asp) + +### Replace the internal `#` in JabRef by the non-used character `&` + +Similar to "Replace the internal `#` in JabRef by the non-used character `§`" + +Example: + +left: BibTeX; right: Entry Editor + +```text +field1 = value -> &value& +field2 = {value} -> value + +field1 = value # value --> &value& # &value& +``` + +* Good, because Users do not write LaTeX tables +* Bad, because `&` is a LaTeX command for tables + +### Replace the internal `#` in JabRef by a single `&` + +Prefix strings with `&` + +Example: + +left: BibTeX; right: Entry Editor + +```text +field1 = value -> &value +field2 = {value} -> value + +field1 = value # value --> &value # &value +``` + +* Good, because Near to C syntax +* Bad, because `&` is a LaTeX command for tables +* Bad, because `&` could appear in URLs + +### Change the data type of a field value + +`org.jabref.model.entry.BibEntry#setField(org.jabref.model.entry.field.Field, java.lang.String)` changes to `org.jabref.model.entry.BibEntry#setField(org.jabref.model.entry.field.Field, org.jabref.model.entry.field.Value)` (org.jabref.model.entry.BibEntry#setField(org.jabref.model.entry.field.Field, java.lang.String)). This would bring JabRef's internal data model even more close to BibTeX + +* Good, because More object-orientated design of BibTeX field storage +* Good, because Easies implementation of an advanced field editor +* Bad, because High effort to implement diff --git a/src/main/java/org/jabref/gui/preferences/file/FileTab.fxml b/src/main/java/org/jabref/gui/preferences/file/FileTab.fxml index 8cc56872d65..b85c021f419 100644 --- a/src/main/java/org/jabref/gui/preferences/file/FileTab.fxml +++ b/src/main/java/org/jabref/gui/preferences/file/FileTab.fxml @@ -1,9 +1,7 @@ - - @@ -15,27 +13,34 @@ xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" fx:controller="org.jabref.gui.preferences.file.FileTab">