}
-void InsetMathDecoration::validate(LaTeXFeatures & features) const
-{
- if (!key_->requires.empty())
- features.require(to_utf8(key_->requires));
- InsetMathNest::validate(features);
-}
-
namespace {
struct Attributes {
Attributes() {}
t["overbrace"] = Attributes(true, "⏞");
t["overleftarrow"] = Attributes(true, "⟵");
t["overleftrightarrow"] = Attributes(true, "⟷");
- t["overline"] = Attributes(false, "¯");
+ t["overline"] = Attributes(true, "¯");
t["overrightarrow"] = Attributes(true, "⟶");
t["tilde"] = Attributes(true, "˜");
t["underbar"] = Attributes(false, "_");
}
+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