On 12/04/2010 03:41 PM, Abdelrazak Younes wrote:
On 04/12/2010 04:15, rgh...@lyx.org wrote:
Author: rgheck
Date: Sat Dec 4 04:15:53 2010
New Revision: 36710
URL: http://www.lyx.org/trac/changeset/36710
Log:
Revert r36696: We can't collect BibTeX information during the
updateBuffer() traversal. The reason is simple: InsetCitation needs
access to the BibTeX info to calculate its label. But we won't have it
until we get to the bibliography.
I don't think there is any way around that.
Couldn't we just pass until it gets loaded? I don't see how this is
any different than reference and labels... maybe I am wrong but it
should be as simple as coming back to the InsetCitation in
InsetBibtex::updateBuffe().
How do we go back to the InsetCitation once we have already passed it? I
mean, on that trip through? How do we know when all the bibliography
information has been loaded? We can't until we are done. So the only
thing I can see would be to collect pointers to all the InsetCitations
and then do them all at the end. I don't see anything similar with
references and labels. Their screen labels do not depend upon anything else.
Consider in particular the very first time we call updateBuffer(). Then
when we do this test:
BiblioInfo const & biblist = buf.masterBibInfo();
if (biblist.empty())
return docstring();
in InsetCitation::complexLabel(), biblist will indeed be empty, because
it hasn't yet been filled. Since the citations normally come before the
bibliography, none of them will get "complex" labels the first time.
They also don't get new ones later, since we cache the label and only
change it in certain cases. I guess we could check again for bibinfo,
though, if that were the only problem.
We won't run into quite this problem when the BibTeX files change, but
we do have the problem that the new info isn't loaded until after the
update has been done, so we don't see it. Then we again have the caching
problem.
Richard