]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathSqrt.cpp
HTML for roots.
[lyx.git] / src / mathed / InsetMathSqrt.cpp
index 14f0600498ca7f3bacf31679896d6470a11b8cf1..e27475ed1484a0575e088870abf02e864deda0d5 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -11,6 +11,8 @@
 #include <config.h>
 
 #include "InsetMathSqrt.h"
+
+#include "LaTeXFeatures.h"
 #include "MathData.h"
 #include "MathStream.h"
 #include "TextPainter.h"
@@ -19,8 +21,8 @@
 
 namespace lyx {
 
-InsetMathSqrt::InsetMathSqrt()
-       : InsetMathNest(1)
+InsetMathSqrt::InsetMathSqrt(Buffer * buf)
+       : InsetMathNest(buf, 1)
 {}
 
 
@@ -80,9 +82,8 @@ void InsetMathSqrt::drawT(TextPainter & /*pain*/, int /*x*/, int /*y*/) const
 
 void InsetMathSqrt::write(WriteStream & os) const
 {
-       bool brace = ensureMath(os);
+       MathEnsurer ensurer(os);
        os << "\\sqrt{" << cell(0) << '}';
-       os.pendingBrace(brace);
 }
 
 
@@ -114,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