The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 3f748c79c3a3cdeb1493cf6d2b76d21051a6d12b
Author: Richard Heck <[email protected]>
Date:   Tue Mar 12 12:45:15 2013 -0400

    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.

diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp
index 0ef0c2c..ea56d2f 100644
--- a/src/OutputParams.cpp
+++ b/src/OutputParams.cpp
@@ -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); 
diff --git a/src/OutputParams.h b/src/OutputParams.h
index b345670..e492a99 100644
--- a/src/OutputParams.h
+++ b/src/OutputParams.h
@@ -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;
 
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 3ed382a..ec2ff51 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -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;
 
diff --git a/src/Paragraph.h b/src/Paragraph.h
index dc46179..641cf27 100644
--- a/src/Paragraph.h
+++ b/src/Paragraph.h
@@ -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;
diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index 7017473..1abafd6 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -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();
diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp
index c3bd919..dfee2d4 100644
--- a/src/insets/InsetInclude.cpp
+++ b/src/insets/InsetInclude.cpp
@@ -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

-----------------------------------------------------------------------

Summary of changes:
 src/OutputParams.cpp        |    3 ++-
 src/OutputParams.h          |    3 +++
 src/Paragraph.cpp           |    3 ++-
 src/Paragraph.h             |    9 +++++----
 src/insets/InsetBibtex.cpp  |    9 ++++++---
 src/insets/InsetInclude.cpp |    5 +++--
 6 files changed, 21 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to