]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathExtern.cpp
tex2lyx: support for \item with opt arg in itemize environment
[lyx.git] / src / mathed / MathExtern.cpp
index 2ac732bd7e01462287d8c45c9f926077baf8892a..a943dac8028b8140c34e51d325fd2eec2c1472b8 100644 (file)
@@ -40,6 +40,7 @@
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
+#include "support/TempFile.h"
 
 #include <algorithm>
 #include <sstream>
@@ -977,8 +978,8 @@ void extractStructure(MathData & ar, ExternalMath kind)
                extractSums(ar);
        extractNumbers(ar);
        extractMatrices(ar);
-       extractFunctions(ar, kind);
        if (kind != MATHML && kind != HTML) {
+               extractFunctions(ar, kind);
                extractDets(ar);
                extractDiff(ar);
                extractExps(ar);
@@ -995,7 +996,8 @@ namespace {
        {
                // In order to avoid parsing problems with command interpreters
                // we pass input data through a file
-               FileName const cas_tmpfile = FileName::tempName("casinput");
+               TempFile tempfile("casinput");
+               FileName const cas_tmpfile = tempfile.name();
                if (cas_tmpfile.empty()) {
                        lyxerr << "Warning: cannot create temporary file."
                               << endl;
@@ -1009,7 +1011,6 @@ namespace {
                lyxerr << "calling: " << cmd
                       << "\ninput: '" << data << "'" << endl;
                cmd_ret const ret = runCommand(command);
-               cas_tmpfile.removeFile();
                return ret.second;
        }
 
@@ -1196,7 +1197,7 @@ namespace {
                        istringstream is(out);
                        string line;
                        getline(is, line);
-                       if (line.find("on line") != 0)
+                       if (!prefixIs(line, "on line"))
                                break; // error message not identified
                        getline(is, line);
                        size_t pos = line.find('^');
@@ -1472,7 +1473,8 @@ bool extractNumber(MathData const & ar, int & i)
 {
        idocstringstream is(charSequence(ar.begin(), ar.end()));
        is >> i;
-       return is;
+       // Do not convert is implicitly to bool, since that is forbidden in C++11.
+       return !is.fail();
 }
 
 
@@ -1480,7 +1482,8 @@ bool extractNumber(MathData const & ar, double & d)
 {
        idocstringstream is(charSequence(ar.begin(), ar.end()));
        is >> d;
-       return is;
+       // Do not convert is implicitly to bool, since that is forbidden in C++11.
+       return !is.fail();
 }