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
This commit is contained in:
Richard Heck 2010-07-21 13:43:35 +00:00
parent e7bb1e616e
commit c036ecb649
2 changed files with 15 additions and 9 deletions

View 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

View 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;
///