From fdb7d0585af6b9054e895d6f3047766f799b6098 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 1 Nov 2019 21:00:21 +0000 Subject: make4ht (1nov19) git-svn-id: svn://tug.org/texlive/trunk@52603 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/make4ht/make4ht-xtpipes.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Master/texmf-dist/scripts/make4ht/make4ht-xtpipes.lua') 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 -- cgit v1.2.3