HTML for xarrows.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35026 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-07-29 15:44:17 +00:00
parent c8bc76b333
commit b520657039
2 changed files with 20 additions and 0 deletions

View File

@ -86,9 +86,27 @@ void InsetMathXArrow::mathmlize(MathStream & ms) const
} }
void InsetMathXArrow::htmlize(HtmlStream & os) const
{
char const * const arrow = name_ == "xleftarrow"
? "←" : "→";
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 void InsetMathXArrow::validate(LaTeXFeatures & features) const
{ {
features.require("amsmath"); 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); InsetMathNest::validate(features);
} }

View File

@ -34,6 +34,8 @@ public:
/// ///
void mathmlize(MathStream &) const; void mathmlize(MathStream &) const;
/// ///
void htmlize(HtmlStream &) const;
///
void validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
/// ///
InsetCode lyxCode() const { return MATH_XARROW_CODE; } InsetCode lyxCode() const { return MATH_XARROW_CODE; }