Skip to content

Commit

Permalink
Bugfix/5045 : Modified the existing logic to comply crossref resoluti…
Browse files Browse the repository at this point in the history
…on with biblatex specification (JabRef#5086)

* bugfix/5045 :Modified the existing logic to comply crossref resolution with biblatex specification

* bugfix/5045: Modified the logic to comply crossref resolution with
biblatex spec

* bugfix/5045: Organizes imports

* bugfix/5045: Organized imports.
  • Loading branch information
CyraxSector authored and Siedlerchr committed Aug 22, 2019
1 parent 2b21cc7 commit 0cb7f5f
Showing 1 changed file with 14 additions and 2 deletions.
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

0 comments on commit 0cb7f5f

Please sign in to comment.