]> git.lyx.org Git - features.git/commitdiff
Use separate BibInfo for child
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 22 Mar 2018 14:52:23 +0000 (15:52 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 26 Mar 2018 11:27:15 +0000 (13:27 +0200)
This is used when the file is compiled standalone

Fixes: #11083
(cherry picked from commit 1c623ffe8f2e34e38248709935ca5fa475d2e05a)

src/Buffer.cpp
src/Buffer.h
src/insets/InsetCitation.cpp

index a8d1b2b718dca7bf116756631f964dc44bcae952..6dd1d89e5afb6996b883db7109d82447677aec5c 100644 (file)
@@ -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);
+       }
 }
 
 
index 35e76329733b9765ba1b522a47606c34ab8d4a4b..ae1d67064ae3fbb4c79f3f86f2028230696afedb 100644 (file)
@@ -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
index 8571a28643b5c14e93c22eedbe47a0110cf7c55b..6217795ac002b36e7582a1694f2c048c51b8f1f9 100644 (file)
@@ -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") {