From: Richard Heck Date: Wed, 21 Jul 2010 13:43:35 +0000 (+0000) Subject: Tweak the math-as-LaTeX output, including the correct tags for jsMath. X-Git-Tag: 2.0.0~2917 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c036ecb649c275bd55f022f6d20d778895148951;p=features.git Tweak the math-as-LaTeX output, including the correct tags for jsMath. 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 --- diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 02f10a0b24..dd052912bf 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -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 diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index d2ca3f6d2b..7e72cef637 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -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; ///