mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
Decorations via HTML.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33955 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5aff128354
commit
69fc590ee3
@ -150,13 +150,6 @@ void InsetMathDecoration::infoize(odocstream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetMathDecoration::validate(LaTeXFeatures & features) const
|
|
||||||
{
|
|
||||||
if (!key_->requires.empty())
|
|
||||||
features.require(to_utf8(key_->requires));
|
|
||||||
InsetMathNest::validate(features);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct Attributes {
|
struct Attributes {
|
||||||
Attributes() {}
|
Attributes() {}
|
||||||
@ -184,7 +177,7 @@ namespace {
|
|||||||
t["overbrace"] = Attributes(true, "⏞");
|
t["overbrace"] = Attributes(true, "⏞");
|
||||||
t["overleftarrow"] = Attributes(true, "⟵");
|
t["overleftarrow"] = Attributes(true, "⟵");
|
||||||
t["overleftrightarrow"] = Attributes(true, "⟷");
|
t["overleftrightarrow"] = Attributes(true, "⟷");
|
||||||
t["overline"] = Attributes(false, "¯");
|
t["overline"] = Attributes(true, "¯");
|
||||||
t["overrightarrow"] = Attributes(true, "⟶");
|
t["overrightarrow"] = Attributes(true, "⟶");
|
||||||
t["tilde"] = Attributes(true, "˜");
|
t["tilde"] = Attributes(true, "˜");
|
||||||
t["underbar"] = Attributes(false, "_");
|
t["underbar"] = Attributes(false, "_");
|
||||||
@ -220,4 +213,45 @@ void InsetMathDecoration::mathmlize(MathStream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InsetMathDecoration::htmlize(HtmlStream & os) const
|
||||||
|
{
|
||||||
|
Translator const & t = translator();
|
||||||
|
Translator::const_iterator cur = t.find(to_utf8(key_->name));
|
||||||
|
LASSERT(cur != t.end(), return);
|
||||||
|
bool symontop = cur->second.over;
|
||||||
|
string const symclass = symontop ? "symontop" : "symonbot";
|
||||||
|
os << MTag("span", "class='symbolpair " + symclass + "'")
|
||||||
|
<< '\n';
|
||||||
|
|
||||||
|
if (symontop)
|
||||||
|
os << MTag("span", "class='symbol'") << from_ascii(cur->second.tag);
|
||||||
|
else
|
||||||
|
os << MTag("span", "class='base'") << cell(0);
|
||||||
|
os << ETag("span") << '\n';
|
||||||
|
if (symontop)
|
||||||
|
os << MTag("span", "class='base'") << cell(0);
|
||||||
|
else
|
||||||
|
os << MTag("span", "class='symbol'") << from_ascii(cur->second.tag);
|
||||||
|
os << ETag("span") << '\n' << ETag("span") << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ideas borrowed from the eLyXer code
|
||||||
|
void InsetMathDecoration::validate(LaTeXFeatures & features) const
|
||||||
|
{
|
||||||
|
if (features.runparams().flavor == OutputParams::HTML) {
|
||||||
|
features.addPreambleSnippet("<style type=\"text/css\">\n"
|
||||||
|
"span.symbolpair{display: inline-block; text-align:center;}\n"
|
||||||
|
"span.symontop{vertical-align: top;}\n"
|
||||||
|
"span.symonbot{vertical-align: bottom;}\n"
|
||||||
|
"span.symbolpair span{display: block;}\n"
|
||||||
|
"span.symbol{height: 0.5ex;}\n"
|
||||||
|
"</style>");
|
||||||
|
} else {
|
||||||
|
if (!key_->requires.empty())
|
||||||
|
features.require(to_utf8(key_->requires));
|
||||||
|
}
|
||||||
|
InsetMathNest::validate(features);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
@ -43,7 +43,8 @@ public:
|
|||||||
InsetCode lyxCode() const { return MATH_DECORATION_CODE; }
|
InsetCode lyxCode() const { return MATH_DECORATION_CODE; }
|
||||||
///
|
///
|
||||||
void mathmlize(MathStream &) const;
|
void mathmlize(MathStream &) const;
|
||||||
|
///
|
||||||
|
void htmlize(HtmlStream &) const;
|
||||||
private:
|
private:
|
||||||
virtual Inset * clone() const;
|
virtual Inset * clone() const;
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user