Skip to content

Commit

Permalink
Fixed name column rendering #1499 and #1531
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Aug 16, 2016
1 parent 257ba21 commit d2da1e6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Fixed NullPointerException when trying to set a special field or mark an entry through the menu without having an open database
- Fixed [#1257](https://github.com/JabRef/jabref/issues/1324): Preferences for the BibTeX key generator set in a version prior to 3.2 are now migrated automatically to the new version
- Fixed [#1716](https://github.com/JabRef/jabref/issues/1716): `@`-Symbols stored in BibTeX fields no longer break the database
- Fixed [#1499](https://github.com/JabRef/jabref/issues/1499): {} braces are now treated correctly in in author/editor
- Fixed [#1531](https://github.com/JabRef/jabref/issues/1531): \relax can be used for abbreviation of author names


### Removed
- It is not longer possible to choose to convert HTML sub- and superscripts to equations
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/net/sf/jabref/gui/maintable/MainTableColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public String getDisplayName() {
*
* @return true if the bibtex fields contains author or editor
*/
public boolean isNameColumn() {
private boolean isNameColumn() {
for (String field : bibtexFields) {
if (InternalBibtexFields.getFieldExtras(field).contains(FieldProperties.PERSON_NAMES)) {
return true;
Expand Down Expand Up @@ -129,13 +129,14 @@ public Object getColumnValue(BibEntry entry) {
}
}

if (content != null) {
content = toUnicode.format(content);
if (isNameColumn()) {
content = MainTableNameFormatter.formatName(content);
}

if (isNameColumn()) {
return MainTableNameFormatter.formatName(content);
if (content != null) {
content = toUnicode.format(content).trim();
}

return content;

}
Expand Down
31 changes: 31 additions & 0 deletions src/test/java/net/sf/jabref/model/entry/AuthorListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,37 @@ public void testGetAuthor() {
Assert.assertEquals("von Neumann", author.getLastOnly());
Assert.assertEquals("Neumann, Jr, J.", author.getNameForAlphabetization());
Assert.assertEquals("von", author.getVon());

}

@Test
public void testCompanyAuthor() {
Author author = AuthorList.parse("{JabRef Developers}").getAuthor(0);
Assert.assertNull(author.getFirst());
Assert.assertNull(author.getFirstAbbr());
Assert.assertEquals("JabRef Developers", author.getLast());
Assert.assertEquals(null, author.getJr());
Assert.assertEquals(null, author.getVon());
}

@Test
public void testCompanyAuthorWithLowerCaseWord() {
Author author = AuthorList.parse("{JabRef Developers on Fire}").getAuthor(0);
Assert.assertNull(author.getFirst());
Assert.assertNull(author.getFirstAbbr());
Assert.assertEquals("JabRef Developers on Fire", author.getLast());
Assert.assertEquals(null, author.getJr());
Assert.assertEquals(null, author.getVon());
}

@Test
public void testAbbreviationWithRelax() {
Author author = AuthorList.parse("{\\relax Ch}ristoph Cholera").getAuthor(0);
Assert.assertEquals("{\\relax Ch}ristoph", author.getFirst());
Assert.assertEquals("{\\relax Ch}.", author.getFirstAbbr());
Assert.assertEquals("Cholera", author.getLast());
Assert.assertEquals(null, author.getJr());
Assert.assertEquals(null, author.getVon());
}

@Test
Expand Down

0 comments on commit d2da1e6

Please sign in to comment.