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

src/mathed/InsetMathFrac.cpp
src/mathed/InsetMathFrac.h

index 9ec6c7b0862d1dd686b71ee2876c3d120786a867..e017b91d9a66d6ff150c66bd44e8e64b8476664c 100644 (file)
@@ -578,12 +578,49 @@ void InsetMathBinom::mathmlize(MathStream & os) const
 }
 
 
+void InsetMathBinom::htmlize(HtmlStream & os) const
+{
+       char ldelim = ' ';
+       char rdelim = ' ';
+       switch (kind_) {
+       case BINOM:
+       case TBINOM:
+       case DBINOM:
+       case CHOOSE:
+               ldelim = '(';
+               rdelim = ')';
+               break;
+       case BRACE:
+               ldelim = '{';
+               rdelim = '}';
+               break;
+       case BRACK:
+               ldelim = '[';
+               rdelim = ']';
+               break;
+       }
+       os << MTag("span", "class='binomdelim'") << ldelim << ETag("span") << '\n'
+          << MTag("span", "class='binom'") << '\n'
+          << MTag("span") << cell(0) << ETag("span") << '\n'
+          << MTag("span") << cell(1) << ETag("span") << '\n'
+          << ETag("span") << '\n'
+                << MTag("span", "class='binomdelim'") << rdelim << ETag("span") << '\n';
+}
+
+
 void InsetMathBinom::validate(LaTeXFeatures & features) const
 {
-       if (kind_ == BINOM)
-               features.require("binom");
-       if (kind_ == DBINOM || kind_ == TBINOM)
-               features.require("amsmath");
+       if (features.runparams().isLaTeX()) {
+               if (kind_ == BINOM)
+                       features.require("binom");
+               if (kind_ == DBINOM || kind_ == TBINOM)
+                       features.require("amsmath");
+       } else if (features.runparams().math_flavor == OutputParams::MathAsHTML)
+               features.addPreambleSnippet("<style type=\"text/css\">\n"
+                       "span.binom{display: inline-block; vertical-align: bottom; text-align:center;}\n"
+                       "span.binom span{display: block;}\n"
+                       "span.binomdelim{font-size: 2em;}\n"
+                       "</style>");
        InsetMathNest::validate(features);
 }
 
index 3de485f2db3a144751366700ee3b841fabfa0a85..5030730647db540a4f0047f8d875be434c0934ff 100644 (file)
@@ -125,6 +125,8 @@ public:
        ///
        void mathmlize(MathStream &) const;
        ///
+       void htmlize(HtmlStream &) const;
+       ///
        void validate(LaTeXFeatures & features) const;
        ///
        InsetCode lyxCode() const { return MATH_FRAC_CODE; }