summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-05-09 13:00:35 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-05-09 13:00:35 (GMT)
commit7a34f3b64b068c83bb9409d9d0774726a0fe2912 (patch)
tree524f902ec75e45a5d8f5abc1ccc6179364166eca
parent03115ed64d916b94c52275fe0b329bd817d4ce94 (diff)
parent87a4df1aa622994678025b4074374b0eb673dcba (diff)
downloadDoxygen-7a34f3b64b068c83bb9409d9d0774726a0fe2912.zip
Doxygen-7a34f3b64b068c83bb9409d9d0774726a0fe2912.tar.gz
Doxygen-7a34f3b64b068c83bb9409d9d0774726a0fe2912.tar.bz2
Merge branch 'albert-github-feature/bug_inkscape_1'
-rw-r--r--doc/index.doc3
-rw-r--r--src/formula.cpp95
-rw-r--r--src/scanner.l8
3 files changed, 97 insertions, 9 deletions
diff --git a/doc/index.doc b/doc/index.doc
index 97aca86..f55a504 100644
--- a/doc/index.doc
+++ b/doc/index.doc
@@ -153,9 +153,8 @@ know and I'll add them.
Although doxygen is successfully used by large number of companies and
open source projects already, there is always room for improvement.
<p>
-You can submit enhancement requests in
+You can also submit enhancement requests in
<a href="https://github.com/doxygen/doxygen/issues">the bug tracker</a>.
-Make sure the severity of the bug report is set to "enhancement".
<h2>Acknowledgments</h2>
\addindex acknowledgments
diff --git a/src/formula.cpp b/src/formula.cpp
index cb28aba..2bb35c2 100644
--- a/src/formula.cpp
+++ b/src/formula.cpp
@@ -34,6 +34,8 @@
#include "doxygen.h" // for Doxygen::indexList
#include "index.h" // for Doxygen::indexList
+static int determineInkscapeVersion(QDir &thisDir);
+
// Remove the temporary files
#define RM_TMP_FILES (true)
//#define RM_TMP_FILES (false)
@@ -294,22 +296,37 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c
}
Portable::sysTimerStop();
+ // if we have pdf2svg available use it to create a SVG image
if (Portable::checkForExecutable("pdf2svg"))
{
sprintf(args,"%s_tmp.pdf form_%d.svg",formBase.data(),pageNum);
Portable::sysTimerStart();
if (Portable::system("pdf2svg",args)!=0)
{
- err("Problems running pdf2svg. Check your installation!\n");
+ err("Problems running pdf2svg. Check your installation!\n");
Portable::sysTimerStop();
QDir::setCurrent(oldDir);
return;
}
Portable::sysTimerStop();
}
- else if (Portable::checkForExecutable("inkscape"))
+ else if (Portable::checkForExecutable("inkscape")) // alternative is to use inkscape
{
- sprintf(args,"-l form_%d.svg -z %s_tmp.pdf 2>%s",pageNum,formBase.data(),Portable::devNull());
+ int inkscapeVersion = determineInkscapeVersion(thisDir);
+ if (inkscapeVersion == -1)
+ {
+ err("Problems determining the version of inkscape. Check your installation!\n");
+ QDir::setCurrent(oldDir);
+ return;
+ }
+ else if (inkscapeVersion == 0)
+ {
+ sprintf(args,"-l form_%d.svg -z %s_tmp.pdf 2>%s",pageNum,formBase.data(),Portable::devNull());
+ }
+ else // inkscapeVersion >= 1
+ {
+ sprintf(args,"--export-type=svg --export-filename=form_%d.svg %s_tmp.pdf 2>%s",pageNum,formBase.data(),Portable::devNull());
+ }
Portable::sysTimerStart();
if (Portable::system("inkscape",args)!=0)
{
@@ -493,3 +510,75 @@ FormulaManager::DisplaySize FormulaManager::displaySize(int formulaId) const
return p->getDisplaySize(formulaId);
}
+// helper function to detect and return the major version of inkscape.
+// return -1 if the version cannot be determined.
+static int determineInkscapeVersion(QDir &thisDir)
+{
+ // The command line interface (CLI) of Inkscape 1.0 has changed in comparison to
+ // previous versions. In order to invokine Inkscape, the used version is detected
+ // and based on the version the right syntax of the CLI is chosen.
+ static int inkscapeVersion = -2;
+ if (inkscapeVersion == -2) // initial one time version check
+ {
+ QCString inkscapeVersionFile = "inkscape_version" ;
+ inkscapeVersion = -1;
+ QCString args = "-z --version >"+inkscapeVersionFile+" 2>"+Portable::devNull();
+ Portable::sysTimerStart();
+ if (Portable::system("inkscape",args)!=0)
+ {
+ // looks like the old syntax gave problems, lets try the new syntax
+ args = " --version >"+inkscapeVersionFile+" 2>"+Portable::devNull();
+ if (Portable::system("inkscape",args)!=0)
+ {
+ Portable::sysTimerStop();
+ return -1;
+ }
+ }
+ // read version file and determine major version
+ QFile inkscapeVersionIn(inkscapeVersionFile);
+ if (inkscapeVersionIn.open(IO_ReadOnly))
+ {
+ int maxLineLen=1024;
+ while (!inkscapeVersionIn.atEnd())
+ {
+ QCString buf(maxLineLen);
+ int numBytes = inkscapeVersionIn.readLine(buf.rawData(),maxLineLen);
+ if (numBytes>0)
+ {
+ buf.resize(numBytes+1);
+ int dotPos = buf.find('.');
+ if (buf.startsWith("Inkscape ") && dotPos>0)
+ {
+ // get major version
+ bool ok;
+ int version = buf.mid(9,dotPos-9).toInt(&ok);
+ if (!ok)
+ {
+ Portable::sysTimerStop();
+ return -1;
+ }
+ inkscapeVersion = version;
+ break;
+ }
+ }
+ else
+ {
+ Portable::sysTimerStop();
+ return -1;
+ }
+ }
+ inkscapeVersionIn.close();
+ }
+ else // failed to open version file
+ {
+ Portable::sysTimerStop();
+ return -1;
+ }
+ if (RM_TMP_FILES)
+ {
+ thisDir.remove(inkscapeVersionFile);
+ }
+ Portable::sysTimerStop();
+ }
+ return inkscapeVersion;
+}
diff --git a/src/scanner.l b/src/scanner.l
index 8ceb4ad..e9cad5f 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -2898,7 +2898,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
*yyextra->pCopyRoundString+=yytext;
}
}
-<CopyRound>[^"'()\n]+ {
+<CopyRound>[^"'()\n,]+ {
*yyextra->pCopyRoundString+=yytext;
}
<CopyRound>. {
@@ -2948,7 +2948,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
*yyextra->pCopyRoundGString+=yytext;
}
}
-<GCopyRound>[^"'()\n/]+ {
+<GCopyRound>[^"'()\n\/,]+ {
*yyextra->pCopyRoundGString+=yytext;
}
<GCopyRound>. {
@@ -2998,7 +2998,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
*yyextra->pCopySquareGString+=yytext;
}
}
-<GCopySquare>[^"\[\]\n/]+ {
+<GCopySquare>[^"\[\]\n\/,]+ {
*yyextra->pCopySquareGString+=yytext;
}
<GCopySquare>. {
@@ -3039,7 +3039,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
*yyextra->pCopyCurlyString+=yytext;
}
}
-<CopyCurly>[^"'{}\/\n]+ {
+<CopyCurly>[^"'{}\/\n,]+ {
*yyextra->pCopyCurlyString+=yytext;
}
<CopyCurly>"/" { *yyextra->pCopyCurlyString+=yytext; }