+void InsetMathDecoration::htmlize(HtmlStream & os) const
+{
+ string const name = to_utf8(key_->name);
+ if (name == "bar") {
+ os << MTag("span", "class='overbar'") << cell(0) << ETag("span");
+ return;
+ }
+
+ if (name == "underbar" || name == "underline") {
+ os << MTag("span", "class='underbar'") << cell(0) << ETag("span");
+ return;
+ }
+
+ TranslationMap const & t = translationMap();
+ TranslationMap::const_iterator cur = t.find(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().math_flavor == OutputParams::MathAsHTML) {
+ string const name = to_utf8(key_->name);
+ if (name == "bar") {
+ features.addCSSSnippet("span.overbar{border-top: thin black solid;}");
+ } else if (name == "underbar" || name == "underline") {
+ features.addCSSSnippet("span.underbar{border-bottom: thin black solid;}");
+ } else {
+ features.addCSSSnippet(
+ "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;}");
+ }
+ } else {
+ if (!key_->requires.empty())
+ features.require(key_->requires);
+ }
+ InsetMathNest::validate(features);
+}
+