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

Fixes generated bibtex key and display of institute authors #6479

Merged
merged 65 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
fd405cf
Fix Pattern.compile for frequently used regexes
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
a6354e3
Fix one additional Pattern.compile
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
149ed4f
Fix style and unnecessary escape sequences
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
b57f1b2
Fix invalid index in call to substring
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
fae093b
Refactor name and javadoc of a regex
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
5a23a9a
Fix use of compiled regex for matching department
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
6af8c7e
Fix check for uppercase letter
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
716f885
Fix usage of uncompiled regex
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
cdfd56a
Fix readability?
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
b227edb
Add test cases
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
ef7f979
Fix `null` appearing as part of author name
k3KAW8Pnf7mkmdSMPHz27 May 13, 2020
9ac3993
Refactor name of capital regex pattern
k3KAW8Pnf7mkmdSMPHz27 May 14, 2020
85c96ce
Merge branch 'master' into fix-for-issue-6459
k3KAW8Pnf7mkmdSMPHz27 May 15, 2020
6ded410
Add debug output for reordering of names in fields
k3KAW8Pnf7mkmdSMPHz27 May 15, 2020
e8c3007
Merge branch 'master' into fix-for-issue-6459
k3KAW8Pnf7mkmdSMPHz27 May 18, 2020
72eb1fe
Add helper methods
k3KAW8Pnf7mkmdSMPHz27 May 18, 2020
2eee8dd
Fix missing negation in "uni" matching
k3KAW8Pnf7mkmdSMPHz27 May 18, 2020
cc54029
Fix test cases for corporate authors
k3KAW8Pnf7mkmdSMPHz27 May 18, 2020
1063ae1
Fix to keep all uppercase letters in abbreviation
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
ef94758
Fix commented out code
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
e80bd8b
Fix key for institution's name containing keyword
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
a0ed455
Fix test case for short institution name
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
4db0824
Refactor check for institution types
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
383fc14
Refactor comments and names improving readability?
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
c3e5f09
Refactor to improve readability and closure
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
5990c2a
Fix JavaDoc
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
0df3cdb
Fix JavaDoc typos
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
f0d9601
Fix preliminary order for authors -> latexfree
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
6f26a73
Drop logger
k3KAW8Pnf7mkmdSMPHz27 May 19, 2020
9b717c5
Add convenience methods for cached latexfree names
k3KAW8Pnf7mkmdSMPHz27 May 20, 2020
5ed9c54
Add name format method for names containing latex
k3KAW8Pnf7mkmdSMPHz27 May 20, 2020
d6e9e70
Add call to formatNameLatexFree
k3KAW8Pnf7mkmdSMPHz27 May 20, 2020
2dc664d
Fix unclear statement in JavaDoc
k3KAW8Pnf7mkmdSMPHz27 May 20, 2020
f0fd4f1
Fix to only keep the first character of each word
k3KAW8Pnf7mkmdSMPHz27 May 20, 2020
feebf81
Add latexfree Natbib test cases
k3KAW8Pnf7mkmdSMPHz27 May 21, 2020
d4c2ce3
Fix typo in latex-free test cases
k3KAW8Pnf7mkmdSMPHz27 May 21, 2020
04abe5e
Add Natbib test with escaped brackets
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
3f3ef62
Add Natbib institution test with escaped brackets
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
f4fbec1
Add test for latex-free comma separated lastnames
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
a256fa8
Add test for latex-free comma separated first name
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
4961c53
Add test for latex-free comma separated last name
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
a443db0
Fix adherence to JavaDoc and readability(?)
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
dd492e6
Fix readability(?)
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
71e45d4
Fix CheckStyle issues
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
2748dcd
Merge branch 'master' into fix-for-issue-6459
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
3b0dda3
Fix CHANGELOG.md
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
78b66f7
Fix mistake in BibtexKeyGeneratorTest
k3KAW8Pnf7mkmdSMPHz27 May 22, 2020
55ef8e7
Add test for oxford comma
k3KAW8Pnf7mkmdSMPHz27 May 24, 2020
237dc35
Merge branch 'master' into fix-for-issue-6459
k3KAW8Pnf7mkmdSMPHz27 May 26, 2020
78fade6
Fix miss-capitalization of enum
k3KAW8Pnf7mkmdSMPHz27 May 26, 2020
3de984d
Fix fields not displayed latex-free
k3KAW8Pnf7mkmdSMPHz27 May 26, 2020
ecac673
Fix in-line methods in MainTableNameFormatter
k3KAW8Pnf7mkmdSMPHz27 May 26, 2020
1c4928b
Fix in-line of generateKey() method
k3KAW8Pnf7mkmdSMPHz27 May 26, 2020
55f3f18
Fix separating tests into parsing/representation
k3KAW8Pnf7mkmdSMPHz27 May 26, 2020
e6cda69
Fix cache check and simplify expressions
k3KAW8Pnf7mkmdSMPHz27 May 26, 2020
2e120fd
Drop inlined methods
k3KAW8Pnf7mkmdSMPHz27 May 26, 2020
8cc947c
Fix most abbreviated abbreviations
k3KAW8Pnf7mkmdSMPHz27 May 26, 2020
2fc9e16
Drop old formatName method
k3KAW8Pnf7mkmdSMPHz27 May 27, 2020
b4b3993
Refactor formatNameLatexFree
k3KAW8Pnf7mkmdSMPHz27 May 27, 2020
3cb6232
Refactor new parse tests
k3KAW8Pnf7mkmdSMPHz27 May 27, 2020
b3f0d1b
Add more parse tests
k3KAW8Pnf7mkmdSMPHz27 May 27, 2020
5a27bbc
Drop all test cases containing escaped brackets
k3KAW8Pnf7mkmdSMPHz27 May 27, 2020
c7578b3
Refactor parse with latex tests
k3KAW8Pnf7mkmdSMPHz27 May 27, 2020
b8bf4f3
Fix my own spelling mistakes
k3KAW8Pnf7mkmdSMPHz27 May 27, 2020
cc23e29
Refactor abbreviation name
k3KAW8Pnf7mkmdSMPHz27 May 28, 2020
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where brackets in regular expressions were not working. [6469](https://github.com/JabRef/jabref/pull/6469)
- We fixed an issue where LaTeX citations for specific commands (\autocites) of biblatex-mla were not recognized. [#6476](https://github.com/JabRef/jabref/issues/6476)
- We fixed an issue where drag and drop was not working on empty database. [#6487](https://github.com/JabRef/jabref/issues/6487)
- We fixed an issue where "null" appeared in generated BibTeX keys. [#6459](https://github.com/JabRef/jabref/issues/6459)
- We fixed an issue where the authors' names were incorrectly displayed in the authors' column when they were bracketed. [#6465](https://github.com/JabRef/jabref/issues/6465) [#6459](https://github.com/JabRef/jabref/issues/6459)

### Removed

Expand Down
37 changes: 18 additions & 19 deletions src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,27 @@ public ObservableValue<String> getFields(OrFields fields) {
ObservableValue<String> value = fieldValues.get(fields);
if (value != null) {
return value;
} else {
value = Bindings.createStringBinding(() -> {
boolean isName = false;
}

Optional<String> content = Optional.empty();
for (Field field : fields) {
content = entry.getResolvedFieldOrAliasLatexFree(field, database);
if (content.isPresent()) {
isName = field.getProperties().contains(FieldProperty.PERSON_NAMES);
break;
}
}
value = Bindings.createStringBinding(() -> {
for (Field field : fields) {
if (field.getProperties().contains(FieldProperty.PERSON_NAMES)) {
Optional<String> name = entry.getResolvedFieldOrAlias(field, database);

String result = content.orElse(null);
if (isName) {
return nameFormatter.formatName(result);
if (name.isPresent()) {
return nameFormatter.formatNameLatexFree(name.get());
}
} else {
return result;
Optional<String> content = entry.getResolvedFieldOrAliasLatexFree(field, database);

if (content.isPresent()) {
return content.get();
}
}
}, entry.getObservables());
fieldValues.put(fields, value);
return value;
}
}
return "";
}, entry.getObservables());
fieldValues.put(fields, value);
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,28 @@ public class MainTableNameFormatter {
}

/**
* Format a name field for the table, according to user preferences.
* Format a name field for the table, according to user preferences and with latex expressions translated if
* possible.
*
* @param nameToFormat The contents of the name field.
* @return The formatted name field.
*/
public String formatName(final String nameToFormat) {
public String formatNameLatexFree(final String nameToFormat) {
k3KAW8Pnf7mkmdSMPHz27 marked this conversation as resolved.
Show resolved Hide resolved
if (nameToFormat == null) {
return null;
}
AuthorList authors = AuthorList.parse(nameToFormat);

if (namesAsIs) {
return nameToFormat;
} else if (namesNatbib) {
return AuthorList.fixAuthorNatbib(nameToFormat);
return authors.getAsNatbibLatexFree();
} else if (namesLastOnly) {
return AuthorList.fixAuthorLastNameOnlyCommas(nameToFormat, false);
return authors.getAsLastNamesLatexFree(false);
} else if (namesFf) {
return AuthorList.fixAuthorFirstNameFirstCommas(nameToFormat, abbrAuthorNames, false);
return authors.getAsFirstLastNamesLatexFree(abbrAuthorNames, false);
} else {
return AuthorList.fixAuthorLastNameFirstCommas(nameToFormat, abbrAuthorNames, false);
return authors.getAsLastFirstNamesLatexFree(abbrAuthorNames, false);
}
}
}
Loading