]> git.lyx.org Git - features.git/commitdiff
HTML for roots.
authorRichard Heck <rgheck@comcast.net>
Wed, 31 Mar 2010 20:31:04 +0000 (20:31 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 31 Mar 2010 20:31:04 +0000 (20:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33983 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathRoot.cpp
src/mathed/InsetMathRoot.h
src/mathed/InsetMathSqrt.cpp
src/mathed/InsetMathSqrt.h

index 38c09469c90473840745c441e2b1fe307c47ce6c..722e16792e4c7fe1cd4fc950b414df1b6be52489 100644 (file)
@@ -12,6 +12,8 @@
 #include <config.h>
 
 #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("&radic;") 
+          << 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("<style type=\"text/css\">\n"
+                       "span.rootof{border-top: thin solid black;}\n"
+                       "span.root sup{font-size: 75%;}\n"
+                       "</style>");
+}
+
 } // namespace lyx
index cfcac0a7f3189b68bf368cbd8fd6093e3009c7ae..18bacbbf18888bc825da8c080217ea50c9d50733 100644 (file)
@@ -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;
index f738e2c17bc516db242b681850146839f7050244..e27475ed1484a0575e088870abf02e864deda0d5 100644 (file)
@@ -11,6 +11,8 @@
 #include <config.h>
 
 #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("&radic;") 
+          << 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("<style type=\"text/css\">\n"
+                       "span.sqrtof{border-top: thin solid black;}\n"
+                       "</style>");
+}
+
 } // namespace lyx
index 485f66a574d856016365d63128e1b2dbf3747839..d2aab3282b027c2665b6baf34fffa098c178f3a3 100644 (file)
@@ -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;