Author: rgheck
Date: Wed Jul 21 15:43:35 2010
New Revision: 34995
URL: http://www.lyx.org/trac/changeset/34995

Log:
Tweak the math-as-LaTeX output, including the correct tags for jsMath.
We don't yet write info to load the jsMath files, though.

Modified:
   lyx-devel/trunk/src/mathed/InsetMathHull.cpp
   lyx-devel/trunk/src/mathed/InsetMathHull.h

Modified: lyx-devel/trunk/src/mathed/InsetMathHull.cpp
==============================================================================
--- lyx-devel/trunk/src/mathed/InsetMathHull.cpp        Wed Jul 21 15:26:48 
2010        (r34994)
+++ lyx-devel/trunk/src/mathed/InsetMathHull.cpp        Wed Jul 21 15:43:35 
2010        (r34995)
@@ -483,7 +483,8 @@
 }
 
 
-static docstring latexString(InsetMathHull const & inset)
+static docstring latexString(InsetMathHull const & inset, 
+               bool do_header = true)
 {
        odocstringstream ls;
        // This has to be static, because a preview snippet or a math
@@ -495,7 +496,7 @@
        if (inset.isBufferValid())
                encoding = &(inset.buffer().params().encoding());
        WriteStream wi(ls, false, true, WriteStream::wsPreview, encoding);
-       inset.write(wi);
+       inset.write(wi, do_header);
        return ls.str();
 }
 
@@ -1127,12 +1128,14 @@
 }
 
 
-void InsetMathHull::write(WriteStream & os) const
+void InsetMathHull::write(WriteStream & os, bool do_header) const
 {
        ModeSpecifier specifier(os, MATH_MODE);
-       header_write(os);
+       if (do_header)  
+               header_write(os);
        InsetMathGrid::write(os);
-       footer_write(os);
+       if (do_header)
+               footer_write(os);
 }
 
 
@@ -1883,9 +1886,12 @@
        } 
        case BufferParams::LaTeX: {
                string const tag = (getType() == hullSimple) ? "span" : "div";
-               // FIXME Need to allow customization of wrapping tags here....
-               docstring const latex = latexString(*this);
-               xs << html::StartTag(tag) << latex << html::EndTag(tag);
+               docstring const latex = latexString(*this, false);
+               // class='math' allows for use of jsMath
+               // http://www.math.union.edu/~dpvc/jsMath/
+               // FIXME XHTML
+               // probably should allow for some kind of customization here
+               xs << html::StartTag(tag, "class='math'") << latex << 
html::EndTag(tag);
                xs.cr();
        }
        } // end switch

Modified: lyx-devel/trunk/src/mathed/InsetMathHull.h
==============================================================================
--- lyx-devel/trunk/src/mathed/InsetMathHull.h  Wed Jul 21 15:26:48 2010        
(r34994)
+++ lyx-devel/trunk/src/mathed/InsetMathHull.h  Wed Jul 21 15:43:35 2010        
(r34995)
@@ -105,7 +105,7 @@
        bool idxLast(Cursor &) const;
 
        ///
-       void write(WriteStream & os) const;
+       void write(WriteStream & os, bool do_header = true) const;
        ///
        void mathmlize(MathStream &) const;
        ///

Reply via email to