Cases for HTML.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33950 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-30 02:57:05 +00:00
parent 3e31491871
commit f835e2a6f9
4 changed files with 27 additions and 2 deletions

View File

@ -163,6 +163,14 @@ void InsetMathCases::mathmlize(MathStream & ms) const
}
// FIXME XHTML
// We need a brace here, somehow.
void InsetMathCases::htmlize(HtmlStream & ms) const
{
InsetMathGrid::htmlize(ms, "cases");
}
void InsetMathCases::infoize(odocstream & os) const
{
os << "Cases ";
@ -173,6 +181,13 @@ void InsetMathCases::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
InsetMathGrid::validate(features);
if (features.runparams().flavor == OutputParams::HTML)
// CSS based on eLyXer's
features.addPreambleSnippet("<style type=\"text/css\">\n"
"table.cases{display: inline-block; text-align: center;"
"border-left: thin solid black; vertical-align: middle; padding-left: 0.5ex;}\n"
"table.cases td {text-align: left;}\n"
"</style>");
}

View File

@ -45,6 +45,8 @@ public:
///
void mathmlize(MathStream &) const;
///
void htmlize(HtmlStream &) const;
///
void write(WriteStream & os) const;
///
void validate(LaTeXFeatures & features) const;

View File

@ -998,14 +998,14 @@ void InsetMathGrid::mathmlize(MathStream & os) const
}
void InsetMathGrid::htmlize(HtmlStream & os) const
void InsetMathGrid::htmlize(HtmlStream & os, string attrib) const
{
bool const havetable = nrows() > 1 || ncols() > 1;
if (!havetable) {
os << cell(index(0, 0));
return;
}
os << MTag("table", "class='mathtable'");
os << MTag("table", "class='" + attrib + "'");
for (row_type row = 0; row < nrows(); ++row) {
os << MTag("tr");;
for (col_type col = 0; col < ncols(); ++col) {
@ -1019,6 +1019,12 @@ void InsetMathGrid::htmlize(HtmlStream & os) const
}
void InsetMathGrid::htmlize(HtmlStream & os) const
{
htmlize(os, "mathtable");
}
void InsetMathGrid::write(WriteStream & os) const
{
write(os, 0, 0, nrows(), ncols());

View File

@ -225,6 +225,8 @@ public:
///
void htmlize(HtmlStream &) const;
///
void htmlize(HtmlStream &, std::string attrib) const;
///
//void octave(OctaveStream &) const;
protected: