Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed name column rendering #1499 and #1531 #1755

Merged
merged 2 commits into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put the \relax in the code-quotes, but that is just a small unrelated thing..;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that is both related and relevant. ;-)

I'll fix it tomorrow (later today).

Den 17 aug. 2016 00:08 skrev "Christoph" notifications@github.com:

In CHANGELOG.md
#1755 (comment):

@@ -67,6 +67,9 @@ We refer to GitHub 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: Preferences for the BibTeX key generator set in a version prior to 3.2 are now migrated automatically to the new version
  • Fixed #1716: @-Symbols stored in BibTeX fields no longer break the database
    +- Fixed #1499: {} braces are now treated correctly in in author/editor
    +- Fixed #1531: \relax can be used for abbreviation of author names

I would put the \relax in the code-quotes, but that is just a small
unrelated thing..;)


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/JabRef/jabref/pull/1755/files/752c54d5d96fbfd2861970a8fb86463f0ac1ad86#r75030057,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHvRQedYCQBoTKdLOEle7MnEtbznpt5cks5qgjTZgaJpZM4Jl1UE
.



### 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer tests in the form

Author expected = new Author("Firstname", "F.", null, "Bailey-Jones", null);
Assert.assertEquals(new AuthorList(expected), AuthorList.parse("Firstname Bailey-Jones"));

They are shorter and provide better feedback what went wrong parsing the author (instead of getFirst was something but expected null, you get a complete diff of all information in the parsed author vs expected author).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert.assertNull(author.getFirst());
Assert.assertNull(author.getFirstAbbr());
Assert.assertEquals("JabRef Developers", author.getLast());
Assert.assertNull(author.getJr());
Assert.assertNull(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.assertNull(author.getJr());
Assert.assertNull(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.assertNull(author.getJr());
Assert.assertNull(author.getVon());
}

@Test
Expand Down