summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/make4ht/make4ht-xtpipes.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/make4ht/make4ht-xtpipes.lua')
-rwxr-xr-xMaster/texmf-dist/scripts/make4ht/make4ht-xtpipes.lua15
1 files changed, 8 insertions, 7 deletions
diff --git a/Master/texmf-dist/scripts/make4ht/make4ht-xtpipes.lua b/Master/texmf-dist/scripts/make4ht/make4ht-xtpipes.lua
index 78014baff1c..3f5b51e07b8 100755
--- a/Master/texmf-dist/scripts/make4ht/make4ht-xtpipes.lua
+++ b/Master/texmf-dist/scripts/make4ht/make4ht-xtpipes.lua
@@ -1,5 +1,6 @@
local M = {}
+local log = logging.new "xtpipes"
-- find if tex4ht.jar exists in a path
local function find_tex4ht_jar(path)
local jar_file = path .. "/tex4ht/bin/tex4ht.jar"
@@ -38,7 +39,7 @@ end
function M.get_xtpipes(selfautoparent)
-- make pattern using TeX distro path
- local pattern = string.format("java -classpath %s/tex4ht/bin/tex4ht.jar xtpipes -i %s/tex4ht/xtpipes/ -o ${outputfile} ${filename}", selfautoparent, selfautoparent)
+ local pattern = string.format('java -classpath "%s/tex4ht/bin/tex4ht.jar" xtpipes -i "%s/tex4ht/xtpipes/" -o "${outputfile}" "${filename}"', selfautoparent, selfautoparent)
-- call xtpipes on a temporary file
local matchfunction = function(filename)
-- move the matched file to a temporary file, xtpipes will write it back to the original file
@@ -46,19 +47,19 @@ function M.get_xtpipes(selfautoparent)
local tmpfile = basename ..".tmp"
mkutils.mv(filename, tmpfile)
local command = pattern % {filename = tmpfile, outputfile = filename}
- print(command)
- local status = os.execute(command)
+ log:info("execute: " ..command)
+ local status = mkutils.execute(command)
if status > 0 then
-- if xtpipes failed to process the file, it may mean that it was bad-formed xml
-- we can try to make it well-formed using Tidy
- local tidy_command = "tidy -utf8 -xml -asxml -q -o ${filename} ${tmpfile}" % {tmpfile = tmpfile, filename = filename}
- print("xtpipes failed trying tidy")
- print(tidy_command)
+ local tidy_command = 'tidy -utf8 -xml -asxml -q -o "${filename}" "${tmpfile}"' % {tmpfile = tmpfile, filename = filename}
+ log:warning("xtpipes failed trying tidy")
+ log:debug(tidy_command)
local status = os.execute(tidy_command)
if status > 0 then
-- if tidy failed as well, just use the original file
-- it will probably produce corrupted ODT file though
- print("Tidy failed as well")
+ log:warning("Tidy failed as well")
mkutils.mv(tmpfile, filename)
end
end