Skip to content

Commit 8cbe028

Browse files
committed
Merge remote-tracking branch 'upstream/master' into maintable-beta
* upstream/master: update gradle to 4.7 (#4049) Add missing translation for "HTML to Unicode" (#4046) New Crowdin translations (#4042) Use all-text-fields magic also in BibTeX cleanup. (#4039) Shortittle bibtexkeypattern now also discards small words (#4030)
2 parents 4f1299e + 08dff5d commit 8cbe028

File tree

11 files changed

+47
-34
lines changed

11 files changed

+47
-34
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
1313
### Changed
1414
- We added a text file export for 'Find Unlinked Files'. [#3341](https://github.com/JabRef/jabref/issues/3341)
1515
- We added a fetcher based on RFC-IDs. [#3971](https://github.com/JabRef/jabref/issues/3971)
16+
- We changed the implementation of the `[shorttitle]` key pattern. It now removes small words like `a`, `an`, `on`, `the` etc. Refer to the help page for a complete overview. [Feature request in the forum](http://discourse.jabref.org/t/jabref-differences-in-shorttitle-between-versions-3-8-1-and-4-not-discounting-the-a-an-of-in-titles/1147)
17+
- We streamlined the defaults for a [cleanup of entries](http://help.jabref.org/en/CleanupEntries) in the case of BibTeX.
1618

1719
### Fixed
1820
We fixed an issue where the export to clipboard functionality could not be invoked. [#3994](https://github.com/JabRef/jabref/issues/3994)

build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ dependencies {
149149

150150
compile 'com.github.tomtung:latex2unicode_2.12:0.2.2'
151151

152-
compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.1.0'
153-
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '2.1.0'
152+
compile group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '2.1.1'
153+
compile group: 'com.microsoft.azure', name: 'applicationinsights-logging-log4j2', version: '2.1.1'
154154

155155
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.2.0'
156156
testCompile 'org.junit.jupiter:junit-jupiter-params:5.2.0'
@@ -165,7 +165,7 @@ dependencies {
165165
testCompile 'org.reflections:reflections:0.9.11'
166166
testCompile 'org.xmlunit:xmlunit-core:2.6.0'
167167
testCompile 'org.xmlunit:xmlunit-matchers:2.6.0'
168-
testCompile 'com.tngtech.archunit:archunit-junit:0.5.0'
168+
testCompile 'com.tngtech.archunit:archunit-junit:0.8.0'
169169
testCompile "org.testfx:testfx-core:4.0.+"
170170
testCompile "org.testfx:testfx-junit5:4.0.+"
171171

gradle/wrapper/gradle-wrapper.jar

-4 Bytes
Binary file not shown.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip

src/main/java/org/jabref/logic/bibtexkeypattern/BracketedPattern.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ else if (val.matches("edtr\\d+")) {
294294
} else if ("fulltitle".equals(val)) {
295295
return entry.getResolvedFieldOrAlias(FieldName.TITLE, database).orElse("");
296296
} else if ("shorttitle".equals(val)) {
297-
return getTitleWords(3, entry.getResolvedFieldOrAlias(FieldName.TITLE, database).orElse(""));
297+
return getTitleWords(3,
298+
removeSmallWords(entry.getResolvedFieldOrAlias(FieldName.TITLE, database).orElse("")));
298299
} else if ("shorttitleINI".equals(val)) {
299300
return keepLettersAndDigitsOnly(
300301
applyModifiers(getTitleWordsWithSpaces(3, entry.getResolvedFieldOrAlias(FieldName.TITLE, database).orElse("")),

src/main/java/org/jabref/logic/cleanup/Cleanups.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,16 @@ public class Cleanups {
3636

3737
List<FieldFormatterCleanup> recommendedBibTeXFormatters = new ArrayList<>();
3838
recommendedBibTeXFormatters.addAll(defaultFormatters);
39-
recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToLatexFormatter()));
40-
recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new UnicodeToLatexFormatter()));
41-
recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.BOOKTITLE, new UnicodeToLatexFormatter()));
42-
recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.JOURNAL, new UnicodeToLatexFormatter()));
43-
recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.AUTHOR, new UnicodeToLatexFormatter()));
44-
recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.EDITOR, new UnicodeToLatexFormatter()));
39+
recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new HtmlToLatexFormatter()));
40+
recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new UnicodeToLatexFormatter()));
4541
recommendedBibTeXFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new OrdinalsToSuperscriptFormatter()));
4642
RECOMMEND_BIBTEX_ACTIONS = new FieldFormatterCleanups(false, recommendedBibTeXFormatters);
4743

