Skip to content

Commit

Permalink
Merge pull request #3096 from snisnisniksonah/regexformatter
Browse files Browse the repository at this point in the history
Followup to 2663 Regexformatter
  • Loading branch information
LinusDietz authored Aug 16, 2017
2 parents 2ab908f + a5b2db0 commit d07d881
Show file tree
Hide file tree
Showing 27 changed files with 348 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- An error message is now displayed if you try to create a group containing the keyword separator or if there is already a group with the same name. [#3075](https://github.com/JabRef/jabref/issues/3075) and [#1495](https://github.com/JabRef/jabref/issues/1495)
- The FileAnnotationsTab was re-implemented in JavaFx. [#3082](https://github.com/JabRef/jabref/pull/3082)
- Integrity warnings are now directly displayed in the entry editor.
- We added the functionality to have `regex` as modifier. [#457](https://github.com/JabRef/jabref/issues/457)

### Fixed

Expand All @@ -24,6 +25,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We readded the undo mechanism for changes in the entry editor [#2973](https://github.com/JabRef/jabref/issues/2973)
- We fixed an issue where assigning an entry via drag and drop to a group caused JabRef to stop/freeze completely [#3036](https://github.com/JabRef/jabref/issues/3036)
- We fixed the shortcut <kbd>Ctrl</kbd>+<kbd>F</kbd> for the search field.
- We fixed an issue where `title_case` and `capitalize` modifiers did not work with shorttitle.
- We fixed an issue where the preferences could not be imported without a restart of JabRef [#3064](https://github.com/JabRef/jabref/issues/3064)
- We fixed an issue where <kbd>DEL</kbd>, <kbd>Ctrl</kbd>+<kbd>C</kbd>, <kbd>Ctrl</kbd>+<kbd>V</kbd> and <kbd>Ctrl</kbd>+<kbd>A</kbd> in the search field triggered corresponding actions in the main table [#3067](https://github.com/JabRef/jabref/issues/3067)
- We fixed an issue where JabRef freezed when editing an assigned file in the `General`-Tab [#2930, comment](https://github.com/JabRef/jabref/issues/2930#issuecomment-311050976)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ private static String getAddition(int number) {
* Determines "number" words out of the "title" field in the given BibTeX entry
*/
public static String getTitleWords(int number, String title) {
return keepLettersAndDigitsOnly(getTitleWordsWithSpaces(number, title));
return getTitleWordsWithSpaces(number, title);
}

/**
Expand Down
16 changes: 15 additions & 1 deletion src/main/java/org/jabref/logic/formatter/Formatters.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.jabref.logic.formatter.bibtexfields.NormalizeNamesFormatter;
import org.jabref.logic.formatter.bibtexfields.NormalizePagesFormatter;
import org.jabref.logic.formatter.bibtexfields.OrdinalsToSuperscriptFormatter;
import org.jabref.logic.formatter.bibtexfields.RegexFormatter;
import org.jabref.logic.formatter.bibtexfields.RemoveBracesFormatter;
import org.jabref.logic.formatter.bibtexfields.UnicodeToLatexFormatter;
import org.jabref.logic.formatter.bibtexfields.UnitsToLatexFormatter;
Expand Down Expand Up @@ -56,19 +57,32 @@ public class Formatters {
new NormalizeNamesFormatter(),
new NormalizePagesFormatter(),
new OrdinalsToSuperscriptFormatter(),
new RegexFormatter(),
new RemoveBracesFormatter(),
new UnitsToLatexFormatter(),
new EscapeUnderscoresFormatter()
);

public static final List<Formatter> ALL = new ArrayList<>();

private static final String REGEX = "regex";

private static final int LENGTH_OF_REGEX_PREFIX = REGEX.length();

private Formatters() {
}

public static Optional<Formatter> getFormatterForModifier(String modifier) {
Objects.requireNonNull(modifier);
Optional<Formatter> formatter = ALL.stream().filter(f -> f.getKey().equals(modifier)).findAny();
Optional<Formatter> formatter;

if (modifier.matches("regex.*")) {
String regex = modifier.substring(LENGTH_OF_REGEX_PREFIX);
RegexFormatter.setRegex(regex);
formatter = ALL.stream().filter(f -> f.getKey().equals("regex")).findAny();
} else {
formatter = ALL.stream().filter(f -> f.getKey().equals(modifier)).findAny();
}
if (formatter.isPresent()) {
return formatter;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package org.jabref.logic.formatter.bibtexfields;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.jabref.logic.l10n.Localization;
import org.jabref.model.cleanup.Formatter;

public class RegexFormatter implements Formatter {

private static final Pattern PATTERN_ESCAPED_OPENING_CURLY_BRACE = Pattern.compile("\\\\\\{");

private static final Pattern PATTERN_ESCAPED_CLOSING_CURLY_BRACE = Pattern.compile("\\\\\\}");

// RegEx to match {...}
// \\ is required to have the { interpreted as character
// ? is required to disable the aggressive match
private static final Pattern PATTERN_ENCLOSED_IN_CURLY_BRACES = Pattern.compile("(\\{.*?})");

// Magic arbitrary unicode char, which will never appear in bibtex files
private static final String PLACEHOLDER_FOR_PROTECTED_GROUP = Character.toString('\u0A14');

private static final String PLACEHOLDER_FOR_OPENING_CURLY_BRACE = Character.toString('\u0A15');

private static final String PLACEHOLDER_FOR_CLOSING_CURLY_BRACE = Character.toString('\u0A16');

private static final String QUOTE_AND_OPENING_BRACE = "\"(";

private static final int LENGTH_OF_QUOTE_AND_OPENING_BRACE = QUOTE_AND_OPENING_BRACE.length();

private static final String CLOSING_BRACE_AND_QUOTE = ")\"";

private static final int LENGTH_OF_CLOSING_BRACE_AND_QUOTE = CLOSING_BRACE_AND_QUOTE.length();

// stores the regex set by setRegex
private static String[] regex;

@Override
public String getName() {
return Localization.lang("regular_expression");
}

@Override
public String getKey() {
return "regex";
}

private String replaceHonoringProtectedGroups(final String input) {
Matcher matcher = PATTERN_ENCLOSED_IN_CURLY_BRACES.matcher(input);

List<String> replaced = new ArrayList<>();
while (matcher.find()) {
replaced.add(matcher.group(1));
}
String workingString = matcher.replaceAll(PLACEHOLDER_FOR_PROTECTED_GROUP);
workingString = workingString.replaceAll(RegexFormatter.regex[0], RegexFormatter.regex[1]);

for (String r : replaced) {
workingString = workingString.replaceFirst(PLACEHOLDER_FOR_PROTECTED_GROUP, r);
}
return workingString;
}

@Override
public String format(final String input) {
Objects.requireNonNull(input);
if (regex == null) {
return input;
}

Matcher matcherOpeningCurlyBrace = PATTERN_ESCAPED_OPENING_CURLY_BRACE.matcher(input);
final String openingCurlyBraceReplaced = matcherOpeningCurlyBrace.replaceAll(PLACEHOLDER_FOR_OPENING_CURLY_BRACE);

Matcher matcherClosingCurlyBrace = PATTERN_ESCAPED_CLOSING_CURLY_BRACE.matcher(openingCurlyBraceReplaced);
final String closingCurlyBraceReplaced = matcherClosingCurlyBrace.replaceAll(PLACEHOLDER_FOR_CLOSING_CURLY_BRACE);

final String regexApplied = replaceHonoringProtectedGroups(closingCurlyBraceReplaced);

return regexApplied
.replaceAll(PLACEHOLDER_FOR_OPENING_CURLY_BRACE, "\\\\{")
.replaceAll(PLACEHOLDER_FOR_CLOSING_CURLY_BRACE, "\\\\}");
}

@Override
public String getDescription() {
return Localization.lang("Add a regular expression for the key pattern.");
}

@Override
public String getExampleInput() {
return "Please replace the spaces";
}

public static void setRegex(String rex) {
// formatting is like ("exp1","exp2"), we want to remove (" and ")
String rexToSet = rex;
rexToSet = rexToSet.substring(LENGTH_OF_QUOTE_AND_OPENING_BRACE, rexToSet.length() - LENGTH_OF_CLOSING_BRACE_AND_QUOTE);
String[] parts = rexToSet.split("\",\"");
regex = parts;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public String getKey() {
}

/**
* Converts the first character of the first word of the given string to upper case (and the remaining characters of the first word to lower case), but does not change anything if word starts with "{"
* Converts the first character of the first word of the given string to upper case (and the remaining characters of the first word to lower case) and changes other words to lower case, but does not change anything if word starts with "{"
*/
@Override
public String format(String input) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=Stien_behøver_ikke_at_være_p
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Tilføj_en_kompileret_Importer-klasse_fra_en_ZIP-fil.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=ZIP-filen_behøver_ikke_at_være_i_din_classpath.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=Tilføj_fra_mappe
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=Das_Verzeichnis_muss_nicht_im_K
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Füge_eine_(kompilierte)_externe_Importer_Klasse_aus_Verzeichnis_hinzu.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=Das_Verzeichnis_muss_nicht_im_Klassenpfad_von_JabRef_enthalten_sein.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=Ausgewählte_Einträge_zu_dieser_Gruppe_hinzufügen

Add_from_folder=Aus_Klassenpfad_hinzufügen
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_el.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=The_path_need_not_be_on_the_cla
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=Προσθήκη_από_φάκελο
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=The_path_need_not_be_on_the_cla
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.

Add_a_regular_expression_for_the_key_pattern.=Add_a_regular_expression_for_the_key_pattern.

Add_selected_entries_to_this_group=Add_selected_entries_to_this_group

Add_from_folder=Add_from_folder
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=La_ruta_no_debe_estar_en_la_cla
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Añadir_una_clase_personalizada_(compilada)_Importer_desde_un_archivo_ZIP.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=El_archivo_ZIP_no_tiene_por_qué_estar_en_la_classpath_de_JabRef.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=Añadir_entradas_seleccionadas_a_este_grupo

Add_from_folder=Añadir_desde_carpeta
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_fa.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=Le_chemin_n'a_pas_besoin_d'êtr
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Ajouter_une_classe_Importer_personnalisée_(compilée)_à_partir_d'une_archive_ZIP.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=L'archive_ZIP_n'a_pas_besoin_d'être_dans_le_chemin_de_classe_de_JabRef.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=Ajouter_les_entrées_sélectionnées_à_ce_groupe

Add_from_folder=Ajouter_à_partir_du_répertoire
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_in.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=Lokasi_tidak_harus_pada_lokasi_
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Tambah_suaian_kelas_Importer_dari_arsip_ZIP.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=Lokasi_arsip_ZIP_tidak_harus_dalam_lokasi_kelas_JabRef.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=Tambah_dari_folder
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=Il_percorso_non_deve_necessaria
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Aggiungi_una_classe_Importer_personalizzata_(compilata)_da_un_archivio_ZIP.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=L'archivio_ZIP_non_deve_necessariamente_essere_nel_classpath_di_JabRef.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=Aggiungi_le_voci_selezionate_a_questo_gruppo

Add_from_folder=Aggiungi_da_una_cartella
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=このパスは、JabRefのク
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=(コンパイルした)ユーザー定義ImportFormatクラスをZIP書庫から追加します。
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=このZIP書庫は、JabRefのクラスパスにあるとは限りません。

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=フォルダから追加
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=Het_pad_moet_niet_in_het_classp
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Voeg_een_(gecompileerde)_externe_Importer_klasse_van_een_ZIP-archief_toe.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=Het_pad_moet_niet_in_het_classpath_van_JabRef_staan.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=Voeg_toe_uit_map
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_no.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=Stien_trenger_ikke_\u00e5_v\u00
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Legg_til_en_(kompilert)_egendefinert_Importer-klasse_fra_en_zip-fil.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=ZIP-filen_trenger_ikke_\u00e5_v\u00e6re_p\u00e5_JabRefs_classpath.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=Legg_til_fra_mappe
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=O_caminho_não_precisa_estar_no
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Adicionar_uma_classe_Importer_customizada_(compilada)_a_partir_de_um_arquivo_zip.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=O_arquivo_zip_não_precisa_estar_no_classpath_do_JabRef.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=Adicionar_a_partir_de_uma_pasta
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=Путь_может_не_сов
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Добавить_(скомпил.)_пользовательский_класс_Importer_из_ZIP-архива.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=ZIP-архив_может_не_совпадать_с_путем_классов_JabRef.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=Добавить_из_папки
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Lägg_till_en_(kompilerad)_Importer-klass_från_en_zip-fil.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=Lägg_till_från_mapp
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=Yolun_JabRef'in_sınıf_yolunda
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Bir_ZIP_arşivinden_(derlenmiş)_özel_İçeAlmaBiçemi_sınıfı_ekle.
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=Yolun_JabRef'in_sınıf_yolunda_olması_gerekmez.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=Seçili_girdileri_bu_gruba_ekle

Add_from_folder=Klasörden_ekle
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_vi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=Đường_dẫn_không_được
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=Thêm_một_lớp_ĐịnhdạngNhập_tùy_biến_(được_biên_dịch)_từ_một_tập_tin-zip._
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=Tập_tin-zip_không_được_trùng_với_đường_dẫn_lớp_của_JabRef.

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=

Add_from_folder=Thêm_từ_thư_mục
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/l10n/JabRef_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The_path_need_not_be_on_the_classpath_of_JabRef.=该路径不需要在_JabRef_
Add_a_(compiled)_custom_Importer_class_from_a_ZIP-archive.=从一个_ZIP_压缩包中添加(编译好的)自定义导入类。
The_ZIP-archive_need_not_be_on_the_classpath_of_JabRef.=该_ZIP_压缩包不需要在_JabRef_的_classpath_下。

Add_a_regular_expression_for_the_key_pattern.=

Add_selected_entries_to_this_group=添加选定记录到该组

Add_from_folder=从文件夹中添加
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,20 +674,20 @@ public void veryShortTitle() {
public void shortTitle() {
// shortTitle is getTitleWords with "3" as count
int count = 3;
assertEquals("applicationmigrationeffort",
assertEquals("application migration effort",
BibtexKeyPatternUtil.getTitleWords(count, TITLE_STRING_ALL_LOWER_FOUR_SMALL_WORDS_ONE_EN_DASH));
assertEquals("BPELconformancein", BibtexKeyPatternUtil.getTitleWords(count,
assertEquals("BPEL conformance in", BibtexKeyPatternUtil.getTitleWords(count,
TITLE_STRING_ALL_LOWER_FIRST_WORD_IN_BRACKETS_TWO_SMALL_WORDS_SMALL_WORD_AFTER_COLON));
assertEquals("ProcessViewingPatterns", BibtexKeyPatternUtil.getTitleWords(count, TITLE_STRING_CASED));
assertEquals("BPMNConformancein",
assertEquals("Process Viewing Patterns", BibtexKeyPatternUtil.getTitleWords(count, TITLE_STRING_CASED));
assertEquals("BPMN Conformance in",
BibtexKeyPatternUtil.getTitleWords(count, TITLE_STRING_CASED_ONE_UPPER_WORD_ONE_SMALL_WORD));
assertEquals("TheDifferenceBetween", BibtexKeyPatternUtil.getTitleWords(count,
assertEquals("The Difference Between", BibtexKeyPatternUtil.getTitleWords(count,
TITLE_STRING_CASED_TWO_SMALL_WORDS_SMALL_WORD_AT_THE_BEGINNING));
assertEquals("CloudComputingThe",
assertEquals("Cloud Computing: The",
BibtexKeyPatternUtil.getTitleWords(count, TITLE_STRING_CASED_TWO_SMALL_WORDS_SMALL_WORD_AFTER_COLON));
assertEquals("TowardsChoreographybased",
assertEquals("Towards Choreography based",
BibtexKeyPatternUtil.getTitleWords(count, TITLE_STRING_CASED_TWO_SMALL_WORDS_ONE_CONNECTED_WORD));
assertEquals("OntheMeasurement",
assertEquals("On the Measurement",
BibtexKeyPatternUtil.getTitleWords(count, TITLE_STRING_CASED_FOUR_SMALL_WORDS_TWO_CONNECTED_WORDS));
}

Expand Down Expand Up @@ -808,7 +808,7 @@ public void testApplyModifiers() {
BibEntry entry = new BibEntry();
entry.setField("title", "Green Scheduling of Whatever");
assertEquals("GSo", BibtexKeyPatternUtil.makeLabel(entry, "shorttitleINI", ',', new BibDatabase()));
assertEquals("GreenSchedulingof", BibtexKeyPatternUtil.makeLabel(entry, "shorttitle",
assertEquals("Green Scheduling of", BibtexKeyPatternUtil.makeLabel(entry, "shorttitle",
',', new BibDatabase()));
}

Expand Down
Loading

0 comments on commit d07d881

Please sign in to comment.