Skip to content

Commit

Permalink
Fix #5551 - Don't remove unwanted characters before first author is s…
Browse files Browse the repository at this point in the history
…elected (#5558)
  • Loading branch information
Ka0o0 authored and tobiasdiez committed Nov 2, 2019
1 parent 4a93734 commit 224dde1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an exception which occurred when an invalid jstyle was loaded. [#5452](https://github.com/JabRef/jabref/issues/5452)
- We fixed an error where the preview theme did not adapt to the "Dark" mode [#5463](https://github.com/JabRef/jabref/issues/5463)
- We fixed an issue where the merge dialog showed the wrong text colour in "Dark" mode [#5516](https://github.com/JabRef/jabref/issues/5516)
- We fixed an issue where the author field was not correctly parsed during bibtex key-generation. [#5551](https://github.com/JabRef/jabref/issues/5551)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,8 +843,8 @@ public static String authNofMth(String authorField, int n, int m) {
* First N chars of the first author's last name.
*/
public static String authN(String authString, int num, boolean isEnforceLegalKey) {
authString = BibtexKeyGenerator.removeUnwantedCharacters(authString, isEnforceLegalKey);
String fa = firstAuthor(authString);
fa = BibtexKeyGenerator.removeUnwantedCharacters(fa, isEnforceLegalKey);
if (num > fa.length()) {
num = fa.length();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1087,4 +1087,13 @@ public void generateKeyWithMinusInCitationStyleOutsideAField() throws Exception

assertEquals("Newton-2019", BibtexKeyGenerator.generateKey(entry, "[auth]-[year]"));
}

@Test
public void generateKeyWithWithFirstNCharacters() throws Exception {
BibEntry entry = new BibEntry();
entry.setField(StandardField.AUTHOR, "Newton, Isaac");
entry.setField(StandardField.YEAR, "2019");

assertEquals("newt-2019", BibtexKeyGenerator.generateKey(entry, "[auth4:lower]-[year]"));
}
}

0 comments on commit 224dde1

Please sign in to comment.