HTML for binomials.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33995 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-31 21:33:33 +00:00
parent 348991cd71
commit 1eb8311aff
2 changed files with 43 additions and 4 deletions

View 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 (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);
}

View 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; }