Improve info display for biblatex databases, part III

When resolving biblatex's xdata references, consider that xdata fields
can contain a comma-separated list of keys, not just a single key like
crossref.
This commit is contained in:
Juergen Spitzmueller 2016-09-19 19:09:42 +02:00
parent d0f608d28e
commit 67da1431de

View File

@ -799,15 +799,21 @@ vector<docstring> const BiblioInfo::getXRefs(BibTeXInfo const & data, bool const
if (!nested && !data["crossref"].empty())
result.push_back(data["crossref"]);
// Biblatex's xdata field. Infinitely nestable.
docstring const xdatakey = data["xdata"];
if (!xdatakey.empty()) {
result.push_back(xdatakey);
BiblioInfo::const_iterator it = find(xdatakey);
if (it != end()) {
BibTeXInfo const & xdata = it->second;
vector<docstring> const nxdata = getXRefs(xdata, true);
if (!nxdata.empty())
result.insert(result.end(), nxdata.begin(), nxdata.end());
// XData field can consist of a comma-separated list of keys
vector<docstring> const xdatakeys = getVectorFromString(data["xdata"]);
if (!xdatakeys.empty()) {
vector<docstring>::const_iterator xit = xdatakeys.begin();
vector<docstring>::const_iterator xen = xdatakeys.end();
for (; xit != xen; ++xit) {
docstring const xdatakey = *xit;
result.push_back(xdatakey);
BiblioInfo::const_iterator it = find(xdatakey);
if (it != end()) {
BibTeXInfo const & xdata = it->second;
vector<docstring> const nxdata = getXRefs(xdata, true);
if (!nxdata.empty())
result.insert(result.end(), nxdata.begin(), nxdata.end());
}
}
}
return result;