From: Richard Heck Date: Wed, 31 Mar 2010 20:31:04 +0000 (+0000) Subject: HTML for roots. X-Git-Tag: 2.0.0~3597 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=32ee4c13cf3deb6dc7eb0b25e3dee2efd8d99967;p=features.git HTML for roots. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33983 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/InsetMathRoot.cpp b/src/mathed/InsetMathRoot.cpp index 38c09469c9..722e16792e 100644 --- a/src/mathed/InsetMathRoot.cpp +++ b/src/mathed/InsetMathRoot.cpp @@ -12,6 +12,8 @@ #include #include "InsetMathRoot.h" + +#include "LaTeXFeatures.h" #include "MathData.h" #include "MathStream.h" #include "Cursor.h" @@ -118,4 +120,23 @@ void InsetMathRoot::mathmlize(MathStream & os) const } +void InsetMathRoot::htmlize(HtmlStream & os) const +{ + os << MTag("span", "class='root'") + << MTag("sup") << cell(0) << ETag("sup") + << from_ascii("√") + << MTag("span", "class='rootof'") << cell(1) << ETag("span") + << ETag("span"); +} + + +void InsetMathRoot::validate(LaTeXFeatures & features) const +{ + if (features.runparams().math_flavor == OutputParams::MathAsHTML) + features.addPreambleSnippet(""); +} + } // namespace lyx diff --git a/src/mathed/InsetMathRoot.h b/src/mathed/InsetMathRoot.h index cfcac0a7f3..18bacbbf18 100644 --- a/src/mathed/InsetMathRoot.h +++ b/src/mathed/InsetMathRoot.h @@ -38,6 +38,8 @@ public: /// void mathmlize(MathStream &) const; /// + void htmlize(HtmlStream &) const; + /// void maple(MapleStream &) const; /// void mathematica(MathematicaStream &) const; @@ -45,6 +47,8 @@ public: void octave(OctaveStream &) const; /// InsetCode lyxCode() const { return MATH_ROOT_CODE; } + /// + void validate(LaTeXFeatures &) const; private: virtual Inset * clone() const; diff --git a/src/mathed/InsetMathSqrt.cpp b/src/mathed/InsetMathSqrt.cpp index f738e2c17b..e27475ed14 100644 --- a/src/mathed/InsetMathSqrt.cpp +++ b/src/mathed/InsetMathSqrt.cpp @@ -11,6 +11,8 @@ #include #include "InsetMathSqrt.h" + +#include "LaTeXFeatures.h" #include "MathData.h" #include "MathStream.h" #include "TextPainter.h" @@ -113,4 +115,21 @@ void InsetMathSqrt::mathmlize(MathStream & os) const } +void InsetMathSqrt::htmlize(HtmlStream & os) const +{ + os << MTag("span", "class='sqrt'") + << from_ascii("√") + << MTag("span", "class='sqrtof'") << cell(0) << ETag("span") + << ETag("span"); +} + + +void InsetMathSqrt::validate(LaTeXFeatures & features) const +{ + if (features.runparams().math_flavor == OutputParams::MathAsHTML) + features.addPreambleSnippet(""); +} + } // namespace lyx diff --git a/src/mathed/InsetMathSqrt.h b/src/mathed/InsetMathSqrt.h index 485f66a574..d2aab3282b 100644 --- a/src/mathed/InsetMathSqrt.h +++ b/src/mathed/InsetMathSqrt.h @@ -46,7 +46,11 @@ public: /// void mathmlize(MathStream &) const; /// + void htmlize(HtmlStream &) const; + /// InsetCode lyxCode() const { return MATH_SQRT_CODE; } + /// + void validate(LaTeXFeatures &) const; private: virtual Inset * clone() const;