From f835e2a6f94584efe8ee63ed73cdc45bcd7bb05c Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 30 Mar 2010 02:57:05 +0000 Subject: [PATCH] Cases for HTML. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33950 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathCases.cpp | 15 +++++++++++++++ src/mathed/InsetMathCases.h | 2 ++ src/mathed/InsetMathGrid.cpp | 10 ++++++++-- src/mathed/InsetMathGrid.h | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/mathed/InsetMathCases.cpp b/src/mathed/InsetMathCases.cpp index 94a9c0e84b..8d56df5369 100644 --- a/src/mathed/InsetMathCases.cpp +++ b/src/mathed/InsetMathCases.cpp @@ -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(""); } diff --git a/src/mathed/InsetMathCases.h b/src/mathed/InsetMathCases.h index 5839cef277..f753f12166 100644 --- a/src/mathed/InsetMathCases.h +++ b/src/mathed/InsetMathCases.h @@ -45,6 +45,8 @@ public: /// void mathmlize(MathStream &) const; /// + void htmlize(HtmlStream &) const; + /// void write(WriteStream & os) const; /// void validate(LaTeXFeatures & features) const; diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp index 14f9ba87dd..c918243325 100644 --- a/src/mathed/InsetMathGrid.cpp +++ b/src/mathed/InsetMathGrid.cpp @@ -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()); diff --git a/src/mathed/InsetMathGrid.h b/src/mathed/InsetMathGrid.h index cd86b6b7f6..efb2fcc236 100644 --- a/src/mathed/InsetMathGrid.h +++ b/src/mathed/InsetMathGrid.h @@ -225,6 +225,8 @@ public: /// void htmlize(HtmlStream &) const; /// + void htmlize(HtmlStream &, std::string attrib) const; + /// //void octave(OctaveStream &) const; protected: -- 2.39.2