]> 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>
Thu, 22 Mar 2018 22:37:19 +0000 (23:37 +0100)
src/Buffer.cpp
src/insets/InsetCitation.cpp

index 248826efe353a3ce9102741cb1e567a2268c8b13..7024f974d5f4e93f98bd4dbde13a0a5966020212 100644 (file)
@@ -2350,6 +2350,9 @@ BiblioInfo const & Buffer::bibInfo() const
 
 
 void Buffer::registerBibfiles(FileNamePairList const & bf) const {
+       // We register the bib files in the master buffer,
+       // if there is one, but also in every single buffer,
+       // in case a child is compiled alone.
        Buffer const * const tmp = masterBuffer();
        if (tmp != this)
                tmp->registerBibfiles(bf);
@@ -2423,6 +2426,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);
 
@@ -2433,12 +2439,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 0e67483c99f29a8e4defd1772490d6f336e3d735..ba45f691a37cbe0cef69fdab1313ca90e6e2c02a 100644 (file)
@@ -552,6 +552,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");