mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Add a for_search member to OutputParams, and use it to limit what
work we do when calling plaintext() for the purpose of generating material for the advanced search function. Here again, not only were we parsing BibTeX files, since Julien's (sensible) introduction of plaintext output for that inset, but we were in fact writing (to disk) complete plaintext output for included files every time we did such a search.
This commit is contained in:
parent
96289519c5
commit
3f748c79c3
@ -30,7 +30,8 @@ OutputParams::OutputParams(Encoding const * enc)
|
||||
par_begin(0), par_end(0), lastid(-1), lastpos(-1), isLastPar(false),
|
||||
dryrun(false), pass_thru(false),
|
||||
html_disable_captions(false), html_in_par(false),
|
||||
html_make_pars(true), for_toc(false), for_tooltip(false), includeall(false)
|
||||
html_make_pars(true), for_toc(false), for_tooltip(false),
|
||||
for_search(false), includeall(false)
|
||||
{
|
||||
// Note: in PreviewLoader::Impl::dumpPreamble
|
||||
// OutputParams runparams(0);
|
||||
|
@ -264,6 +264,9 @@ public:
|
||||
/// Are we generating this material for inclusion in a tooltip?
|
||||
bool for_tooltip;
|
||||
|
||||
/// Are we generating this material for use by advanced search?
|
||||
bool for_search;
|
||||
|
||||
/// Include all children notwithstanding the use of \includeonly
|
||||
bool includeall;
|
||||
|
||||
|
@ -3132,7 +3132,8 @@ void Paragraph::forToc(docstring & os, size_t maxlen) const
|
||||
}
|
||||
|
||||
|
||||
docstring Paragraph::stringify(pos_type beg, pos_type end, int options, OutputParams & runparams) const
|
||||
docstring Paragraph::stringify(pos_type beg, pos_type end, int options,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
odocstringstream os;
|
||||
|
||||
|
@ -183,18 +183,19 @@ public:
|
||||
|
||||
/// Extract only the explicitly visible text (without any formatting),
|
||||
/// descending into insets
|
||||
docstring stringify(pos_type beg, pos_type end, int options, OutputParams & runparams) const;
|
||||
docstring stringify(pos_type beg, pos_type end, int options,
|
||||
OutputParams const & runparams) const;
|
||||
|
||||
///
|
||||
void write(std::ostream &, BufferParams const &,
|
||||
depth_type & depth) const;
|
||||
depth_type & depth) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
|
||||
/// \param force means: output even if layout.inpreamble is true.
|
||||
void latex(BufferParams const &, Font const & outerfont, otexstream &,
|
||||
OutputParams const &, int start_pos = 0, int end_pos = -1,
|
||||
bool force = false) const;
|
||||
OutputParams const &, int start_pos = 0, int end_pos = -1,
|
||||
bool force = false) const;
|
||||
|
||||
/// Can we drop the standard paragraph wrapper?
|
||||
bool emptyTag() const;
|
||||
|
@ -933,9 +933,12 @@ int InsetBibtex::plaintext(odocstringstream & os,
|
||||
{
|
||||
docstring const reflabel = buffer().B_("References");
|
||||
|
||||
if (op.for_tooltip || op.for_toc) {
|
||||
os << reflabel;
|
||||
return reflabel.size();
|
||||
// We could output more information here, e.g., what databases are included
|
||||
// and information about options. But I don't necessarily see any reason to
|
||||
// do this right now.
|
||||
if (op.for_tooltip || op.for_toc || op.for_search) {
|
||||
os << '[' << reflabel << ']' << '\n';
|
||||
return PLAINTEXT_NEWLINE;
|
||||
}
|
||||
|
||||
BiblioInfo bibinfo = buffer().masterBibInfo();
|
||||
|
@ -813,8 +813,9 @@ docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const & rp) const
|
||||
int InsetInclude::plaintext(odocstringstream & os,
|
||||
OutputParams const & op, size_t) const
|
||||
{
|
||||
// just write the filename if we're making a tooltip or toc entry
|
||||
if (op.for_tooltip || op.for_toc) {
|
||||
// just write the filename if we're making a tooltip or toc entry,
|
||||
// or are generating this for advanced search
|
||||
if (op.for_tooltip || op.for_toc || op.for_search) {
|
||||
os << '[' << screenLabel() << '\n'
|
||||
<< getParam("filename") << "\n]";
|
||||
return PLAINTEXT_NEWLINE + 1; // one char on a separate line
|
||||
|
Loading…
Reference in New Issue
Block a user