From 67da1431def33a5f22ec703f4ff0988f332c8b4b 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 b74984ab44..7653db0e54 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;