From 95f75458237dd567dddd7888f23bb7b875bf3e04 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 19 Sep 2016 19:09:42 +0200 Subject: [PATCH] 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. --- src/BiblioInfo.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp index 63f4572847..a4a9323914 100644 --- a/src/BiblioInfo.cpp +++ b/src/BiblioInfo.cpp @@ -799,15 +799,21 @@ vector 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 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 const xdatakeys = getVectorFromString(data["xdata"]); + if (!xdatakeys.empty()) { + vector::const_iterator xit = xdatakeys.begin(); + vector::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 const nxdata = getXRefs(xdata, true); + if (!nxdata.empty()) + result.insert(result.end(), nxdata.begin(), nxdata.end()); + } } } return result;