]> OCCT Git - occt.git/commitdiff
0031795: Documentation - OCCDoc_ProcessSvg uses syntax incompatible with Inkscape 1.0
authorkgv <kgv@opencascade.com>
Fri, 25 Sep 2020 12:23:46 +0000 (15:23 +0300)
committerbugmaster <bugmaster@opencascade.com>
Tue, 29 Sep 2020 15:09:40 +0000 (18:09 +0300)
Detect old/new Inkscape version and pass arguments correspondingly.

adm/occaux.tcl

index ba0cc858067bac0cee0ff4aeeb5509f403c3f4a9..d41af9aa667933d9ff5009c646ae630400db133b 100644 (file)
@@ -179,8 +179,10 @@ proc OCCDoc_DetectNecessarySoftware { DOXYGEN_PATH GRAPHVIZ_PATH INKSCAPE_PATH H
   }
   if {"$is_win" == "yes"} {
     set exe ".exe"
+    set com ".com"
   } else {
     set exe ""
+    set com ""
   }
 
   set g_flag "no"
@@ -224,11 +226,11 @@ proc OCCDoc_DetectNecessarySoftware { DOXYGEN_PATH GRAPHVIZ_PATH INKSCAPE_PATH H
       }
     }
     if {$i_flag == "no"} {
-      if { [file exists $path/inkscape$exe] } {
+      if { [file exists $path/inkscape$com] } {
         catch { exec $path/inkscape -V } version
         puts "Info: $version " 
         puts "      found in $path."
-        set inkscape_path "$path/inkscape$exe"
+        set inkscape_path "$path/inkscape$com"
         set i_flag "yes"
       }
     }
@@ -356,15 +358,29 @@ proc OCCDoc_DetectNecessarySoftware { DOXYGEN_PATH GRAPHVIZ_PATH INKSCAPE_PATH H
 # Convert SVG files to PDF format to allow including them to PDF
 # (requires InkScape to be in PATH)
 proc OCCDoc_ProcessSvg {latexDir verboseMode} {
+  set anSvgList [glob -nocomplain $latexDir/*.svg]
+  if { $anSvgList == {} } {
+    return
+  }
 
-  foreach file [glob -nocomplain $latexDir/*.svg] {
+  catch { exec inkscape -V } anInkVer
+  set isOldSyntax 0
+  if {[string match "Inkscape 0.*" $anInkVer]} { set isOldSyntax 1 }
+  foreach file $anSvgList {
     if {$verboseMode == "YES"} {
       puts "Info: Converting file $file..."
     }
     set pdffile "[file rootname $file].pdf"
-    if { [catch {exec inkscape -z -D --file=$file --export-pdf=$pdffile} res] } {
-      #puts "Error: $res."
-      return
+    if { $isOldSyntax == 1 } {
+      if { [catch {exec inkscape -z -D --file=$file --export-pdf=$pdffile} res] } {
+        #puts "Error: $res."
+        return
+      }
+    } else {
+      if { [catch {exec inkscape $file --export-area-drawing --export-type=pdf --export-filename=$pdffile} res] } {
+        #puts "Error: $res."
+        return
+      }
     }
   }
 }
@@ -899,4 +915,4 @@ proc OCCDoc_ProcessTex {{texFiles {}} {latexDir} verboseMode} {
     file delete -force $TEX
     file rename $TMPFILENAME $TEX
   }
-}
\ No newline at end of file
+}