Fractions via HTML.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33945 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-30 02:03:45 +00:00
parent f5bcb24da2
commit 0190b003b0
2 changed files with 18 additions and 0 deletions

View File

@ -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("<style type=\"text/css\">\n"
"span.frac{display: inline-block; vertical-align: middle; text-align:center;}\n"
"span.numer{display: block;}\n"
"span.denom{display: block; border-top: thin solid #000040;}\n"
"</style>");
InsetMathNest::validate(features);
}

View File

@ -84,6 +84,8 @@ public:
///
void mathmlize(MathStream &) const;
///
void htmlize(HtmlStream &) const;
///
void validate(LaTeXFeatures & features) const;
public:
Inset * clone() const;