]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathStream.cpp
Account for old versions of Pygments
[lyx.git] / src / mathed / MathStream.cpp
index ed23eb416040a88a6303bb721d965d33cb5b68f9..cf3fb51f1f0ba484be79ef9dc7567570b20c3afd 100644 (file)
 
 #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 <algorithm>
 #include <cstring>
@@ -121,20 +125,13 @@ WriteStream & operator<<(WriteStream & ws, docstring const & s)
 }
 
 
-WriteStream::WriteStream(odocstream & os, bool fragile, bool latex, OutputType output,
-                       Encoding const * encoding)
+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(odocstream & 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,6 +180,20 @@ void WriteStream::asciiOnly(bool ascii)
 }
 
 
+Changer WriteStream::changeRowEntry(TexRow::RowEntry entry)
+{
+       return make_change(row_entry_, entry);
+}
+
+
+bool WriteStream::startOuterRow()
+{
+       if (TexRow::isNone(row_entry_))
+               return false;
+       return texrow().start(row_entry_);
+}
+
+
 WriteStream & operator<<(WriteStream & ws, MathAtom const & at)
 {
        at->write(ws);
@@ -687,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("&lt;");
+               else if (c == '>')
+                       return from_ascii("&gt;");
+               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