From ac58d2c32faa29b78491aeb7e49f92eed63a558b Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Thu, 25 Aug 2016 09:03:37 +0200 Subject: [PATCH] Allow setting the etal-string empty. Implements #1841 --- CHANGELOG.md | 1 + .../java/net/sf/jabref/logic/layout/format/Authors.java | 2 +- .../net/sf/jabref/logic/layout/format/AuthorsTest.java | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4fc5d536ad..19e615822b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - [#1758](https://github.com/JabRef/jabref/issues/1758) Added a button to open Database Properties dialog help - Improve focus of the maintable after a sidepane gets closed (Before it would focus the toolbar or it would focus the wrong entry) - File open dialogs now use default extensions as primary file filter +- [#1841](https://github.com/JabRef/jabref/issues/1841) The "etal"-string in the Authors layout formatter can now be empty ### Fixed - Fixed [#1760](https://github.com/JabRef/jabref/issues/1760): Preview updated correctly when selecting a single entry after selecting multiple entries diff --git a/src/main/java/net/sf/jabref/logic/layout/format/Authors.java b/src/main/java/net/sf/jabref/logic/layout/format/Authors.java index 4a4a440cdb7..99b319406d0 100644 --- a/src/main/java/net/sf/jabref/logic/layout/format/Authors.java +++ b/src/main/java/net/sf/jabref/logic/layout/format/Authors.java @@ -198,7 +198,7 @@ else if (Authors.SEPARATORS.contains(key.trim().toLowerCase()) || Authors.LAST_S } else if (comp(key, "LastSep") && !value.isEmpty()) { lastSeparator = value; } - } else if ("etal".equalsIgnoreCase(key.trim()) && !value.isEmpty()) { + } else if ("etal".equalsIgnoreCase(key.trim())) { etAlString = value; } else if (Authors.NUMBER_PATTERN.matcher(key.trim()).matches()) { // Just a number: diff --git a/src/test/java/net/sf/jabref/logic/layout/format/AuthorsTest.java b/src/test/java/net/sf/jabref/logic/layout/format/AuthorsTest.java index b1eb9705c20..2059a3711d5 100644 --- a/src/test/java/net/sf/jabref/logic/layout/format/AuthorsTest.java +++ b/src/test/java/net/sf/jabref/logic/layout/format/AuthorsTest.java @@ -129,4 +129,12 @@ public void testNoPeriod() { Assert.assertEquals("B C Bruce, C K von Manson and J Jumper", a.format("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly")); } + + @Test + public void testEmptyEtAl() { + ParamLayoutFormatter a = new Authors(); + a.setArgument("fullname, LastFirst, Comma, 3, etal="); + Assert.assertEquals("Bruce, Bob Croydon", + a.format("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles")); + } }