From 3d630f49c44d879a0e3a9ab400c040b3c9587b97 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 2 May 2020 08:55:58 +0200 Subject: [PATCH] Fix broken mark with multiple citations Patch by Patrick De Visschere (modified by me) --- src/insets/InsetCitation.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 3fa8245224..4d1bb682c5 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -369,17 +369,28 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const BiblioInfo const & biblist = buf.masterBibInfo(); // mark broken citations - if (biblist.empty() || biblist.find(key) == biblist.end()) - setBroken(true); - else - setBroken(false); + setBroken(false); - if (biblist.empty()) + if (biblist.empty()) { + setBroken(true); return docstring(); + } if (key.empty()) return _("No citations selected!"); + // check all citations + // we only really want the last 'false', to suppress trimming, but + // we need to give the other defaults, too, to set it. + vector keys = + getVectorFromString(key, from_ascii(","), false, false); + for (auto k : keys) { + if (biblist.find(k) == biblist.end()) { + setBroken(true); + break; + } + } + string cite_type = getCmdName(); bool const uppercase = isUpperCase(cite_type[0]); if (uppercase) @@ -399,10 +410,6 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const buffer().params().documentClass().addCiteMacro("!textafter", to_utf8(after)); */ docstring label; - // we only really want the last 'false', to suppress trimming, but - // we need to give the other defaults, too, to set it. - vector keys = - getVectorFromString(key, from_ascii(","), false, false); CitationStyle cs = getCitationStyle(buffer().masterParams(), cite_type, buffer().masterParams().citeStyles()); bool const qualified = cs.hasQualifiedList -- 2.39.2