Generate the citation labels before exporting to plain text.

This commit is contained in:
Julien Rioux 2013-02-02 19:23:21 +01:00
parent 6456c2262e
commit cc1ce04798
4 changed files with 17 additions and 2 deletions

View File

@ -2121,6 +2121,13 @@ void Buffer::addBibTeXInfo(docstring const & key, BibTeXInfo const & bi) const
}
void Buffer::makeCitationLabels() const
{
Buffer const * const master = masterBuffer();
return d->bibinfo_.makeCitationLabels(*master);
}
bool Buffer::citeLabelsValid() const
{
return masterBuffer()->d->cite_labels_valid_;

View File

@ -486,6 +486,8 @@ public:
/// add a single piece of bibliography info to our cache
void addBibTeXInfo(docstring const & key, BibTeXInfo const & bi) const;
///
void makeCitationLabels() const;
///
bool citeLabelsValid() const;
///
void getLabelList(std::vector<docstring> &) const;

View File

@ -344,8 +344,13 @@ void InsetCitation::addToToc(DocIterator const & cpit) const
int InsetCitation::plaintext(odocstream & os, OutputParams const &) const
{
os << cache.generated_label;
return cache.generated_label.size();
string const & cmd = getCmdName();
if (cmd == "nocite")
return 0;
docstring const label = generateLabel(false);
os << label;
return label.size();
}

View File

@ -41,6 +41,7 @@ void writePlaintextFile(Buffer const & buf, FileName const & fname,
// make sure we are ready to export
buf.updateBuffer();
buf.updateMacroInstances(OutputUpdate);
buf.makeCitationLabels();
writePlaintextFile(buf, ofs, runparams);
}