X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathStream.cpp;h=cf3fb51f1f0ba484be79ef9dc7567570b20c3afd;hb=02e82157ec583c3900e359de86be79fac6512387;hp=dabfc0680f93bb5ff8a03a9b9d880290be681aeb;hpb=460a764b7f601871dbb8ed4ad0f8260e7cdad509;p=lyx.git diff --git a/src/mathed/MathStream.cpp b/src/mathed/MathStream.cpp index dabfc0680f..cf3fb51f1f 100644 --- a/src/mathed/MathStream.cpp +++ b/src/mathed/MathStream.cpp @@ -12,11 +12,15 @@ #include "MathStream.h" +#include "MathFactory.h" #include "MathData.h" #include "MathExtern.h" -#include "support/textutils.h" +#include "TexRow.h" + #include "support/docstring.h" +#include "support/RefChanger.h" +#include "support/textutils.h" #include #include @@ -124,17 +128,10 @@ WriteStream & operator<<(WriteStream & ws, docstring const & s) WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex, OutputType output, Encoding const * encoding) : os_(os), fragile_(fragile), firstitem_(false), latex_(latex), - output_(output), pendingspace_(false), pendingbrace_(false), - textmode_(false), locked_(0), ascii_(0), canbreakline_(true), - line_(0), encoding_(encoding) -{} - - -WriteStream::WriteStream(otexrowstream & os) - : os_(os), fragile_(false), firstitem_(false), latex_(false), - output_(wsDefault), pendingspace_(false), pendingbrace_(false), - textmode_(false), locked_(0), ascii_(0), canbreakline_(true), - line_(0), encoding_(0) + output_(output), insidemacro_(false), 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) {} @@ -183,26 +180,17 @@ void WriteStream::asciiOnly(bool ascii) } -void WriteStream::pushRowEntry(TexRow::RowEntry entry) +Changer WriteStream::changeRowEntry(TexRow::RowEntry entry) { - outer_row_entries_.push_back(entry); -} - - -void WriteStream::popRowEntry() -{ - if (!outer_row_entries_.empty()) - outer_row_entries_.pop_back(); + return make_change(row_entry_, entry); } bool WriteStream::startOuterRow() { - size_t n = outer_row_entries_.size(); - if (n > 0) - return texrow().start(outer_row_entries_[n - 1]); - else + if (TexRow::isNone(row_entry_)) return false; + return texrow().start(row_entry_); } @@ -710,4 +698,25 @@ OctaveStream & operator<<(OctaveStream & os, string const & s) } +docstring convertDelimToXMLEscape(docstring const & name) +{ + if (name.size() == 1) { + char_type const c = name[0]; + if (c == '<') + return from_ascii("<"); + else if (c == '>') + return from_ascii(">"); + else + return name; + } + MathWordList const & words = mathedWordList(); + MathWordList::const_iterator it = words.find(name); + if (it != words.end()) { + docstring const escape = it->second.xmlname; + return escape; + } + LYXERR0("Unable to find `" << name <<"' in the mathWordList."); + return name; +} + } // namespace lyx