diff --git a/CHANGELOG.md b/CHANGELOG.md index 6eab689c030..decb7a9c764 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We added bracketed expresion support for file search patterns, import file name patterns and file directory patters, in addition to bibtexkey patterns. - We added support for '[entrytype]' bracketed expression. - Updated French translation +- We improved the handling of abstracts in the "Astrophysics Data System" fetcher. [#2471](https://github.com/JabRef/jabref/issues/2471) - We added support for pasting entries in different formats [#3143](https://github.com/JabRef/jabref/issues/3143) - Crossreferenced entries are now used when a BibTex key is generated for an entry with empty fields. [#2811](https://github.com/JabRef/jabref/issues/2811) - We now set the WM_CLASS of the UI to org-jabref-JabRefMain to allow certain Un*x window managers to properly identify its windows diff --git a/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java new file mode 100644 index 00000000000..7563b9d4645 --- /dev/null +++ b/src/main/java/org/jabref/logic/formatter/bibtexfields/RemoveNewlinesFormatter.java @@ -0,0 +1,39 @@ +package org.jabref.logic.formatter.bibtexfields; + +import java.util.Objects; + +import org.jabref.logic.l10n.Localization; +import org.jabref.model.cleanup.Formatter; + +/** + * Removes all line breaks in the string. + */ +public class RemoveNewlinesFormatter implements Formatter { + + @Override + public String getName() { + return Localization.lang("Remove line breaks"); + } + + @Override + public String getKey() { + return "remove_newlines"; + } + + @Override + public String format(String value) { + Objects.requireNonNull(value); + + return value.replace("\r\n", " ").replace("\n", " ").trim(); + } + + @Override + public String getDescription() { + return Localization.lang("Removes all line breaks in the field content."); + } + + @Override + public String getExampleInput() { + return "In \n CDMA"; + } +} diff --git a/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java b/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java index 3decc40975f..f046c063eb7 100644 --- a/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java +++ b/src/main/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystem.java @@ -14,6 +14,7 @@ import org.jabref.logic.formatter.bibtexfields.ClearFormatter; import org.jabref.logic.formatter.bibtexfields.NormalizeNamesFormatter; import org.jabref.logic.formatter.bibtexfields.RemoveBracesFormatter; +import org.jabref.logic.formatter.bibtexfields.RemoveNewlinesFormatter; import org.jabref.logic.help.HelpFile; import org.jabref.logic.importer.EntryBasedParserFetcher; import org.jabref.logic.importer.FetcherException; @@ -152,6 +153,7 @@ public List performSearch(String query) throws FetcherException { @Override public void doPostCleanup(BibEntry entry) { new FieldFormatterCleanup(FieldName.ABSTRACT, new RemoveBracesFormatter()).cleanup(entry); + new FieldFormatterCleanup(FieldName.ABSTRACT, new RemoveNewlinesFormatter()).cleanup(entry); new FieldFormatterCleanup(FieldName.TITLE, new RemoveBracesFormatter()).cleanup(entry); new FieldFormatterCleanup(FieldName.AUTHOR, new NormalizeNamesFormatter()).cleanup(entry); diff --git a/src/main/resources/l10n/JabRef_da.properties b/src/main/resources/l10n/JabRef_da.properties index b4b46f453fc..978d679a952 100644 --- a/src/main/resources/l10n/JabRef_da.properties +++ b/src/main/resources/l10n/JabRef_da.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_de.properties b/src/main/resources/l10n/JabRef_de.properties index 7300163cad8..68b56847bf2 100644 --- a/src/main/resources/l10n/JabRef_de.properties +++ b/src/main/resources/l10n/JabRef_de.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.=Es_existiert_bereits_eine_Grupp Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_el.properties b/src/main/resources/l10n/JabRef_el.properties index 43f2df4e552..704ac28cd9e 100644 --- a/src/main/resources/l10n/JabRef_el.properties +++ b/src/main/resources/l10n/JabRef_el.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 31d23cd50df..5de9c8f7a14 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.=There_exists_already_a_group_wi Rename_failed=Rename_failed JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.=JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process. Show_console_output_(only_necessary_when_the_launcher_is_used)=Show_console_output_(only_necessary_when_the_launcher_is_used) + +Remove_line_breaks=Remove_line_breaks +Removes_all_line_breaks_in_the_field_content.=Removes_all_line_breaks_in_the_field_content. diff --git a/src/main/resources/l10n/JabRef_es.properties b/src/main/resources/l10n/JabRef_es.properties index af491a4146e..20043045d4a 100644 --- a/src/main/resources/l10n/JabRef_es.properties +++ b/src/main/resources/l10n/JabRef_es.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_fa.properties b/src/main/resources/l10n/JabRef_fa.properties index 102b3a8c4b9..4f9a0c38fca 100644 --- a/src/main/resources/l10n/JabRef_fa.properties +++ b/src/main/resources/l10n/JabRef_fa.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_fr.properties b/src/main/resources/l10n/JabRef_fr.properties index 21e0e48c030..5c504d8a064 100644 --- a/src/main/resources/l10n/JabRef_fr.properties +++ b/src/main/resources/l10n/JabRef_fr.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.=Un_groupe_portant_ce_nom_existe Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_in.properties b/src/main/resources/l10n/JabRef_in.properties index 5d03c3a5047..f29845abe08 100644 --- a/src/main/resources/l10n/JabRef_in.properties +++ b/src/main/resources/l10n/JabRef_in.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_it.properties b/src/main/resources/l10n/JabRef_it.properties index 1069fc75664..f12250fc5cf 100644 --- a/src/main/resources/l10n/JabRef_it.properties +++ b/src/main/resources/l10n/JabRef_it.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.=Esiste_già_almeno_un_gruppo_co Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_ja.properties b/src/main/resources/l10n/JabRef_ja.properties index 3c03cfa76e5..c8c690be38d 100644 --- a/src/main/resources/l10n/JabRef_ja.properties +++ b/src/main/resources/l10n/JabRef_ja.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.=同じ名称のグループが Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_nl.properties b/src/main/resources/l10n/JabRef_nl.properties index e8accdffdb6..85d3064821a 100644 --- a/src/main/resources/l10n/JabRef_nl.properties +++ b/src/main/resources/l10n/JabRef_nl.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_no.properties b/src/main/resources/l10n/JabRef_no.properties index 8f70543c1fd..e78dbe3edf2 100644 --- a/src/main/resources/l10n/JabRef_no.properties +++ b/src/main/resources/l10n/JabRef_no.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_pt_BR.properties b/src/main/resources/l10n/JabRef_pt_BR.properties index a9079256681..ac4fb03ff38 100644 --- a/src/main/resources/l10n/JabRef_pt_BR.properties +++ b/src/main/resources/l10n/JabRef_pt_BR.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_ru.properties b/src/main/resources/l10n/JabRef_ru.properties index 0b210c11eab..057db943883 100644 --- a/src/main/resources/l10n/JabRef_ru.properties +++ b/src/main/resources/l10n/JabRef_ru.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_sv.properties b/src/main/resources/l10n/JabRef_sv.properties index 7ea1f95cdba..7192c62c50f 100644 --- a/src/main/resources/l10n/JabRef_sv.properties +++ b/src/main/resources/l10n/JabRef_sv.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_tr.properties b/src/main/resources/l10n/JabRef_tr.properties index 68058161875..c7d311b2cb6 100644 --- a/src/main/resources/l10n/JabRef_tr.properties +++ b/src/main/resources/l10n/JabRef_tr.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.=Aynı_isimli_bir_grup_zaten_var Rename_failed=Yeniden_adlandırma_başarısız_oldu JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.=JabRef_dosyaya_erişemiyor_çünkü_dosya_başka_bir_süreç_tarafından_kullanılıyor. Show_console_output_(only_necessary_when_the_launcher_is_used)=Consol_çıktısını_göster_(sadece_başlatıcı_kullanıldığında_gereklidir) + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_vi.properties b/src/main/resources/l10n/JabRef_vi.properties index e45adaebef0..0ad26d424e4 100644 --- a/src/main/resources/l10n/JabRef_vi.properties +++ b/src/main/resources/l10n/JabRef_vi.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/main/resources/l10n/JabRef_zh.properties b/src/main/resources/l10n/JabRef_zh.properties index d1396aa2c53..1b3abe4cf26 100644 --- a/src/main/resources/l10n/JabRef_zh.properties +++ b/src/main/resources/l10n/JabRef_zh.properties @@ -2345,3 +2345,6 @@ There_exists_already_a_group_with_the_same_name.= Rename_failed= JabRef_cannot_access_the_file_because_it_is_being_used_by_another_process.= Show_console_output_(only_necessary_when_the_launcher_is_used)= + +Remove_line_breaks= +Removes_all_line_breaks_in_the_field_content.= diff --git a/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java b/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java index c029d4ecc24..af2084e2d43 100644 --- a/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java +++ b/src/test/java/org/jabref/logic/importer/fetcher/AstrophysicsDataSystemTest.java @@ -49,21 +49,21 @@ public void setUp() throws Exception { diezSliceTheoremEntry.setField("primaryclass", "math-ph"); diezSliceTheoremEntry.setField("url", "http://adsabs.harvard.edu/abs/2014arXiv1405.2249D"); diezSliceTheoremEntry.setField("abstract", - "A general slice theorem for the action of a Fr$\\backslash$'echet Lie group on a" + NEWLINE - + "Fr$\\backslash$'echet manifolds is established. The Nash-Moser theorem provides the" + NEWLINE - + "fundamental tool to generalize the result of Palais to this" + NEWLINE - + "infinite-dimensional setting. The presented slice theorem is illustrated" + NEWLINE - + "by its application to gauge theories: the action of the gauge" + NEWLINE - + "transformation group admits smooth slices at every point and thus the" + NEWLINE - + "gauge orbit space is stratified by Fr$\\backslash$'echet manifolds. Furthermore, a" + NEWLINE - + "covariant and symplectic formulation of classical field theory is" + NEWLINE - + "proposed and extensively discussed. At the root of this novel framework" + NEWLINE - + "is the incorporation of field degrees of freedom F and spacetime M into" + NEWLINE - + "the product manifold F * M. The induced bigrading of differential forms" + NEWLINE - + "is used in order to carry over the usual symplectic theory to this new" + NEWLINE - + "setting. The examples of the Klein-Gordon field and general Yang-Mills" + NEWLINE - + "theory illustrate that the presented approach conveniently handles the" + NEWLINE - + "occurring symmetries." + NEWLINE); + "A general slice theorem for the action of a Fr$\\backslash$'echet Lie group on a " + + "Fr$\\backslash$'echet manifolds is established. The Nash-Moser theorem provides the " + + "fundamental tool to generalize the result of Palais to this " + + "infinite-dimensional setting. The presented slice theorem is illustrated " + + "by its application to gauge theories: the action of the gauge " + + "transformation group admits smooth slices at every point and thus the " + + "gauge orbit space is stratified by Fr$\\backslash$'echet manifolds. Furthermore, a " + + "covariant and symplectic formulation of classical field theory is " + + "proposed and extensively discussed. At the root of this novel framework " + + "is the incorporation of field degrees of freedom F and spacetime M into " + + "the product manifold F * M. The induced bigrading of differential forms " + + "is used in order to carry over the usual symplectic theory to this new " + + "setting. The examples of the Klein-Gordon field and general Yang-Mills " + + "theory illustrate that the presented approach conveniently handles the " + + "occurring symmetries."); famaeyMcGaughEntry = new BibEntry(); famaeyMcGaughEntry.setType(BiblatexEntryTypes.ARTICLE);