]> git.lyx.org Git - features.git/commitdiff
amend 1c623ffe8f2e34e
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 22 Mar 2018 22:37:19 +0000 (23:37 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 26 Mar 2018 11:28:48 +0000 (13:28 +0200)
(cherry picked from commit 6415d986ba32373d3c3915ec77473dfa2e2b7ad3)

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

index 6dd1d89e5afb6996b883db7109d82447677aec5c..a25f91daa5bad9cdac98b919fe30ddba04cac84c 100644 (file)
@@ -2467,6 +2467,9 @@ void Buffer::collectBibKeys(FileNameList & checkedFiles) const
 
 void Buffer::addBiblioInfo(BiblioInfo const & bin) const
 {
+       // We add the biblio info to the master buffer,
+       // if there is one, but also to every single buffer,
+       // in case a child is compiled alone.
        BiblioInfo & bi = d->bibinfo_;
        bi.mergeBiblioInfo(bin);
 
@@ -2477,12 +2480,18 @@ void Buffer::addBiblioInfo(BiblioInfo const & bin) const
 }
 
 
-void Buffer::addBibTeXInfo(docstring const & key, BibTeXInfo const & bi) const
+void Buffer::addBibTeXInfo(docstring const & key, BibTeXInfo const & bin) const
 {
-       Buffer const * tmp = masterBuffer();
-       BiblioInfo & masterbi = (tmp == this) ?
-               d->bibinfo_ : tmp->d->bibinfo_;
-       masterbi[key] = bi;
+       // We add the bibtex info to the master buffer,
+       // if there is one, but also to every single buffer,
+       // in case a child is compiled alone.
+       BiblioInfo & bi = d->bibinfo_;
+       bi[key] = bin;
+
+       if (parent() != 0) {
+               BiblioInfo & masterbi = parent()->d->bibinfo_;
+               masterbi[key] = bin;
+       }
 }
 
 
index 6217795ac002b36e7582a1694f2c048c51b8f1f9..11b89437867ba799e12fa69eb8923c36bc809e6a 100644 (file)
@@ -545,6 +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
 {
+       // When this is a child compiled on its own, we use the childs
+       // own bibinfo, else the master's
        BiblioInfo const & bi = runparams.is_child
                        ? buffer().masterBibInfo() : buffer().bibInfo();
        docstring const key = getParam("key");