]> git.lyx.org Git - features.git/commitdiff
HTML for xarrows.
authorRichard Heck <rgheck@comcast.net>
Thu, 29 Jul 2010 15:44:17 +0000 (15:44 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 29 Jul 2010 15:44:17 +0000 (15:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35026 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathXArrow.cpp
src/mathed/InsetMathXArrow.h

index 54d73563817641a4580d5d899dfe06c99bd1c17a..31c9c0c5d89fe8e469396c96b983292c5e8d0e04 100644 (file)
@@ -86,9 +86,27 @@ void InsetMathXArrow::mathmlize(MathStream & ms) const
 }
 
 
+void InsetMathXArrow::htmlize(HtmlStream & os) const
+{
+       char const * const arrow = name_ == "xleftarrow" 
+                       ? "&larr;" : "&rarr;";
+       os << MTag("span", "class='xarrow'")
+                << MTag("span", "class='xatop'") << cell(0) << ETag("span")
+                << MTag("span", "class='xabottom'") << arrow << ETag("span")
+                << ETag("span");
+}
+
+
 void InsetMathXArrow::validate(LaTeXFeatures & features) const
 {
        features.require("amsmath");
+       if (features.runparams().math_flavor == OutputParams::MathAsHTML)
+               // CSS adapted from eLyXer
+               features.addPreambleSnippet("<style type=\"text/css\">\n"
+                       "span.xarrow{display: inline-block; vertical-align: middle; text-align:center;}\n"
+                       "span.xatop{display: block;}\n"
+                       "span.xabottom{display: block;}\n"
+                       "</style>");
        InsetMathNest::validate(features);
 }
 
index ac6eaae0f920f3c74ffc0f383a66765332defa22..f63eb2be192a1de19dad30613378a773c51a4039 100644 (file)
@@ -34,6 +34,8 @@ public:
        ///
        void mathmlize(MathStream &) const;
        ///
+       void htmlize(HtmlStream &) const;
+       ///
        void validate(LaTeXFeatures & features) const;
        ///
        InsetCode lyxCode() const { return MATH_XARROW_CODE; }