Try again to fix Kornel's slowness problem. The previous attempt was

worth doing, as we were creating too much output for tooltips anyway.
But we need to ignore BibTeX insets altogether, as the collection of
the references, etc, is too slow.
This commit is contained in:
Richard Heck 2013-03-09 12:42:56 -05:00
parent 65b74b9a1d
commit 872c71ffa6
4 changed files with 25 additions and 10 deletions

View File

@ -929,16 +929,21 @@ void InsetBibtex::validate(LaTeXFeatures & features) const
int InsetBibtex::plaintext(odocstringstream & os,
OutputParams const &, size_t max_length) const
OutputParams const & op, size_t max_length) const
{
docstring const reflabel = buffer().B_("References");
if (op.for_tooltip || op.for_toc) {
os << reflabel;
return reflabel.size();
}
BiblioInfo bibinfo = buffer().masterBibInfo();
bibinfo.makeCitationLabels(buffer());
vector<docstring> const & cites = bibinfo.citedEntries();
size_t start_size = os.str().size();
docstring refoutput;
docstring const reflabel = buffer().B_("References");
refoutput += reflabel + "\n\n";
// Now we loop over the entries

View File

@ -694,6 +694,10 @@ void InsetExternal::latex(otexstream & os, OutputParams const & runparams) const
int InsetExternal::plaintext(odocstringstream & os,
OutputParams const & runparams, size_t) const
{
// this is too slow for constant use
if (runparams.for_tooltip)
return 0;
os << '\n'; // output external material on a new line
external::writeExternal(params_, "Ascii", buffer(), os,
*(runparams.exportdata), false,

View File

@ -813,12 +813,18 @@ docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const & rp) const
int InsetInclude::plaintext(odocstringstream & os,
OutputParams const & op, size_t) const
{
// don't write the file just because we're making a tooltip or toc entry!!
if (op.for_tooltip || op.for_toc || isVerbatim(params()) || isListings(params())) {
os << '[' << screenLabel() << '\n';
// FIXME: We don't know the encoding of the file, default to UTF-8.
os << includedFileName(buffer(), params()).fileContents("UTF-8");
os << "\n]";
// just write the filename if we're making a tooltip or toc entry
if (op.for_tooltip || op.for_toc) {
os << '[' << screenLabel() << '\n'
<< getParam("filename") << "\n]";
return PLAINTEXT_NEWLINE + 1; // one char on a separate line
}
if (isVerbatim(params()) || isListings(params())) {
os << '[' << screenLabel() << '\n'
// FIXME: We don't know the encoding of the file, default to UTF-8.
<< includedFileName(buffer(), params()).fileContents("UTF-8")
<< "\n]";
return PLAINTEXT_NEWLINE + 1; // one char on a separate line
}

View File

@ -84,7 +84,7 @@ void InsetFormulaMacro::latex(otexstream & os,
}
int InsetFormulaMacro::plaintext(odocstringstream & os, OutputParams const & runparams, int max_length) const
int InsetFormulaMacro::plaintext(odocstringstream & os, OutputParams const & runparams, size_t) const
{
odocstringstream oss;
WriteStream wi(oss, false, true, WriteStream::wsDefault, runparams.encoding);