// MathML
//
+
+/// Start tag.
class MTag {
public:
///
std::string attr_;
};
+
+/// End tag.
class ETag {
public:
///
};
+/// Compound tag (no content, directly closed).
+class CTag {
+public:
+ ///
+ CTag(char const * const tag, std::string attr = "")
+ : tag_(tag), attr_(attr) {}
+ ///
+ char const * const tag_;
+ ///
+ std::string attr_;
+};
+
+
/// Throw MathExportException to signal that the attempt to export
/// some math in the current format did not succeed. E.g., we can't
/// export xymatrix as MathML, so that will throw, and we'll fall back
class MathStream {
public:
- ///
- explicit MathStream(odocstream & os);
+ /// Builds a stream proxy for os; the MathML namespace is given by xmlns (supposed to be already defined elsewhere in the document).
+ explicit MathStream(odocstream & os, std::string xmlns="");
///
void cr();
///
docstring deferred() const;
///
bool inText() const { return in_text_; }
+ ///
+ std::string xmlns() const { return xmlns_; }
+ /// Returns the tag name prefixed by the name space if needed.
+ std::string namespacedTag(std::string tag) const { return ((xmlns().empty()) ? "" : xmlns() + ":") + tag; }
private:
///
void setTextMode(bool t) { in_text_ = t; }
///
odocstringstream deferred_;
///
+ std::string xmlns_;
+ ///
friend class SetMode;
};
MathStream & operator<<(MathStream &, MTag const &);
///
MathStream & operator<<(MathStream &, ETag const &);
+///
+MathStream & operator<<(MathStream &, CTag const &);
/// A simpler version of ModeSpecifier, for MathML
class SetMode {
public:
///
- explicit SetMode(MathStream & os, bool text);
+ explicit SetMode(MathStream & ms, bool text);
///
~SetMode();
private:
///
- MathStream & os_;
+ MathStream & ms_;
///
bool was_text_;
};