diff --git a/CHANGELOG.md b/CHANGELOG.md index fce583ee507..fd0fe088430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ to [sourceforge feature requests](https://sourceforge.net/p/jabref/features/) by - Icons are shown as Header for icon columns in the entry table (#315) - Tooltips are shown for header columns and contents which are too wide to be displayed in the entry table (#384) - Default order in entry table: # | all file based icons (file, URL/DOI, ...) | all bibtex field based icons (bibtexkey, entrytype, author, title, ...) | all activated special field icons (ranking, quality, ...) +- Write all field keys in lower case. No more camel casing of field names. E.g., `title` is written instead of `Title`, `howpublished` instead of `HowPublished`, and `doi` instead of `DOI`. The configuration option `Use camel case for field names (e.g., "HowPublished" instead of "howpublished")` is gone. ### Fixed - Fixed #479: Import works again diff --git a/src/main/java/net/sf/jabref/JabRefPreferences.java b/src/main/java/net/sf/jabref/JabRefPreferences.java index 8c41232faea..ad295c5037e 100644 --- a/src/main/java/net/sf/jabref/JabRefPreferences.java +++ b/src/main/java/net/sf/jabref/JabRefPreferences.java @@ -264,7 +264,6 @@ public class JabRefPreferences { public static final String OVERWRITE_OWNER = "overwriteOwner"; public static final String USE_OWNER = "useOwner"; public static final String WRITEFIELD_ADDSPACES = "writeFieldAddSpaces"; - public static final String WRITEFIELD_CAMELCASENAME = "writeFieldCamelCase"; public static final String WRITEFIELD_SORTSTYLE = "writefieldSortStyle"; public static final String WRITEFIELD_USERDEFINEDORDER = "writefieldUserdefinedOrder"; public static final String WRITEFIELD_WRAPFIELD = "wrapFieldLine"; @@ -694,9 +693,8 @@ private JabRefPreferences() { defaults.put(GENERATE_KEYS_BEFORE_SAVING, Boolean.FALSE); - // behavior of JabRef before 2.10: both: false + // behavior of JabRef before 2.10: false defaults.put(WRITEFIELD_ADDSPACES, Boolean.TRUE); - defaults.put(WRITEFIELD_CAMELCASENAME, Boolean.TRUE); //behavior of JabRef before LWang_AdjustableFieldOrder 1 //0 sorted order (2.10 default), 1 unsorted order (2.9.2 default), 2 user defined diff --git a/src/main/java/net/sf/jabref/bibtex/BibtexEntryWriter.java b/src/main/java/net/sf/jabref/bibtex/BibtexEntryWriter.java index 8239a3eeccf..839b62f02d1 100644 --- a/src/main/java/net/sf/jabref/bibtex/BibtexEntryWriter.java +++ b/src/main/java/net/sf/jabref/bibtex/BibtexEntryWriter.java @@ -48,7 +48,6 @@ public class BibtexEntryWriter { private final LatexFieldFormatter fieldFormatter; private final boolean write; - private final boolean writeFieldCameCaseName = Globals.prefs.getBoolean(JabRefPreferences.WRITEFIELD_CAMELCASENAME); private final boolean writeFieldAddSpaces = Globals.prefs.getBoolean(JabRefPreferences.WRITEFIELD_ADDSPACES); private final boolean includeEmptyFields = Globals.prefs.getBoolean(JabRefPreferences.INCLUDE_EMPTY_FIELDS); private final int writeFieldSortStyle = Globals.prefs.getInt(JabRefPreferences.WRITEFIELD_SORTSTYLE); @@ -307,11 +306,12 @@ private boolean writeField(BibEntry entry, Writer out, String name, boolean prep * Get display version of a entry field. *

* BibTeX is case-insensitive therefore there is no difference between: - * howpublished, HOWPUBLISHED, HowPublished, etc. Since the camel case - * version is the most easy to read this should be the one written in the - * *.bib file. Since there is no way how do detect multi-word strings by - * default the first character will be made uppercase. In other characters - * case needs to be changed the {@link #tagDisplayNameMap} will be used. + * howpublished, HOWPUBLISHED, HowPublished, etc. + * + * The was a long discussion about how JabRef should write the fields. + * See https://github.com/JabRef/jabref/issues/116 + * + * The team decided to do the biber way and use lower case for the field names. * * @param field The name of the field. * @return The display version of the field name. @@ -331,11 +331,8 @@ private String getFieldDisplayName(String field) { String suffix = suffixSB.toString(); String result; - if (writeFieldCameCaseName) { - result = CamelCaser.toCamelCase(field) + suffix; - } else { - result = field + suffix; - } + result = field.toLowerCase() + suffix; + return result; } } diff --git a/src/main/java/net/sf/jabref/bibtex/CamelCaser.java b/src/main/java/net/sf/jabref/bibtex/CamelCaser.java deleted file mode 100644 index f0f32f8a439..00000000000 --- a/src/main/java/net/sf/jabref/bibtex/CamelCaser.java +++ /dev/null @@ -1,101 +0,0 @@ -package net.sf.jabref.bibtex; - -import java.util.HashMap; -import java.util.Map; - -class CamelCaser { - - /** - * Map that defines camel cased versions of field names - */ - private static final Map nameMap = new HashMap<>(); - - - static { - put("bibtexkey", "BibTeXKey"); - put("bookauthor", "BookAuthor"); - put("booksubtitle", "BookSubTitle"); - put("booktitle", "BookTitle"); - put("booktitleaddon", "BookTitleAddon"); - put("crossref", "CrossRef"); - put("ctlalt_stretch_factor", "CtlAlt_Stretch_Factor"); - put("ctldash_repeated_names", "CtlDash_Repeated_Names"); - put("ctlname_format_string", "CtlName_Format_String"); - put("ctlname_latex_cmd", "CtlName_Latex_Cmd"); - put("ctlname_url_prefix", "CtlName_Url_Prefix"); - put("ctlmax_names_forced_etal", "CtlMax_Names_Forced_Etal"); - put("ctlnames_show_etal", "CtlNames_Show_Etal"); - put("ctluse_alt_spacing", "CtlUse_Alt_Spacing"); - put("ctluse_article_number", "CtlUse_Article_Number"); - put("ctluse_forced_etal", "Ctl_Forced_Etal"); - put("ctluse_paper", "CtlUse_Paper"); - put("ctluse_url", "CtlUse_Url"); - put("dayfiled", "DayFiled"); - put("doi", "DOI"); - put("editora", "EditorA"); - put("editorb", "EditorB"); - put("editorc", "EditorC"); - put("ee", "EE"); - put("eid", "EID"); - put("entryset", "EntrySet"); - put("eprint", "Eprint"); - put("eprintclass", "EprintClass"); - put("eprinttype", "EprintType"); - put("eventdate", "EventDate"); - put("eventtitle", "EventTitle"); - put("eventtitleaddon", "EventTitleAddon"); - put("howpublished", "HowPublished"); - put("issuesubtitle", "IssueSubTitle"); - put("issuetitle", "IssueTitle"); - put("journalsubtitle", "JournalSubTitle"); - put("journaltitle", "JournalTitle"); - put("lastchecked", "LastChecked"); - put("isbn", "ISBN"); - put("isrn", "ISRN"); - put("issn", "ISSN"); - put("mainsubtitle", "MainSubTitle"); - put("maintitle", "MainTitle"); - put("maintitleaddon", "MainTitleAddon"); - put("monthfiled", "MonthFiled"); - put("origlanguage", "OrigLanguage"); - put("pagetotal", "PageTotal"); - put("pubstate", "PubState"); - put("subtitle", "SubTitle"); - put("titleaddon", "TitleAddon"); - put("UNKNOWN", "UNKNOWN"); - put("url", "Url"); - put("urldate", "UrlDate"); - put("yearfiled", "YearFiled"); - } - - /** - * Tries to provide a camel case version of fieldName. If no predefined camel case version can be found, the first letter is turned to upper case - * - * @param fieldName - * @return - */ - public static String toCamelCase(String fieldName) { - if ((fieldName == null) || fieldName.isEmpty()) { - return ""; - } - - String camelCaseName = nameMap.get(fieldName); - - // if there is no mapping for this name, turn the first letter to uppercase - if (camelCaseName == null) { - camelCaseName = (String.valueOf(fieldName.charAt(0))).toUpperCase() + fieldName.substring(1); - } - - return camelCaseName; - } - - /** - * Helper method to avoid a direct access to nameMap - * - * @param key a key to put in nameMap - * @param value the value to put in nameMap for key - */ - private static void put(String key, String value) { - nameMap.put(key, value); - } -} diff --git a/src/main/java/net/sf/jabref/gui/preftabs/FileTab.java b/src/main/java/net/sf/jabref/gui/preftabs/FileTab.java index 72ad12ea9ff..62560733b87 100644 --- a/src/main/java/net/sf/jabref/gui/preftabs/FileTab.java +++ b/src/main/java/net/sf/jabref/gui/preftabs/FileTab.java @@ -61,7 +61,6 @@ class FileTab extends JPanel implements PrefsTab { private final JCheckBox autoSave; private final JCheckBox promptBeforeUsingAutoSave; private final JCheckBox includeEmptyFields; - private final JCheckBox camelCase; private final JCheckBox sameColumn; private final JComboBox valueDelimiter; private final JComboBox newlineSeparator; @@ -93,7 +92,6 @@ public FileTab(JabRefFrame frame, JabRefPreferences prefs) { Localization.lang("Curly Brackets") + ": {, }"}); includeEmptyFields = new JCheckBox(Localization.lang("Include empty fields")); sameColumn = new JCheckBox(Localization.lang("Start field contents in same column")); - camelCase = new JCheckBox(Localization.lang("Use camel case for field names (e.g., \"HowPublished\" instead of \"howpublished\")")); resolveStringsAll = new JRadioButton(Localization.lang("Resolve strings for all fields except") + ":"); resolveStringsStandard = new JRadioButton(Localization.lang("Resolve strings for standard BibTeX fields only")); ButtonGroup bg = new ButtonGroup(); @@ -166,8 +164,6 @@ public void stateChanged(ChangeEvent changeEvent) { builder.nextLine(); builder.appendSeparator(Localization.lang("Field saving options")); builder.nextLine(); - builder.append(camelCase); - builder.nextLine(); builder.append(sameColumn); builder.append(new JPanel()); builder.nextLine(); @@ -279,7 +275,6 @@ public void setValues() { origAutoSaveSetting = autoSave.isSelected(); valueDelimiter.setSelectedIndex(prefs.getInt(JabRefPreferences.VALUE_DELIMITERS2)); includeEmptyFields.setSelected(prefs.getBoolean(JabRefPreferences.INCLUDE_EMPTY_FIELDS)); - camelCase.setSelected(prefs.getBoolean(JabRefPreferences.WRITEFIELD_CAMELCASENAME)); sameColumn.setSelected(prefs.getBoolean(JabRefPreferences.WRITEFIELD_ADDSPACES)); //for LWang_AdjustableFieldOrder @@ -315,7 +310,6 @@ public void storeSettings() { prefs.putInt(JabRefPreferences.AUTO_SAVE_INTERVAL, (Integer) autoSaveInterval.getValue()); prefs.putInt(JabRefPreferences.VALUE_DELIMITERS2, valueDelimiter.getSelectedIndex()); prefs.putBoolean(JabRefPreferences.INCLUDE_EMPTY_FIELDS, includeEmptyFields.isSelected()); - prefs.putBoolean(JabRefPreferences.WRITEFIELD_CAMELCASENAME, camelCase.isSelected()); prefs.putBoolean(JabRefPreferences.WRITEFIELD_ADDSPACES, sameColumn.isSelected()); doNotResolveStringsFor.setText(prefs.get(JabRefPreferences.DO_NOT_RESOLVE_STRINGS_FOR)); diff --git a/src/main/resources/l10n/JabRef_da.properties b/src/main/resources/l10n/JabRef_da.properties index 4c54795336d..bbf8ea2a711 100644 --- a/src/main/resources/l10n/JabRef_da.properties +++ b/src/main/resources/l10n/JabRef_da.properties @@ -1489,7 +1489,6 @@ Network= Please_specify_both_hostname_and_port= Port= Start_field_contents_in_same_column= -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")= Use_custom_proxy_configuration= Clear_connection_settings= Cleared_connection_settings.= diff --git a/src/main/resources/l10n/JabRef_de.properties b/src/main/resources/l10n/JabRef_de.properties index 822eecccbc9..81edd4b2833 100644 --- a/src/main/resources/l10n/JabRef_de.properties +++ b/src/main/resources/l10n/JabRef_de.properties @@ -2196,7 +2196,6 @@ Network=Netzwerk Please_specify_both_hostname_and_port=Bitte_geben_Sie_den_Namen_des_Hosts_und_den_Port_an Port=Port Start_field_contents_in_same_column=Feldinhalte_in_derselben_Spalte_beginnen -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")=Binnenmajuskeln_f\u00fcr_Feldnamen_benutzen_(z._B._"HowPublished"_statt_"howpublished") Use_custom_proxy_configuration=Benutzerdefinierte_Proxy-Konfiguration_verwenden Clear_connection_settings=Verbindungseinstellungen_zur\u00fccksetzen Cleared_connection_settings.=Verbindungseinstellungen_wurden_zur\u00fcckgesetzt. diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index 2a6e9bbe1b0..4b37cd38a32 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -2195,7 +2195,6 @@ Port=Port Please_specify_both_username_and_password=Please_specify_both_username_and_password Start_field_contents_in_same_column=Start_field_contents_in_same_column -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")=Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished") Use_custom_proxy_configuration=Use_custom_proxy_configuration Proxy_requires_authentication=Proxy_requires_authentication Attention\:_Password_is_stored_in_plain_text!=Attention\:_Password_is_stored_in_plain_text! diff --git a/src/main/resources/l10n/JabRef_es.properties b/src/main/resources/l10n/JabRef_es.properties index 2c2d562f879..8006fa1759c 100644 --- a/src/main/resources/l10n/JabRef_es.properties +++ b/src/main/resources/l10n/JabRef_es.properties @@ -1395,7 +1395,6 @@ Network=Red Please_specify_both_hostname_and_port=Especifique_tanto_nombre_de_host_como_puerto Port=Puerto Start_field_contents_in_same_column=Comenzar_los_contenidos_del_campo_en_la_misma_columna -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")=Usar_camel_case_para_nombres_de_campo_UEj._"VistaHermosa"_en_lugar_de_"vistahermosa") Use_custom_proxy_configuration=Usar_configuraci\u00f3n_de_proxy_personalizada Clear_connection_settings=Limpiar_ajustes_de_conexi\u00c3\u00b3n Cleared_connection_settings.=Ajustes_de_conexi\u00f3n_limpiados diff --git a/src/main/resources/l10n/JabRef_fa.properties b/src/main/resources/l10n/JabRef_fa.properties index 27c62f6abfb..b946319356f 100644 --- a/src/main/resources/l10n/JabRef_fa.properties +++ b/src/main/resources/l10n/JabRef_fa.properties @@ -2159,7 +2159,6 @@ Please_specify_both_hostname_and_port= Port= Start_field_contents_in_same_column= -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")= Use_custom_proxy_configuration= Clear_connection_settings= Cleared_connection_settings.= diff --git a/src/main/resources/l10n/JabRef_fr.properties b/src/main/resources/l10n/JabRef_fr.properties index ac22dbd4c5d..c5dd2786dbc 100644 --- a/src/main/resources/l10n/JabRef_fr.properties +++ b/src/main/resources/l10n/JabRef_fr.properties @@ -1432,7 +1432,6 @@ Network=R\u00e9seau Please_specify_both_hostname_and_port=Entrez_\u00e0_la_fois_le_nom_de_l'ordinateur_h\u00f4te_et_le_port,_s'il_vous_plait Port=Port Start_field_contents_in_same_column=D\u00e9marrer_les_contenus_du_champ_dans_une_m\u00eame_colonne -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")=Utiliser_des_majuscules_interm\u00e9diaires_pour_les_noms_de_champ_(par_ex.,_"HowPublished"_au_lieu_de_"howpublished") Use_custom_proxy_configuration=Utiliser_une_configuration_de_proxy_personnalis\u00e9e Clear_connection_settings=R\u00e9initialiser_les_param\u00e8tres_de_connexion Cleared_connection_settings.=Param\u00e8tres_de_connexion_r\u00e9initialis\u00e9s. diff --git a/src/main/resources/l10n/JabRef_in.properties b/src/main/resources/l10n/JabRef_in.properties index 2db75b08896..0cd1d7eb935 100644 --- a/src/main/resources/l10n/JabRef_in.properties +++ b/src/main/resources/l10n/JabRef_in.properties @@ -1410,7 +1410,6 @@ Network= Please_specify_both_hostname_and_port= Port= Start_field_contents_in_same_column= -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")= Use_custom_proxy_configuration= Clear_connection_settings= Cleared_connection_settings.= diff --git a/src/main/resources/l10n/JabRef_it.properties b/src/main/resources/l10n/JabRef_it.properties index ce99608a5b5..16acde70ad1 100644 --- a/src/main/resources/l10n/JabRef_it.properties +++ b/src/main/resources/l10n/JabRef_it.properties @@ -1511,7 +1511,6 @@ Network=Rete Please_specify_both_hostname_and_port=Specificare_sia_il_nome_dell'host_sia_il_numero_della_porta Port=Porta Start_field_contents_in_same_column=Inizia_i_contenuti_del_campo_nella_stessa_colonna -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")=Utilizza_le_maiuscole_intermedie_(camel_case)_per_i_nomi_dei_campi_(es_"HowPublished"_invece_di_"howpublished") Use_custom_proxy_configuration=Utilizza_una_configurazione_del_proxy_personalizzata. Clear_connection_settings=Reinizializza_i_parametri_di_connessione Cleared_connection_settings.=Parametri_di_connessione_reinizializzati diff --git a/src/main/resources/l10n/JabRef_ja.properties b/src/main/resources/l10n/JabRef_ja.properties index 93675961181..5acdcb2b27f 100644 --- a/src/main/resources/l10n/JabRef_ja.properties +++ b/src/main/resources/l10n/JabRef_ja.properties @@ -2180,7 +2180,6 @@ Network=\u30cd\u30c3\u30c8\u30ef\u30fc\u30af Please_specify_both_hostname_and_port=\u30db\u30b9\u30c8\u540d\u3068\u30dd\u30fc\u30c8\u306e\u4e21\u65b9\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044 Port=\u30dd\u30fc\u30c8 Start_field_contents_in_same_column=\u30d5\u30a3\u30fc\u30eb\u30c9\u5185\u5bb9\u3092\u540c\u3058\u30b3\u30e9\u30e0\u5185\u3067\u59cb\u3081\u308b -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")=\u30d5\u30a3\u30fc\u30eb\u30c9\u540d\u306b\u30ad\u30e3\u30e1\u30eb\u30b1\u30fc\u30b9\u3092\u7528\u3044\u308b\uff08\u4f8b\uff1a\u300chowpublished\u300d\u3092\u300cHowPublished\u300d\u3068\u3059\u308b\uff09 Use_custom_proxy_configuration=\u30e6\u30fc\u30b6\u30fc\u5b9a\u7fa9\u306e\u30d7\u30ed\u30ad\u30b7\u8a2d\u5b9a\u3092\u7528\u3044\u308b Clear_connection_settings=\u63a5\u7d9a\u8a2d\u5b9a\u3092\u6d88\u53bb\u3059\u308b Cleared_connection_settings.=\u63a5\u7d9a\u8a2d\u5b9a\u3092\u6d88\u53bb\u3057\u307e\u3057\u305f diff --git a/src/main/resources/l10n/JabRef_nl.properties b/src/main/resources/l10n/JabRef_nl.properties index 8523f425897..9fc98fcb549 100644 --- a/src/main/resources/l10n/JabRef_nl.properties +++ b/src/main/resources/l10n/JabRef_nl.properties @@ -2185,7 +2185,6 @@ Network=Netwerk Please_specify_both_hostname_and_port= Port=Poort Start_field_contents_in_same_column= -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")= Use_custom_proxy_configuration= Clear_connection_settings= Cleared_connection_settings.= diff --git a/src/main/resources/l10n/JabRef_no.properties b/src/main/resources/l10n/JabRef_no.properties index 00bb23899d4..c75bff91dab 100644 --- a/src/main/resources/l10n/JabRef_no.properties +++ b/src/main/resources/l10n/JabRef_no.properties @@ -2582,7 +2582,6 @@ Network= Please_specify_both_hostname_and_port= Port= Start_field_contents_in_same_column= -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")= Use_custom_proxy_configuration= Clear_connection_settings= Cleared_connection_settings.= diff --git a/src/main/resources/l10n/JabRef_pt_BR.properties b/src/main/resources/l10n/JabRef_pt_BR.properties index 71c4ade9d3b..8199d18f7da 100644 --- a/src/main/resources/l10n/JabRef_pt_BR.properties +++ b/src/main/resources/l10n/JabRef_pt_BR.properties @@ -1407,7 +1407,6 @@ Network=Rede Please_specify_both_hostname_and_port=Por_favor,_especifique_o_hostname_e_a_porta Port=Porta Start_field_contents_in_same_column=Iniciar_conte\u00fados_do_campo_na_mesma_coluna -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")=Usar_camel_case_para_nomes_de_campos_(ex._"HowPublished"_ao_inv\u00e9s_de_"howpublished") Use_custom_proxy_configuration=Usar_configura\u00e7\u00f5es_personalizadas_de_proxy Clear_connection_settings=Limpar_configura\u00e7\u00f5es_da_conex\u00e3o Cleared_connection_settings.=Configura\u00e7\u00f5es_de_conex\u00e3o_foram_limpas. diff --git a/src/main/resources/l10n/JabRef_ru.properties b/src/main/resources/l10n/JabRef_ru.properties index 492336f23c4..cf812923637 100644 --- a/src/main/resources/l10n/JabRef_ru.properties +++ b/src/main/resources/l10n/JabRef_ru.properties @@ -2185,7 +2185,6 @@ Please_specify_both_hostname_and_port=Укажите_имя_хоста_и_пор Port=Порт Start_field_contents_in_same_column=Запуск_содержимого_поля_в_той_же_колонке -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")=Использовать_написание_CamelCase_для_имен_полей_(напр.,_"HowPublished"_вместо_"howpublished") Use_custom_proxy_configuration=Использовать_пользовательские_настройки_прокси Clear_connection_settings=Удалить_настройки_подключения Cleared_connection_settings.=Настройки_подключения_удалены. diff --git a/src/main/resources/l10n/JabRef_tr.properties b/src/main/resources/l10n/JabRef_tr.properties index 75ffce594e2..e2371eae42a 100644 --- a/src/main/resources/l10n/JabRef_tr.properties +++ b/src/main/resources/l10n/JabRef_tr.properties @@ -1424,7 +1424,6 @@ Network=A\u011f Please_specify_both_hostname_and_port=L\u00fctfen_hem_makine_ad\u0131n\u0131_hem_de_ba\u011flant\u0131_noktas\u0131n\u0131_belirtin Port=Ba\u011flant\u0131_noktas\u0131 Start_field_contents_in_same_column=Alan_i\u00e7eri\u011fini_ayn\u0131_s\u00fctunda_ba\u015flat -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")=Alan_adlar\u0131_i\u00e7in_camel_case_kullan_(\u00f6rnek:_"yay\u0131n_\u015fekli"_yerine_"Yay\u0131n\u015eekli") Use_custom_proxy_configuration=\u00d6zelle\u015ftirilmi\u015f_vekil_konfig\u00fcrasyonu_kullan diff --git a/src/main/resources/l10n/JabRef_vi.properties b/src/main/resources/l10n/JabRef_vi.properties index 95fd3599aae..2f2302422e9 100644 --- a/src/main/resources/l10n/JabRef_vi.properties +++ b/src/main/resources/l10n/JabRef_vi.properties @@ -2177,7 +2177,6 @@ Network= Please_specify_both_hostname_and_port= Port= Start_field_contents_in_same_column= -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")= Use_custom_proxy_configuration= Clear_connection_settings= Cleared_connection_settings.= diff --git a/src/main/resources/l10n/JabRef_zh.properties b/src/main/resources/l10n/JabRef_zh.properties index 0254559025c..cd868e510f1 100644 --- a/src/main/resources/l10n/JabRef_zh.properties +++ b/src/main/resources/l10n/JabRef_zh.properties @@ -2177,7 +2177,6 @@ Network=\u7f51\u7edc Please_specify_both_hostname_and_port= Port=\u7aef\u53e3 Start_field_contents_in_same_column= -Use_camel_case_for_field_names_(e.g.,_"HowPublished"_instead_of_"howpublished")= Use_custom_proxy_configuration= Clear_connection_settings= Cleared_connection_settings.= diff --git a/src/test/java/net/sf/jabref/bibtex/BibEntryWriterTest.java b/src/test/java/net/sf/jabref/bibtex/BibEntryWriterTest.java index 2d27c7b490f..22813922803 100644 --- a/src/test/java/net/sf/jabref/bibtex/BibEntryWriterTest.java +++ b/src/test/java/net/sf/jabref/bibtex/BibEntryWriterTest.java @@ -28,8 +28,6 @@ public static void setUp() { Globals.prefs = JabRefPreferences.getInstance(); // make sure that we use the "new style" serialization Globals.prefs.putInt(JabRefPreferences.WRITEFIELD_SORTSTYLE, 0); - // make sure that we use camel casing - Globals.prefs.putBoolean(JabRefPreferences.WRITEFIELD_CAMELCASENAME, true); } @Before @@ -53,24 +51,28 @@ public void testSerialization() throws IOException { String actual = stringWriter.toString(); + // @formatter:off String expected = Globals.NEWLINE + Globals.NEWLINE + "@Article{," + Globals.NEWLINE + - " Author = {Foo Bar}," + Globals.NEWLINE + - " Journal = {International Journal of Something}," + Globals.NEWLINE + - " Note = {some note}," + Globals.NEWLINE + - " Number = {1}" + Globals.NEWLINE + + " author = {Foo Bar}," + Globals.NEWLINE + + " journal = {International Journal of Something}," + Globals.NEWLINE + + " note = {some note}," + Globals.NEWLINE + + " number = {1}" + Globals.NEWLINE + "}"; + // @formatter:on assertEquals(expected, actual); } @Test public void roundTripTest() throws IOException { + // @formatter:off String bibtexEntry = "@Article{test," + Globals.NEWLINE + " Author = {Foo Bar}," + Globals.NEWLINE + " Journal = {International Journal of Something}," + Globals.NEWLINE + " Note = {some note}," + Globals.NEWLINE + " Number = {1}" + Globals.NEWLINE + "}"; + // @formatter:on // read in bibtex string ParserResult result = BibtexParser.parse(new StringReader(bibtexEntry)); @@ -95,12 +97,14 @@ public void roundTripTest() throws IOException { @Test public void roundTripWithPrependingNewlines() throws IOException { + // @formatter:off String bibtexEntry = "\r\n@Article{test," + Globals.NEWLINE + " Author = {Foo Bar}," + Globals.NEWLINE + " Journal = {International Journal of Something}," + Globals.NEWLINE + " Note = {some note}," + Globals.NEWLINE + " Number = {1}" + Globals.NEWLINE + "}"; + // @formatter:on // read in bibtex string ParserResult result = BibtexParser.parse(new StringReader(bibtexEntry)); @@ -125,12 +129,14 @@ public void roundTripWithPrependingNewlines() throws IOException { @Test public void roundTripWithModification() throws IOException { + // @formatter:off String bibtexEntry = Globals.NEWLINE + "@Article{test," + Globals.NEWLINE + " Author = {Foo Bar}," + Globals.NEWLINE + " Journal = {International Journal of Something}," + Globals.NEWLINE + " Note = {some note}," + Globals.NEWLINE + " Number = {1}" + Globals.NEWLINE + "}"; + // @formatter:on // read in bibtex string ParserResult result = BibtexParser.parse(new StringReader(bibtexEntry)); @@ -141,34 +147,41 @@ public void roundTripWithModification() throws IOException { BibEntry entry = entries.iterator().next(); Assert.assertEquals("test", entry.getCiteKey()); Assert.assertEquals(5, entry.getFieldNames().size()); + + // Modify entry entry.setField("author", "BlaBla"); + Set fields = entry.getFieldNames(); Assert.assertTrue(fields.contains("author")); Assert.assertEquals("BlaBla", entry.getField("author")); - //write out bibtex string + // write out bibtex string StringWriter stringWriter = new StringWriter(); writer.write(entry, stringWriter); String actual = stringWriter.toString(); + // @formatter:off String expected = Globals.NEWLINE + Globals.NEWLINE + "@Article{test," + Globals.NEWLINE + - " Author = {BlaBla}," + Globals.NEWLINE + - " Journal = {International Journal of Something}," + Globals.NEWLINE + - " Note = {some note}," + Globals.NEWLINE + - " Number = {1}" + Globals.NEWLINE + + " author = {BlaBla}," + Globals.NEWLINE + + " journal = {International Journal of Something}," + Globals.NEWLINE + + " note = {some note}," + Globals.NEWLINE + + " number = {1}" + Globals.NEWLINE + "}"; + // @formatter:on assertEquals(expected, actual); } @Test - public void roundTripWithCamelCasing() throws IOException { + public void roundTripWithCamelCasingInTheOriginalEntryAndResultInLowerCase() throws IOException { + // @formatter:off String bibtexEntry = Globals.NEWLINE + "@Article{test," + Globals.NEWLINE + - " author = {Foo Bar}," + Globals.NEWLINE + - " journal = {International Journal of Something}," + Globals.NEWLINE + - " note = {some note}," + Globals.NEWLINE + + " Author = {Foo Bar}," + Globals.NEWLINE + + " Journal = {International Journal of Something}," + Globals.NEWLINE + + " Note = {some note}," + Globals.NEWLINE + " Number = {1}," + Globals.NEWLINE + - " howpublished = {asdf}" + Globals.NEWLINE + + " HowPublished = {asdf}" + Globals.NEWLINE + "}"; + // @formatter:on // read in bibtex string ParserResult result = BibtexParser.parse(new StringReader(bibtexEntry)); @@ -179,7 +192,10 @@ public void roundTripWithCamelCasing() throws IOException { BibEntry entry = entries.iterator().next(); Assert.assertEquals("test", entry.getCiteKey()); Assert.assertEquals(6, entry.getFieldNames().size()); + + // modify entry entry.setField("author", "BlaBla"); + Set fields = entry.getFieldNames(); Assert.assertTrue(fields.contains("author")); Assert.assertEquals("BlaBla", entry.getField("author")); @@ -190,24 +206,28 @@ public void roundTripWithCamelCasing() throws IOException { writer.write(entry, stringWriter); String actual = stringWriter.toString(); + // @formatter:off String expected = Globals.NEWLINE + Globals.NEWLINE + "@Article{test," + Globals.NEWLINE + - " Author = {BlaBla}," + Globals.NEWLINE + - " Journal = {International Journal of Something}," + Globals.NEWLINE + - " Note = {some note}," + Globals.NEWLINE + - " Number = {1}," + Globals.NEWLINE + - " HowPublished = {asdf}" + Globals.NEWLINE + + " author = {BlaBla}," + Globals.NEWLINE + + " journal = {International Journal of Something}," + Globals.NEWLINE + + " note = {some note}," + Globals.NEWLINE + + " number = {1}," + Globals.NEWLINE + + " howpublished = {asdf}" + Globals.NEWLINE + "}"; + // @formatter:on assertEquals(expected, actual); } @Test public void roundTripWithAppendedNewlines() throws IOException { + // @formatter:off String bibtexEntry = "@Article{test," + Globals.NEWLINE + " Author = {Foo Bar}," + Globals.NEWLINE + " Journal = {International Journal of Something}," + Globals.NEWLINE + " Note = {some note}," + Globals.NEWLINE + " Number = {1}" + Globals.NEWLINE + "}\n\n"; + // @formatter:on // read in bibtex string ParserResult result = BibtexParser.parse(new StringReader(bibtexEntry)); @@ -233,12 +253,14 @@ public void roundTripWithAppendedNewlines() throws IOException { @Test public void multipleWritesWithoutModification() throws IOException { + // @formatter:off String bibtexEntry = "@Article{test," + Globals.NEWLINE + " Author = {Foo Bar}," + Globals.NEWLINE + " Journal = {International Journal of Something}," + Globals.NEWLINE + " Note = {some note}," + Globals.NEWLINE + " Number = {1}" + Globals.NEWLINE + "}"; + // @formatter:on String result = testSingleWrite(bibtexEntry); result = testSingleWrite(result); @@ -272,11 +294,13 @@ private String testSingleWrite(String bibtexEntry) throws IOException { @Test public void monthFieldSpecialSyntax() throws IOException { + // @formatter:off String bibtexEntry = "@Article{test," + Globals.NEWLINE + " Author = {Foo Bar}," + Globals.NEWLINE + " Month = mar," + Globals.NEWLINE + " Number = {1}" + Globals.NEWLINE + "}"; + // @formatter:on // read in bibtex string ParserResult result = BibtexParser.parse(new StringReader(bibtexEntry));