#include <algorithm>
#include <cstring>
#include <ostream>
+#include <FontInfo.h>
using namespace std;
} else if (ws.pendingSpace()) {
if (isAlphaASCII(s[first]))
ws.os() << ' ';
+ else if (s[first] == '[' && ws.useBraces())
+ ws.os() << "{}";
else if (s[first] == ' ' && ws.textMode())
ws.os() << '\\';
ws.pendingSpace(false);
+ } else if (ws.useBraces()) {
+ if (s[first] == '\'')
+ ws.os() << "{}";
+ ws.useBraces(false);
}
ws.os() << s.substr(first);
int lf = 0;
}
-void TeXMathStream::pendingSpace(bool how)
+void TeXMathStream::pendingSpace(bool space)
{
- pendingspace_ = how;
+ pendingspace_ = space;
+ if (!space)
+ usebraces_ = false;
+}
+
+
+void TeXMathStream::useBraces(bool braces)
+{
+ usebraces_ = braces;
}
} else if (ws.pendingSpace()) {
if (isAlphaASCII(c))
ws.os() << ' ';
+ else if (c == '[' && ws.useBraces())
+ ws.os() << "{}";
else if (c == ' ' && ws.textMode())
ws.os() << '\\';
ws.pendingSpace(false);
+ } else if (ws.useBraces()) {
+ if (c == '\'')
+ ws.os() << "{}";
+ ws.useBraces(false);
}
ws.os() << c;
if (c == '\n')
MathMLStream::MathMLStream(odocstream & os, std::string const & xmlns, bool xmlMode)
: os_(os), tab_(0), line_(0), in_text_(false), xmlns_(xmlns), xml_mode_(xmlMode)
-{}
+{
+ if (in_text_)
+ font_math_style_ = TEXT_STYLE;
+ else
+ font_math_style_ = DISPLAY_STYLE;
+}
void MathMLStream::cr()
}
+MathMLStream & operator<<(MathMLStream & ms, MTagInline const & t)
+{
+ ms.cr();
+ ms.os() << '<' << from_ascii(ms.namespacedTag(t.tag_));
+ if (!t.attr_.empty())
+ ms.os() << " " << from_ascii(t.attr_);
+ ms << ">";
+ return ms;
+}
+
+
MathMLStream & operator<<(MathMLStream & ms, ETag const & t)
{
ms.cr();
}
+MathMLStream & operator<<(MathMLStream & ms, ETagInline const & t)
+{
+ ms.os() << "</" << from_ascii(ms.namespacedTag(t.tag_)) << ">";
+ return ms;
+}
+
+
MathMLStream & operator<<(MathMLStream & ms, CTag const & t)
{
ms.cr();