4844
List<FieldFormatterCleanup> recommendedBiblatexFormatters = new ArrayList<>();
4945
recommendedBiblatexFormatters.addAll(defaultFormatters);
5046
recommendedBiblatexFormatters.add(new FieldFormatterCleanup(FieldName.TITLE, new HtmlToUnicodeFormatter()));
5147
recommendedBiblatexFormatters.add(new FieldFormatterCleanup(FieldName.INTERNAL_ALL_TEXT_FIELDS_FIELD, new LatexToUnicodeFormatter()));
48+
// DO NOT ADD OrdinalsToSuperscriptFormatter here, because this causes issues. See https://github.com/JabRef/jabref/issues/2596.
5249
RECOMMEND_BIBLATEX_ACTIONS = new FieldFormatterCleanups(false, recommendedBiblatexFormatters);
5350
}
5451

src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class HtmlToUnicodeFormatter implements LayoutFormatter, Formatter {
1212

1313
@Override
1414
public String getName() {
15-
return "HTML to Unicode";
15+
return Localization.lang("HTML to Unicode");
1616
}
1717

1818
@Override

src/main/resources/l10n/JabRef_en.properties

+1
Original file line numberDiff line numberDiff line change
@@ -1923,6 +1923,7 @@ Changes\ all\ letters\ to\ upper\ case.=Changes all letters to upper case.
19231923
Changes\ the\ first\ letter\ of\ all\ words\ to\ capital\ case\ and\ the\ remaining\ letters\ to\ lower\ case.=Changes the first letter of all words to capital case and the remaining letters to lower case.
19241924
Cleans\ up\ LaTeX\ code.=Cleans up LaTeX code.
19251925
Converts\ HTML\ code\ to\ LaTeX\ code.=Converts HTML code to LaTeX code.
1926+
HTML\ to\ Unicode=HTML to Unicode
19261927
Converts\ HTML\ code\ to\ Unicode.=Converts HTML code to Unicode.
19271928
Converts\ LaTeX\ encoding\ to\ Unicode\ characters.=Converts LaTeX encoding to Unicode characters.
19281929
Converts\ Unicode\ characters\ to\ LaTeX\ encoding.=Converts Unicode characters to LaTeX encoding.

src/main/resources/l10n/JabRef_vi.properties

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Accept\ change=Chấp nhận thay đổi
3737

3838
Action=Hành động
3939

40+
What\ is\ Mr.\ DLib?=Ông DLib là gì?
4041

4142
Add=Thêm
4243

@@ -46,7 +47,9 @@ The\ path\ need\ not\ be\ on\ the\ classpath\ of\ JabRef.=Đường dẫn không
4647
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.
4748
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.
4849

50+
Add\ a\ regular\ expression\ for\ the\ key\ pattern.=Thêm một biểu thức chính quy cho mẫu chính.
4951

52+
Add\ selected\ entries\ to\ this\ group=Thêm các mục đã chọn vào nhóm này
5053

5154
Add\ from\ folder=Thêm từ thư mục
5255

@@ -74,6 +77,7 @@ All\ entries\ of\ this\ type\ will\ be\ declared\ typeless.\ Continue?=Tất c
7477

7578
All\ fields=Tất cả các dữ liệu
7679

80+
Always\ reformat\ BIB\ file\ on\ save\ and\ export=Luôn luôn định dạng lại file BIB khi lưu và xuất
7781

7882
A\ SAX\ exception\ occurred\ while\ parsing\ '%0'\:=Một lỗi SAXException xảy ra khi đang phân tách '%0'\:
7983

@@ -439,6 +443,7 @@ Export\ properties=Các tính chất xuất
439443

440444
Export\ to\ clipboard=Xuất ra bộ nhớ tạm
441445

446+
442447
Exporting=Đang xuất
443448
Extension=Đuôi mở rộng
444449

src/test/java/org/jabref/logic/bibtexkeypattern/BibtexKeyGeneratorTest.java

+23-16
Original file line numberDiff line numberDiff line change
@@ -767,23 +767,30 @@ public void veryShortTitle() {
767767
*/
768768
@Test
769769
public void shortTitle() {
770-
// shortTitle is getTitleWords with "3" as count
770+
// shortTitle is getTitleWords with "3" as count and removed small words
771771
int count = 3;
772772
assertEquals("application migration effort",
773-
BibtexKeyGenerator.getTitleWords(count, TITLE_STRING_ALL_LOWER_FOUR_SMALL_WORDS_ONE_EN_DASH));
774-
assertEquals("BPEL conformance in", BibtexKeyGenerator.getTitleWords(count,
775-
TITLE_STRING_ALL_LOWER_FIRST_WORD_IN_BRACKETS_TWO_SMALL_WORDS_SMALL_WORD_AFTER_COLON));
776-
assertEquals("Process Viewing Patterns", BibtexKeyGenerator.getTitleWords(count, TITLE_STRING_CASED));
777-
assertEquals("BPMN Conformance in",
778-
BibtexKeyGenerator.getTitleWords(count, TITLE_STRING_CASED_ONE_UPPER_WORD_ONE_SMALL_WORD));
779-
assertEquals("The Difference Between", BibtexKeyGenerator.getTitleWords(count,
780-
TITLE_STRING_CASED_TWO_SMALL_WORDS_SMALL_WORD_AT_THE_BEGINNING));
781-
assertEquals("Cloud Computing: The",
782-
BibtexKeyGenerator.getTitleWords(count, TITLE_STRING_CASED_TWO_SMALL_WORDS_SMALL_WORD_AFTER_COLON));
773+
BibtexKeyGenerator.getTitleWords(count,
774+
BibtexKeyGenerator.removeSmallWords(TITLE_STRING_ALL_LOWER_FOUR_SMALL_WORDS_ONE_EN_DASH)));
775+
assertEquals("BPEL conformance open",
776+
BibtexKeyGenerator.getTitleWords(count,
777+
BibtexKeyGenerator.removeSmallWords(TITLE_STRING_ALL_LOWER_FIRST_WORD_IN_BRACKETS_TWO_SMALL_WORDS_SMALL_WORD_AFTER_COLON)));
778+
assertEquals("Process Viewing Patterns",
779+
BibtexKeyGenerator.getTitleWords(count,
780+
BibtexKeyGenerator.removeSmallWords(TITLE_STRING_CASED)));
781+
assertEquals("BPMN Conformance Open",
782+
BibtexKeyGenerator.getTitleWords(count,
783+
BibtexKeyGenerator.removeSmallWords(TITLE_STRING_CASED_ONE_UPPER_WORD_ONE_SMALL_WORD)));
784+
assertEquals("Difference Graph Based",
785+
BibtexKeyGenerator.getTitleWords(count,
786+
BibtexKeyGenerator.removeSmallWords(TITLE_STRING_CASED_TWO_SMALL_WORDS_SMALL_WORD_AT_THE_BEGINNING)));
787+
assertEquals("Cloud Computing: Next",
788+
BibtexKeyGenerator.getTitleWords(count,
789+
BibtexKeyGenerator.removeSmallWords(TITLE_STRING_CASED_TWO_SMALL_WORDS_SMALL_WORD_AFTER_COLON)));
783790
assertEquals("Towards Choreography based",
784-
BibtexKeyGenerator.getTitleWords(count, TITLE_STRING_CASED_TWO_SMALL_WORDS_ONE_CONNECTED_WORD));
785-
assertEquals("On the Measurement",
786-
BibtexKeyGenerator.getTitleWords(count, TITLE_STRING_CASED_FOUR_SMALL_WORDS_TWO_CONNECTED_WORDS));
791+
BibtexKeyGenerator.getTitleWords(count, BibtexKeyGenerator.removeSmallWords(TITLE_STRING_CASED_TWO_SMALL_WORDS_ONE_CONNECTED_WORD)));
792+
assertEquals("Measurement Design Time",
793+
BibtexKeyGenerator.getTitleWords(count, BibtexKeyGenerator.removeSmallWords(TITLE_STRING_CASED_FOUR_SMALL_WORDS_TWO_CONNECTED_WORDS)));
787794
}
788795

