void ulemCmd(UlemCmdType ulemcmd) { ulemcmd_ = ulemcmd; }
/// tell which ulem command type we are inside
UlemCmdType ulemCmd() const { return ulemcmd_; }
- /// record whether we are in the optional argument of a math macro
- void insideMacroOpt(bool inopt) { insidemacro_opt_ = inopt; }
- /// tell whether we are in the optional argument of a math macro
- bool insideMacroOpt() const { return insidemacro_opt_; }
/// writes space if next thing is isalpha()
void pendingSpace(bool how);
/// writes space if next thing is isalpha()
void asciiOnly(bool ascii);
/// tell whether to use only ascii chars when producing latex code
bool asciiOnly() const { return ascii_; }
+ /// tell whether we are in a MathClass inset
+ void inMathClass(bool mathclass) { mathclass_ = mathclass; };
+ /// tell whether we are in a MathClass inset
+ bool inMathClass() const { return mathclass_; }
/// LaTeX encoding
Encoding const * encoding() const { return encoding_; }
int latex_;
/// output type (default, source preview, instant preview)?
OutputType output_;
- /// are we in the optional argument of a math macro?
- bool insidemacro_opt_;
/// do we have a space pending?
bool pendingspace_;
/// do we have a brace pending?
Encoding const * encoding_;
/// Row entry we are in
TexRow::RowEntry row_entry_;
+ /// whether we are in a MathClass inset
+ bool mathclass_;
};
///
// MathML
//
+
+/// Start tag.
class MTag {
public:
///
- MTag(char const * const tag, std::string attr = "")
+ MTag(char const * const tag, std::string const & attr = std::string())
: tag_(tag), attr_(attr) {}
///
char const * const tag_;
std::string attr_;
};
+
+/// End tag.
class ETag {
public:
///
- ETag(char const * const tag) : tag_(tag) {}
+ explicit ETag(char const * const tag) : tag_(tag) {}
///
char const * const tag_;
};
+/// 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="", bool xmlMode=false);
///
void cr();
///
docstring deferred() const;
///
bool inText() const { return in_text_; }
+ ///
+ std::string xmlns() const { return xmlns_; }
+ ///
+ bool xmlMode() const { return xml_mode_; }
+ /// 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_;
+ ///
+ bool xml_mode_;
+ ///
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_;
};
OctaveStream & operator<<(OctaveStream &, int);
-docstring convertDelimToXMLEscape(docstring const & name);
+docstring convertDelimToXMLEscape(docstring const & name, bool xmlmode);
} // namespace lyx