summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/lua/mtx-convert.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-convert.lua')
-rw-r--r--Master/texmf-dist/scripts/context/lua/mtx-convert.lua34
1 files changed, 25 insertions, 9 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-convert.lua b/Master/texmf-dist/scripts/context/lua/mtx-convert.lua
index b4e6e010bf8..b76b3baaf62 100644
--- a/Master/texmf-dist/scripts/context/lua/mtx-convert.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtx-convert.lua
@@ -9,12 +9,26 @@ if not modules then modules = { } end modules ['mtx-convert'] = {
-- todo: eps and svg
local helpinfo = [[
---convertall convert all graphics on path
---inputpath=string original graphics path
---outputpath=string converted graphics path
---watch watch folders
---force force conversion (even if older)
---delay time between sweeps
+<?xml version="1.0"?>
+<application>
+ <metadata>
+ <entry name="name">mtx-convert</entry>
+ <entry name="detail">ConTeXT Graphic Conversion Helpers</entry>
+ <entry name="version">0.10</entry>
+ </metadata>
+ <flags>
+ <category name="basic">
+ <subcategory>
+ <flag name="convertall"><short>convert all graphics on path</short></flag>
+ <flag name="inputpath" value="string"><short>original graphics path</short></flag>
+ <flag name="outputpath" value="string"><short>converted graphics path</short></flag>
+ <flag name="watch"><short>watch folders</short></flag>
+ <flag name="force"><short>force conversion (even if older)</short></flag>
+ <flag name="delay"><short>time between sweeps</short></flag>
+ </subcategory>
+ </category>
+ </flags>
+</application>
]]
local application = logs.application {
@@ -34,7 +48,7 @@ local convert = scripts.convert
convert.converters = convert.converters or { }
local converters = convert.converters
-local gsprogram = (os.type == "windows" and "gswin32c") or "gs"
+local gsprogram = os.type == "windows" and "gswin32c" or "gs"
local gstemplate_eps = "%s -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dEPSCrop -dNOPAUSE -dSAFER -dNOCACHE -dBATCH -dAutoRotatePages=/None -dProcessColorModel=/DeviceCMYK -sOutputFile=%s %s -c quit"
local gstemplate_ps = "%s -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dNOPAUSE -dSAFER -dNOCACHE -dBATCH -dAutoRotatePages=/None -dProcessColorModel=/DeviceCMYK -sOutputFile=%s %s -c quit"
@@ -83,7 +97,7 @@ function converters.convertpath(inputpath,outputpath)
inputpath = inputpath or "."
outputpath = outputpath or "."
for name in lfs.dir(inputpath) do
- local suffix = file.extname(name)
+ local suffix = file.suffix(name)
if find(name,"%.$") then
-- skip . and ..
elseif converters[suffix] then
@@ -102,7 +116,7 @@ function converters.convertpath(inputpath,outputpath)
end
function converters.convertfile(oldname)
- local suffix = file.extname(oldname)
+ local suffix = file.suffix(oldname)
if converters[suffix] then
local newname = file.replacesuffix(oldname,"pdf")
if oldname == newname then
@@ -154,6 +168,8 @@ if environment.arguments.convertall then
convert.convertall()
elseif environment.files[1] then
convert.convertgiven()
+elseif environment.argument("exporthelp") then
+ application.export(environment.argument("exporthelp"),environment.files[1])
else
application.help()
end