789796
/**
@@ -935,7 +942,7 @@ public void testApplyModifiers() {
935942
BibEntry entry = new BibEntry();
936943
entry.setField("title", "Green Scheduling of Whatever");
937944
assertEquals("GSo", BibtexKeyGenerator.generateKey(entry, "shorttitleINI"));
938-
assertEquals("GreenSchedulingof", BibtexKeyGenerator.generateKey(entry, "shorttitle",
945+
assertEquals("GreenSchedulingWhatever", BibtexKeyGenerator.generateKey(entry, "shorttitle",
939946
new BibDatabase()));
940947
}
941948

@@ -950,7 +957,7 @@ public void testcrossrefShorttitle() {
950957
database.insertEntry(entry1);
951958
entry2.setField("title", "Green Scheduling of Whatever");
952959

953-
assertEquals("GreenSchedulingof", BibtexKeyGenerator.generateKey(entry1, "shorttitle",
960+
assertEquals("GreenSchedulingWhatever", BibtexKeyGenerator.generateKey(entry1, "shorttitle",
954961
database));
955962
}
956963

src/test/java/org/jabref/logic/bibtexkeypattern/MakeLabelWithDatabaseTest.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -231,47 +231,47 @@ public void generateKeyTitleAbbr() {
231231
public void generateKeyShorttitle() {
232232
bibtexKeyPattern.setDefaultValue("[shorttitle]");
233233
new BibtexKeyGenerator(bibtexKeyPattern, database, preferences).generateAndSetKey(entry);
234-
assertEquals(Optional.of("Anawesomepaper"), entry.getCiteKeyOptional());
234+
assertEquals(Optional.of("awesomepaperJabRef"), entry.getCiteKeyOptional());
235235
}
236236

237237
@Test
238238
public void generateKeyShorttitleLowerModified() {
239239
bibtexKeyPattern.setDefaultValue("[shorttitle:lower]");
240240
entry.setField("title", "An aweSOme Paper on JabRef");
241241
new BibtexKeyGenerator(bibtexKeyPattern, database, preferences).generateAndSetKey(entry);
242-
assertEquals(Optional.of("anawesomepaper"), entry.getCiteKeyOptional());
242+
assertEquals(Optional.of("awesomepaperjabref"), entry.getCiteKeyOptional());
243243
}
244244

245245
@Test
246246
public void generateKeyShorttitleUpperModified() {
247247
bibtexKeyPattern.setDefaultValue("[shorttitle:upper]");
248248
entry.setField("title", "An aweSOme Paper on JabRef");
249249
new BibtexKeyGenerator(bibtexKeyPattern, database, preferences).generateAndSetKey(entry);
250-
assertEquals(Optional.of("ANAWESOMEPAPER"), entry.getCiteKeyOptional());
250+
assertEquals(Optional.of("AWESOMEPAPERJABREF"), entry.getCiteKeyOptional());
251251
}
252252

253253
@Test
254254
public void generateKeyShorttitleTitleCaseModified() {
255255
bibtexKeyPattern.setDefaultValue("[shorttitle:title_case]");
256256
entry.setField("title", "An aweSOme Paper on JabRef");
257257
new BibtexKeyGenerator(bibtexKeyPattern, database, preferences).generateAndSetKey(entry);
258-
assertEquals(Optional.of("AnAwesomePaper"), entry.getCiteKeyOptional());
258+
assertEquals(Optional.of("AwesomePaperJabref"), entry.getCiteKeyOptional());
259259
}
260260

261261
@Test
262262
public void generateKeyShorttitleSentenceCaseModified() {
263263
bibtexKeyPattern.setDefaultValue("[shorttitle:sentence_case]");
264264
entry.setField("title", "An aweSOme Paper on JabRef");
265265
new BibtexKeyGenerator(bibtexKeyPattern, database, preferences).generateAndSetKey(entry);
266-
assertEquals(Optional.of("Anawesomepaper"), entry.getCiteKeyOptional());
266+
assertEquals(Optional.of("Awesomepaperjabref"), entry.getCiteKeyOptional());
267267
}
268268

269269
@Test
270270
public void generateKeyShorttitleCapitalizeModified() {
271271
bibtexKeyPattern.setDefaultValue("[shorttitle:capitalize]");
272272
entry.setField("title", "An aweSOme Paper on JabRef");
273273
new BibtexKeyGenerator(bibtexKeyPattern, database, preferences).generateAndSetKey(entry);
274-
assertEquals(Optional.of("AnAwesomePaper"), entry.getCiteKeyOptional());
274+
assertEquals(Optional.of("AwesomePaperJabref"), entry.getCiteKeyOptional());
275275
}
276276

277277
@Test

0 commit comments

Comments
 (0)