Prepare for the use of exceptions to catch occasions when we can't

export as MathML, etc.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34996 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-07-21 14:02:46 +00:00
parent c036ecb649
commit 9803d7a2a6

View File

@ -1848,23 +1848,29 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
// FIXME Eventually we would like to do this inset by inset. // FIXME Eventually we would like to do this inset by inset.
switch (mathtype) { switch (mathtype) {
case BufferParams::MathML: { case BufferParams::MathML: {
odocstringstream os;
MathStream ms(os);
InsetMathGrid::mathmlize(ms);
if (getType() == hullSimple) if (getType() == hullSimple)
xs << html::StartTag("math", xs << html::StartTag("math",
"xmlns=\"http://www.w3.org/1998/Math/MathML\"", true); "xmlns=\"http://www.w3.org/1998/Math/MathML\"", true);
else else
xs << html::StartTag("math", xs << html::StartTag("math",
"display=\"block\" xmlns=\"http://www.w3.org/1998/Math/MathML\"", true); "display=\"block\" xmlns=\"http://www.w3.org/1998/Math/MathML\"", true);
MathStream ms(xs.os()); xs << XHTMLStream::NextRaw()
InsetMathGrid::mathmlize(ms); << os.str()
xs << html::EndTag("math"); << html::EndTag("math");
break; break;
} }
case BufferParams::HTML: { case BufferParams::HTML: {
string const tag = (getType() == hullSimple) ? "span" : "div"; odocstringstream os;
xs << html::StartTag(tag, "class='formula'", true); HtmlStream ms(os);
HtmlStream ms(xs.os());
InsetMathGrid::htmlize(ms); InsetMathGrid::htmlize(ms);
xs << html::EndTag(tag); string const tag = (getType() == hullSimple) ? "span" : "div";
xs << html::StartTag(tag, "class='formula'", true)
<< XHTMLStream::NextRaw()
<< os.str()
<< html::EndTag(tag);
break; break;
} }
case BufferParams::Images: { case BufferParams::Images: {
@ -1874,9 +1880,9 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
// FIXME Do we always have png? // FIXME Do we always have png?
string const tag = (getType() == hullSimple) ? "span" : "div"; string const tag = (getType() == hullSimple) ? "span" : "div";
FileName const & mathimg = pimage->filename(); FileName const & mathimg = pimage->filename();
xs << html::StartTag(tag); xs << html::StartTag(tag)
xs << html::CompTag("img", "src=\"" + mathimg.onlyFileName() + "\""); << html::CompTag("img", "src=\"" + mathimg.onlyFileName() + "\"")
xs << html::EndTag(tag); << html::EndTag(tag);
xs.cr(); xs.cr();
// add the file to the list of files to be exported // add the file to the list of files to be exported
op.exportdata->addExternalFile("xhtml", mathimg); op.exportdata->addExternalFile("xhtml", mathimg);
@ -1891,7 +1897,9 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
// http://www.math.union.edu/~dpvc/jsMath/ // http://www.math.union.edu/~dpvc/jsMath/
// FIXME XHTML // FIXME XHTML
// probably should allow for some kind of customization here // probably should allow for some kind of customization here
xs << html::StartTag(tag, "class='math'") << latex << html::EndTag(tag); xs << html::StartTag(tag, "class='math'")
<< latex
<< html::EndTag(tag);
xs.cr(); xs.cr();
} }
} // end switch } // end switch