Use separate BibInfo for child

This is used when the file is compiled standalone

Fixes: #11083
(cherry picked from commit 1c623ffe8f)
This commit is contained in:
Juergen Spitzmueller 2018-03-22 15:52:23 +01:00
parent 0209f2faff
commit 057af45060
3 changed files with 18 additions and 6 deletions

View File

@ -2406,6 +2406,12 @@ BiblioInfo const & Buffer::masterBibInfo() const
} }
BiblioInfo const & Buffer::bibInfo() const
{
return d->bibinfo_;
}
void Buffer::checkIfBibInfoCacheIsValid() const void Buffer::checkIfBibInfoCacheIsValid() const
{ {
// use the master's cache // 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 & bi = d->bibinfo_;
BiblioInfo & masterbi = (tmp == this) ? bi.mergeBiblioInfo(bin);
d->bibinfo_ : tmp->d->bibinfo_;
masterbi.mergeBiblioInfo(bi); if (parent() != 0) {
BiblioInfo & masterbi = parent()->d->bibinfo_;
masterbi.mergeBiblioInfo(bin);
}
} }

View File

@ -520,6 +520,8 @@ public:
/// \return the bibliography information for this buffer's master, /// \return the bibliography information for this buffer's master,
/// or just for it, if it isn't a child. /// or just for it, if it isn't a child.
BiblioInfo const & masterBibInfo() const; BiblioInfo const & masterBibInfo() const;
/// \return this buffer's bibliography information
BiblioInfo const & bibInfo() const;
/// collect bibliography info from the various insets in this buffer. /// collect bibliography info from the various insets in this buffer.
void collectBibKeys(support::FileNameList &) const; void collectBibKeys(support::FileNameList &) const;
/// add some BiblioInfo to our cache /// add some BiblioInfo to our cache

View File

@ -545,7 +545,8 @@ void InsetCitation::forOutliner(docstring & os, size_t const, bool const) const
// engine, e.g. \cite[]{} for the basic engine. // engine, e.g. \cite[]{} for the basic engine.
void InsetCitation::latex(otexstream & os, OutputParams const & runparams) const 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"); docstring const key = getParam("key");
// "keyonly" command: output the plain key and stop. // "keyonly" command: output the plain key and stop.
if (getCmdName() == "keyonly") { if (getCmdName() == "keyonly") {