- Binom (in Frac): None of these tags exist in MathML 2.0. We'll
just output a fraction with delimiters.
- Lefteqn
- - MBox: Use <mtext>.
+ - MBox: There is a general issue here with text mode nesting. See the FIXME attached
+ to the SetMode class.
- Overset: Use <mover>.
- Par?
- Phantom: There is some support for this in MathML....
void InsetMathBox::mathmlize(MathStream & ms) const
{
- SetMode textmode(ms, true);
+ SetMode textmode(ms, true, from_ascii("class='mathbox'"));
ms << cell(0);
}
}
+void InsetMathFBox::mathmlize(MathStream & ms) const
+{
+ SetMode textmode(ms, true, from_ascii("class='fbox'"));
+ ms << cell(0);
+}
+
+
void InsetMathFBox::infoize(odocstream & os) const
{
os << "FBox: ";
}
+void InsetMathFBox::validate(LaTeXFeatures & features) const
+{
+ // FIXME XHTML
+ // It'd be better to be able to get this from an InsetLayout, but at present
+ // InsetLayouts do not seem really to work for things that aren't InsetTexts.
+ if (features.runparams().flavor == OutputParams::HTML)
+ features.addPreambleSnippet("<style type=\"text/css\">\n"
+ "mtext.fbox { border: 1px solid black; }\n"
+ "</style>");
+}
+
+
+
/////////////////////////////////////////////////////////////////////
//
// InsetMathMakebox
}
+void InsetMathMakebox::mathmlize(MathStream & ms) const
+{
+ // FIXME We could do something with the other arguments.
+ std::string const cssclass = framebox_ ? "framebox" : "makebox";
+ SetMode textmode(ms, true, from_ascii("class='" + cssclass + "'"));
+ ms << cell(2);
+}
+
+
+void InsetMathMakebox::validate(LaTeXFeatures & features) const
+{
+ // FIXME XHTML
+ // It'd be better to be able to get this from an InsetLayout, but at present
+ // InsetLayouts do not seem really to work for things that aren't InsetTexts.
+ if (features.runparams().flavor == OutputParams::HTML)
+ features.addPreambleSnippet("<style type=\"text/css\">\n"
+ "mtext.framebox { border: 1px solid black; }\n"
+ "</style>");
+}
+
+
+
/////////////////////////////////////////////////////////////////////
//
// InsetMathBoxed
}
+void InsetMathBoxed::mathmlize(MathStream & ms) const
+{
+ SetMode mathmode(ms, false, from_ascii("class='boxed'"));
+ ms << cell(0);
+}
+
+
void InsetMathBoxed::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
+ // FIXME XHTML
+ // It'd be better to be able to get this from an InsetLayout, but at present
+ // InsetLayouts do not seem really to work for things that aren't InsetTexts.
+ if (features.runparams().flavor == OutputParams::HTML)
+ features.addPreambleSnippet("<style type=\"text/css\">\n"
+ "mstyle.boxed { border: 1px solid black; }\n"
+ "</style>");
InsetMathNest::validate(features);
}
/// write normalized content
void normalize(NormalStream & ns) const;
///
- //void mathmlize(MathStream & ms) const;
+ void mathmlize(MathStream & ms) const;
///
void infoize(odocstream & os) const;
+ ///
+ void validate(LaTeXFeatures & features) const;
private:
///
Inset * clone() const { return new InsetMathFBox(*this); }
/// write normalized content
void normalize(NormalStream & ns) const;
///
- //void mathmlize(MathStream & ms) const;
+ void mathmlize(MathStream & ms) const;
///
mode_type currentMode() const { return TEXT_MODE; }
///
void infoize(odocstream & os) const;
+ ///
+ void validate(LaTeXFeatures & features) const;
private:
Inset * clone() const { return new InsetMathMakebox(*this); }
///
///
void write(WriteStream & os) const;
///
- //void mathmlize(MathStream & ms) const;
+ void mathmlize(MathStream & ms) const;
/// write normalized content
void normalize(NormalStream & ns) const;
///
SetMode::SetMode(MathStream & os, bool text)
- : os_(os)
+ : os_(os), opened_(false)
{
init(text, from_ascii(""));
}
SetMode::SetMode(MathStream & os, bool text, docstring attrs)
- : os_(os)
+ : os_(os), opened_(false)
{
init(text, attrs);
}
if (!attrs.empty())
os_ << " " << attrs;
os_ << ">";
+ opened_ = true;
} else {
- if (!attrs.empty())
+ if (!attrs.empty()) {
os_ << "<mstyle " << attrs << ">";
+ opened_ = true;
+ }
os_.setMathMode();
}
}
SetMode::~SetMode()
{
- if (os_.inText())
- os_ << "</mtext>";
+ if (opened_) {
+ if (os_.inText())
+ os_ << "</mtext>";
+ else
+ os_ << "</mstyle>";
+ }
if (was_text_) {
os_.setTextMode();
os_ << "<mtext>";
MathStream & operator<<(MathStream &, ETag const &);
-// A simpler version of ModeSpecifier, for MathML
+/// A simpler version of ModeSpecifier, for MathML
+// FIXME There are still problems here with nesting, at least
+// potentially. The problem is that true nesting of text mode isn't
+// actually possible. I.e., we can't have:
+// <mtext><mtext></mtext></mtext>
+// So we have to have:
+// <mtext></mtext><mtext></mtext><mtext></mtext>
+// instead, where the last is really a continuation of the first.
+// We'll need some kind of stack to remember all that.
class SetMode {
public:
///
///
MathStream & os_;
///
+ bool opened_;
+ ///
bool was_text_;
};