]> git.lyx.org Git - features.git/commitdiff
Tweak the math-as-LaTeX output, including the correct tags for jsMath.
authorRichard Heck <rgheck@comcast.net>
Wed, 21 Jul 2010 13:43:35 +0000 (13:43 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 21 Jul 2010 13:43:35 +0000 (13:43 +0000)
We don't yet write info to load the jsMath files, though.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34995 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h

index 02f10a0b2442b88deddae4c25956baa2fa16fcee..dd052912bfd6fe464e7f9406d6a52f12537a438d 100644 (file)
@@ -483,7 +483,8 @@ void InsetMathHull::drawT(TextPainter & pain, int x, int y) const
 }
 
 
-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 @@ static docstring latexString(InsetMathHull const & inset)
        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 @@ docstring InsetMathHull::eolString(row_type row, bool fragile, bool last_eoln) c
 }
 
 
-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 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
        } 
        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
index d2ca3f6d2bec84a0cca6814bf5dd4cba53ab9f70..7e72cef6373eb4084cec604ebad5b2b8b4cd78c2 100644 (file)
@@ -105,7 +105,7 @@ public:
        bool idxLast(Cursor &) const;
 
        ///
-       void write(WriteStream & os) const;
+       void write(WriteStream & os, bool do_header = true) const;
        ///
        void mathmlize(MathStream &) const;
        ///