Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2471: remove line breaks from abstracts in ADS fetcher #3285

Merged
merged 6 commits into from
Oct 12, 2017
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 @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -152,6 +153,7 @@ public List<BibEntry> 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);

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_el.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_fa.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_in.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_no.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_vi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
3 changes: 3 additions & 0 deletions src/main/resources/l10n/JabRef_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.=
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down