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

Bugfix/5045 : Modified the existing logic to comply crossref resolution with biblatex specification #5086

Merged
merged 10 commits into from
Aug 22, 2019
16 changes: 14 additions & 2 deletions src/main/java/org/jabref/model/entry/BibEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,24 @@ public Optional<String> getResolvedFieldOrAlias(Field field, BibDatabase databas
}

Optional<String> result = getFieldOrAlias(field);

// If this field is not set, and the entry has a crossref, try to look up the
// field in the referred entry: Do not do this for the bibtex key.
if (!result.isPresent() && (database != null)) {
Optional<BibEntry> referred = database.getReferencedEntry(this);
result = referred.flatMap(entry -> entry.getFieldOrAlias(field));
if (referred.isPresent()) {
result = referred.get().getFieldOrAlias(field);
if (!result.isPresent() && type.equals(StandardEntryType.InProceedings)) {
if (field == StandardField.BOOKTITLE) {
result = referred.get().getFieldOrAlias(StandardField.TITLE);
}
else if (field == StandardField.BOOKSUBTITLE) {
result = referred.get().getFieldOrAlias(StandardField.SUBTITLE);
}
else if (field == StandardField.BOOKAUTHOR) {
result = referred.get().getFieldOrAlias(StandardField.AUTHOR);
}
}
}
}
return result.map(resultText -> BibDatabase.getText(resultText, database));
}
Expand Down