From 057af45060543b948450f3c95ce4bcce60e188ea Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 22 Mar 2018 15:52:23 +0100 Subject: [PATCH] Use separate BibInfo for child This is used when the file is compiled standalone Fixes: #11083 (cherry picked from commit 1c623ffe8f2e34e38248709935ca5fa475d2e05a) --- src/Buffer.cpp | 19 ++++++++++++++----- src/Buffer.h | 2 ++ src/insets/InsetCitation.cpp | 3 ++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index a8d1b2b718..6dd1d89e5a 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2406,6 +2406,12 @@ BiblioInfo const & Buffer::masterBibInfo() const } +BiblioInfo const & Buffer::bibInfo() const +{ + return d->bibinfo_; +} + + void Buffer::checkIfBibInfoCacheIsValid() const { // use the master's cache @@ -2459,12 +2465,15 @@ void Buffer::collectBibKeys(FileNameList & checkedFiles) const } -void Buffer::addBiblioInfo(BiblioInfo const & bi) const +void Buffer::addBiblioInfo(BiblioInfo const & bin) const { - Buffer const * tmp = masterBuffer(); - BiblioInfo & masterbi = (tmp == this) ? - d->bibinfo_ : tmp->d->bibinfo_; - masterbi.mergeBiblioInfo(bi); + BiblioInfo & bi = d->bibinfo_; + bi.mergeBiblioInfo(bin); + + if (parent() != 0) { + BiblioInfo & masterbi = parent()->d->bibinfo_; + masterbi.mergeBiblioInfo(bin); + } } diff --git a/src/Buffer.h b/src/Buffer.h index 35e7632973..ae1d67064a 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -520,6 +520,8 @@ public: /// \return the bibliography information for this buffer's master, /// or just for it, if it isn't a child. BiblioInfo const & masterBibInfo() const; + /// \return this buffer's bibliography information + BiblioInfo const & bibInfo() const; /// collect bibliography info from the various insets in this buffer. void collectBibKeys(support::FileNameList &) const; /// add some BiblioInfo to our cache diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 8571a28643..6217795ac0 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -545,7 +545,8 @@ void InsetCitation::forOutliner(docstring & os, size_t const, bool const) const // engine, e.g. \cite[]{} for the basic engine. void InsetCitation::latex(otexstream & os, OutputParams const & runparams) const { - BiblioInfo const & bi = buffer().masterBibInfo(); + BiblioInfo const & bi = runparams.is_child + ? buffer().masterBibInfo() : buffer().bibInfo(); docstring const key = getParam("key"); // "keyonly" command: output the plain key and stop. if (getCmdName() == "keyonly") { -- 2.39.5