diff options
author | Norbert Preining <norbert@preining.info> | 2019-11-02 03:01:48 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-11-02 03:01:48 +0000 |
commit | 3479a92321ed7fe7e2133d3daec2d4f5fd53fbc6 (patch) | |
tree | f81c77e1742124279f68e41484d9e53ad40248ff /support/make4ht/make4ht-xtpipes.lua | |
parent | 61b8d58232b999b6cc966aee9152fb86bbb759cd (diff) |
CTAN sync 201911020301
Diffstat (limited to 'support/make4ht/make4ht-xtpipes.lua')
-rw-r--r-- | support/make4ht/make4ht-xtpipes.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/support/make4ht/make4ht-xtpipes.lua b/support/make4ht/make4ht-xtpipes.lua index 78014baff1..3f5b51e07b 100644 --- a/support/make4ht/make4ht-xtpipes.lua +++ b/support/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 |