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 0f21c5caf6
commit 95f7545823

View File

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