[LyX/master] Fix broken mark with multiple citations
Juergen Spitzmueller
spitz at lyx.org
Sat May 2 06:35:06 UTC 2020
commit 3d630f49c44d879a0e3a9ab400c040b3c9587b97
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Sat May 2 08:55:58 2020 +0200
Fix broken mark with multiple citations
Patch by Patrick De Visschere (modified by me)
---
src/insets/InsetCitation.cpp | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp
index 3fa8245..4d1bb68 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<docstring> 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<docstring> keys =
- getVectorFromString(key, from_ascii(","), false, false);
CitationStyle cs = getCitationStyle(buffer().masterParams(),
cite_type, buffer().masterParams().citeStyles());
bool const qualified = cs.hasQualifiedList
More information about the lyx-cvs
mailing list