Use separate BibInfo for child

This is used when the file is compiled standalone

Fixes: #11083
This commit is contained in:
Juergen Spitzmueller 2018-03-22 15:52:23 +01:00
parent 83b1ac3b55
commit 1c623ffe8f
3 changed files with 19 additions and 7 deletions

View File

@ -2343,10 +2343,16 @@ BiblioInfo const & Buffer::masterBibInfo() const
}
BiblioInfo const & Buffer::bibInfo() const
{
return d->bibinfo_;
}
void Buffer::registerBibfiles(FileNamePairList const & bf) const {
Buffer const * const tmp = masterBuffer();
if (tmp != this)
return tmp->registerBibfiles(bf);
tmp->registerBibfiles(bf);
for (auto const & p : bf) {
FileNamePairList::const_iterator temp =
@ -2415,12 +2421,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);
}
}

View File

@ -508,6 +508,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

View File

@ -552,7 +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
{
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") {