output_(output), pendingspace_(false), pendingbrace_(false),
textmode_(false), locked_(0), ascii_(0), canbreakline_(true),
mathsout_(false), ulemcmd_(NONE), line_(0), encoding_(encoding),
- row_entry_(TexRow::row_none)
+ row_entry_(TexRow::row_none), mathclass_(false)
{}
//////////////////////////////////////////////////////////////////////
-MathStream::MathStream(odocstream & os)
- : os_(os), tab_(0), line_(0), in_text_(false)
+MathStream::MathStream(odocstream & os, std::string xmlns, bool xmlMode)
+ : os_(os), tab_(0), line_(0), in_text_(false), xmlns_(xmlns), xml_mode_(xmlMode)
{}
docstring MathStream::deferred() const
-{
+{
return deferred_.str();
}
{
++ms.tab();
ms.cr();
- ms.os() << '<' << from_ascii(t.tag_);
+ ms.os() << '<' << from_ascii(ms.namespacedTag(t.tag_));
if (!t.attr_.empty())
ms.os() << " " << from_ascii(t.attr_);
- ms << '>';
+ ms << ">";
return ms;
}
ms.cr();
if (ms.tab() > 0)
--ms.tab();
- ms.os() << "</" << from_ascii(t.tag_) << '>';
+ ms.os() << "</" << from_ascii(ms.namespacedTag(t.tag_)) << ">";
+ return ms;
+}
+
+
+MathStream & operator<<(MathStream & ms, CTag const & t)
+{
+ ms.cr();
+ ms.os() << "<" << from_ascii(ms.namespacedTag(t.tag_));
+ if (!t.attr_.empty())
+ ms.os() << " " << from_utf8(t.attr_);
+ ms.os() << "/>";
return ms;
}
docstring HtmlStream::deferred() const
-{
+{
return deferred_.str();
}
//////////////////////////////////////////////////////////////////////
-SetMode::SetMode(MathStream & os, bool text)
- : os_(os)
+SetMode::SetMode(MathStream & ms, bool text)
+ : ms_(ms)
{
- was_text_ = os_.inText();
- os_.setTextMode(text);
+ was_text_ = ms_.inText();
+ ms_.setTextMode(text);
}
SetMode::~SetMode()
{
- os_.setTextMode(was_text_);
+ ms_.setTextMode(was_text_);
}
}
-docstring convertDelimToXMLEscape(docstring const & name)
+docstring convertDelimToXMLEscape(docstring const & name, bool xmlmode)
{
+ // For the basic symbols, no difference between XML and HTML.
if (name.size() == 1) {
char_type const c = name[0];
if (c == '<')
return from_ascii(">");
else
return name;
+ } else if (name.size() == 2 && name[0] == '\\') {
+ char_type const c = name[1];
+ if (c == '{')
+ return from_ascii("{");
+ else if (c == '}')
+ return from_ascii("}");
}
MathWordList const & words = mathedWordList();
MathWordList::const_iterator it = words.find(name);
if (it != words.end()) {
- docstring const escape = it->second.xmlname;
+ // Only difference between XML and HTML, based on the contents read by MathFactory.
+ docstring const escape = xmlmode ? it->second.xmlname : it->second.htmlname;
return escape;
}
LYXERR0("Unable to find `" << name <<"' in the mathWordList.");