diff options
author | Hans Hagen <pragma@wxs.nl> | 2020-05-07 11:47:12 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2020-05-07 11:47:12 +0200 |
commit | 352a2686282e95b2869728f8f321688f7e216d80 (patch) | |
tree | a0cd6d8cd35aaf6c51632307786e4083e25c0df8 /tex/context/base/mkiv/grph-con.lua | |
parent | 3d0fae7aaf79674a41d2bdaf5b3c2a3a4d8113db (diff) | |
download | context-352a2686282e95b2869728f8f321688f7e216d80.tar.gz |
2020-05-07 11:00:00
Diffstat (limited to 'tex/context/base/mkiv/grph-con.lua')
-rw-r--r-- | tex/context/base/mkiv/grph-con.lua | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/tex/context/base/mkiv/grph-con.lua b/tex/context/base/mkiv/grph-con.lua index c3c711b0c..b3d39f0bd 100644 --- a/tex/context/base/mkiv/grph-con.lua +++ b/tex/context/base/mkiv/grph-con.lua @@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['grph-con'] = { local P, R, S, Cc, C, Cs, Ct, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.Cc, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.match local tonumber = tonumber +local find = string.find local longtostring = string.longtostring local formatters = string.formatters local expandfilename = dir.expandname @@ -194,6 +195,22 @@ do -- svg -- arguments change again? Ok, it's weirder, with -A then it's a name only when -- not . (current) + -- Beware: the order of printed output lines is a bit random depending on the + -- method of calling (bin or pipe) because part of the message prints to stdout + -- and part to stderr. Also, on Windows, a second call to the old binaries + -- doesn't return anything at all, so that is also a signal of it being old. + -- This test will be dropped in 2021 anyway. + + local new = nil + + local function inkscapeformat(suffix) + if new == nil then + new = os.resultof("inkscape --version") or "" + new = new == "" or not find(new,"Inkscape%s*0") + end + return new and "filename" or suffix + end + local runner = sandbox.registerrunner { name = "svg to something", program = "inkscape", @@ -209,7 +226,7 @@ do -- svg resolution = "string", }, defaults = { - format = "pdf", + format = format, resolution = "600", } } @@ -220,7 +237,7 @@ do -- svg function svgconverter.pdf(oldname,newname) runner { - format = "pdf", + format = inkscapeformat("pdf"), resolution = "600", newname = expandfilename(newname), oldname = expandfilename(oldname), @@ -229,7 +246,7 @@ do -- svg function svgconverter.png(oldname,newname) runner { - format = "png", + format = inkscapeformat("png"), resolution = "600", newname = expandfilename(newname), oldname = expandfilename(oldname), |