From 0190b003b000a616a93b67cc1d01dd50dd1526e7 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 30 Mar 2010 02:03:45 +0000 Subject: [PATCH] Fractions via HTML. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33945 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/InsetMathFrac.cpp | 16 ++++++++++++++++ src/mathed/InsetMathFrac.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/mathed/InsetMathFrac.cpp b/src/mathed/InsetMathFrac.cpp index 9a244eaa34..b2ab13c9fa 100644 --- a/src/mathed/InsetMathFrac.cpp +++ b/src/mathed/InsetMathFrac.cpp @@ -393,6 +393,15 @@ void InsetMathFrac::mathmlize(MathStream & os) const } +void InsetMathFrac::htmlize(HtmlStream & os) const +{ + os << MTag("span", "class='frac'") + << MTag("span", "class='numer'") << cell(0) << ETag("span") + << MTag("span", "class='denom'") << cell(1) << ETag("span") + << ETag("span"); +} + + void InsetMathFrac::validate(LaTeXFeatures & features) const { if (kind_ == NICEFRAC || kind_ == UNITFRAC || kind_ == UNIT) @@ -400,6 +409,13 @@ void InsetMathFrac::validate(LaTeXFeatures & features) const if (kind_ == CFRAC || kind_ == CFRACLEFT || kind_ == CFRACRIGHT || kind_ == DFRAC || kind_ == TFRAC) features.require("amsmath"); + if (features.runparams().flavor == OutputParams::HTML) + // CSS adapted from eLyXer + features.addPreambleSnippet(""); InsetMathNest::validate(features); } diff --git a/src/mathed/InsetMathFrac.h b/src/mathed/InsetMathFrac.h index 36e7ba363b..3de485f2db 100644 --- a/src/mathed/InsetMathFrac.h +++ b/src/mathed/InsetMathFrac.h @@ -84,6 +84,8 @@ public: /// void mathmlize(MathStream &) const; /// + void htmlize(HtmlStream &) const; + /// void validate(LaTeXFeatures & features) const; public: Inset * clone() const;