mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
XHTML output was a mess for grids output as LaTeX. This will probably
still be a mess in many cases, but hopefully we won't have to go here very often. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37181 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fe9aabf34a
commit
68c43a2b18
@ -1998,6 +1998,44 @@ void InsetMathHull::mathmlize(MathStream & os) const
|
||||
}
|
||||
|
||||
|
||||
void InsetMathHull::mathAsLatex(WriteStream & os) const
|
||||
{
|
||||
MathEnsurer ensurer(os, false);
|
||||
bool havenumbers = false;
|
||||
for (size_t i = 0; i != numbered_.size(); ++i) {
|
||||
if (numbered_[i]) {
|
||||
havenumbers = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool const havetable = havenumbers || nrows() > 1 || ncols() > 1;
|
||||
|
||||
if (!havetable) {
|
||||
os << cell(index(0, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
os << "<table class='mathtable'>";
|
||||
for (row_type row = 0; row < nrows(); ++row) {
|
||||
os << "<tr>";
|
||||
for (col_type col = 0; col < ncols(); ++col) {
|
||||
os << "<td class='math'>";
|
||||
os << cell(index(row, col));
|
||||
os << "</td>";
|
||||
}
|
||||
if (havenumbers) {
|
||||
os << "<td>";
|
||||
docstring const & num = numbers_[row];
|
||||
if (!num.empty())
|
||||
os << '(' << num << ')';
|
||||
os << "</td>";
|
||||
}
|
||||
os << "</tr>";
|
||||
}
|
||||
os << "</table>";
|
||||
}
|
||||
|
||||
|
||||
docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
|
||||
{
|
||||
BufferParams::MathOutput const mathtype =
|
||||
@ -2075,14 +2113,15 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, OutputParams const & op) const
|
||||
odocstringstream ls;
|
||||
WriteStream wi(ls, false, true, WriteStream::wsPreview);
|
||||
ModeSpecifier specifier(wi, MATH_MODE);
|
||||
InsetMathGrid::write(wi);
|
||||
mathAsLatex(wi);
|
||||
docstring const latex = ls.str();
|
||||
|
||||
// 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'")
|
||||
xs << html::StartTag(tag, "class='math'")
|
||||
<< XHTMLStream::ESCAPE_AND
|
||||
<< latex
|
||||
<< html::EndTag(tag);
|
||||
xs.cr();
|
||||
|
@ -132,6 +132,8 @@ public:
|
||||
void mathmlize(MathStream &) const;
|
||||
///
|
||||
void htmlize(HtmlStream &) const;
|
||||
///
|
||||
void mathAsLatex(WriteStream &) const;
|
||||
///
|
||||
void toString(odocstream &) const;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user