}
+void InsetMathBox::htmlize(HtmlStream & ms) const
+{
+ SetHTMLMode textmode(ms, true);
+ ms << cell(0);
+}
+
+
void InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const
{
FontSetChanger dummy(mi.base, "textnormal");
{
if (name_ == "tag" || name_ == "tag*")
features.require("amsmath");
+
cell(0).validate(features);
}
}
+void InsetMathFBox::htmlize(HtmlStream & ms) const
+{
+ SetHTMLMode textmode(ms, true, "class='fbox'");
+ ms << cell(0);
+}
+
+
void InsetMathFBox::infoize(odocstream & os) const
{
os << "FBox: ";
if (features.runparams().flavor == OutputParams::HTML)
features.addPreambleSnippet("<style type=\"text/css\">\n"
"mtext.fbox { border: 1px solid black; }\n"
+ "span.fbox { border: 1px solid black; }\n"
"</style>");
}
}
+void InsetMathMakebox::htmlize(HtmlStream & ms) const
+{
+ // FIXME We could do something with the other arguments.
+ std::string const cssclass = framebox_ ? "framebox" : "makebox";
+ SetHTMLMode textmode(ms, true, "class='" + cssclass + "'");
+ ms << cell(2);
+}
+
+
void InsetMathMakebox::validate(LaTeXFeatures & features) const
{
// FIXME XHTML
if (features.runparams().flavor == OutputParams::HTML)
features.addPreambleSnippet("<style type=\"text/css\">\n"
"mtext.framebox { border: 1px solid black; }\n"
+ "span.framebox { border: 1px solid black; }\n"
"</style>");
}
}
+void InsetMathBoxed::htmlize(HtmlStream & ms) const
+{
+ SetHTMLMode mathmode(ms, false, "class='boxed'");
+ ms << cell(0);
+}
+
+
void InsetMathBoxed::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
if (features.runparams().flavor == OutputParams::HTML)
features.addPreambleSnippet("<style type=\"text/css\">\n"
"mstyle.boxed { border: 1px solid black; }\n"
+ "span.boxed { border: 1px solid black; }\n"
"</style>");
InsetMathNest::validate(features);
}
///
void mathmlize(MathStream & ms) const;
///
+ void htmlize(HtmlStream & ms) const;
+ ///
void infoize(odocstream & os) const;
///
void validate(LaTeXFeatures & features) const;
///
void mathmlize(MathStream & ms) const;
///
+ void htmlize(HtmlStream & ms) const;
+ ///
void infoize(odocstream & os) const;
///
void validate(LaTeXFeatures & features) const;
///
void mathmlize(MathStream & ms) const;
///
+ void htmlize(HtmlStream & ms) const;
+ ///
mode_type currentMode() const { return TEXT_MODE; }
///
void infoize(odocstream & os) const;
void write(WriteStream & os) const;
///
void mathmlize(MathStream & ms) const;
+ ///
+ void htmlize(HtmlStream & ms) const;
/// write normalized content
void normalize(NormalStream & ns) const;
///
//////////////////////////////////////////////////////////////////////
+SetHTMLMode::SetHTMLMode(HtmlStream & os, bool text)
+ : os_(os), opened_(false)
+{
+ was_text_ = os_.inText();
+ if (text)
+ os_.setTextMode();
+ else
+ os_.setMathMode();
+}
+
+
+SetHTMLMode::SetHTMLMode(HtmlStream & os, bool text, string attrs)
+ : os_(os), opened_(true)
+{
+ was_text_ = os_.inText();
+ if (text) {
+ os_.setTextMode();
+ os_ << MTag("span", attrs);
+ } else
+ os_.setMathMode();
+}
+
+
+SetHTMLMode::~SetHTMLMode()
+{
+ if (opened_)
+ os_ << ETag("span");
+ if (was_text_)
+ os_.setTextMode();
+ else
+ os_.setMathMode();
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+
MapleStream & operator<<(MapleStream & ms, MathAtom const & at)
{
at->maple(ms);
///
odocstringstream deferred_;
///
- friend class SetMode;
+ friend class SetHTMLMode;
};
///
HtmlStream & operator<<(HtmlStream &, ETag const &);
+class SetHTMLMode {
+public:
+ ///
+ explicit SetHTMLMode(HtmlStream & os, bool text, std::string attrs);
+ ///
+ explicit SetHTMLMode(HtmlStream & os, bool text);
+ ///
+ ~SetHTMLMode();
+private:
+ ///
+ HtmlStream & os_;
+ ///
+ bool opened_;
+ ///
+ bool was_text_;
+};
+
+
//
// Debugging
//