HTML for roots.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33983 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-31 20:31:04 +00:00
parent 36e2a2c95f
commit 32ee4c13cf
4 changed files with 48 additions and 0 deletions

View File

@ -12,6 +12,8 @@
#include <config.h>
#include "InsetMathRoot.h"
#include "LaTeXFeatures.h"
#include "MathData.h"
#include "MathStream.h"
#include "Cursor.h"
@ -118,4 +120,23 @@ void InsetMathRoot::mathmlize(MathStream & os) const
}
void InsetMathRoot::htmlize(HtmlStream & os) const
{
os << MTag("span", "class='root'")
<< MTag("sup") << cell(0) << ETag("sup")
<< from_ascii("&radic;")
<< MTag("span", "class='rootof'") << cell(1) << ETag("span")
<< ETag("span");
}
void InsetMathRoot::validate(LaTeXFeatures & features) const
{
if (features.runparams().math_flavor == OutputParams::MathAsHTML)
features.addPreambleSnippet("<style type=\"text/css\">\n"
"span.rootof{border-top: thin solid black;}\n"
"span.root sup{font-size: 75%;}\n"
"</style>");
}
} // namespace lyx

View File

@ -38,6 +38,8 @@ public:
///
void mathmlize(MathStream &) const;
///
void htmlize(HtmlStream &) const;
///
void maple(MapleStream &) const;
///
void mathematica(MathematicaStream &) const;
@ -45,6 +47,8 @@ public:
void octave(OctaveStream &) const;
///
InsetCode lyxCode() const { return MATH_ROOT_CODE; }
///
void validate(LaTeXFeatures &) const;
private:
virtual Inset * clone() const;

View File

@ -11,6 +11,8 @@
#include <config.h>
#include "InsetMathSqrt.h"
#include "LaTeXFeatures.h"
#include "MathData.h"
#include "MathStream.h"
#include "TextPainter.h"
@ -113,4 +115,21 @@ void InsetMathSqrt::mathmlize(MathStream & os) const
}
void InsetMathSqrt::htmlize(HtmlStream & os) const
{
os << MTag("span", "class='sqrt'")
<< from_ascii("&radic;")
<< MTag("span", "class='sqrtof'") << cell(0) << ETag("span")
<< ETag("span");
}
void InsetMathSqrt::validate(LaTeXFeatures & features) const
{
if (features.runparams().math_flavor == OutputParams::MathAsHTML)
features.addPreambleSnippet("<style type=\"text/css\">\n"
"span.sqrtof{border-top: thin solid black;}\n"
"</style>");
}
} // namespace lyx

View File

@ -46,7 +46,11 @@ public:
///
void mathmlize(MathStream &) const;
///
void htmlize(HtmlStream &) const;
///
InsetCode lyxCode() const { return MATH_SQRT_CODE; }
///
void validate(LaTeXFeatures &) const;
private:
virtual Inset * clone() const;