summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/make4ht/make4ht-lib.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-11-01 21:00:21 +0000
committerKarl Berry <karl@freefriends.org>2019-11-01 21:00:21 +0000
commitfdb7d0585af6b9054e895d6f3047766f799b6098 (patch)
tree59e8b2c6971d1fb91d08250283dfa74589869d2d /Master/texmf-dist/scripts/make4ht/make4ht-lib.lua
parent1eea7ddd33803c5945bc4b2b2654c960d42aa0c2 (diff)
make4ht (1nov19)
git-svn-id: svn://tug.org/texlive/trunk@52603 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/make4ht/make4ht-lib.lua')
-rwxr-xr-xMaster/texmf-dist/scripts/make4ht/make4ht-lib.lua29
1 files changed, 15 insertions, 14 deletions
diff --git a/Master/texmf-dist/scripts/make4ht/make4ht-lib.lua b/Master/texmf-dist/scripts/make4ht/make4ht-lib.lua
index 2ada398f869..91418d18b5a 100755
--- a/Master/texmf-dist/scripts/make4ht/make4ht-lib.lua
+++ b/Master/texmf-dist/scripts/make4ht/make4ht-lib.lua
@@ -2,6 +2,7 @@
--kpse.set_program_name("luatex")
-- module(...,package.seeall)
local m = {}
+local log = logging.new "make4ht-lib"
Make = {}
--Make.params = {}
@@ -17,13 +18,13 @@ Make.add = function(self,name,fn,par,rep)
Make[name] = function(self,p,typ)
local params = {}
for k,v in pairs(self.params) do params[k] = v end
- for k,v in pairs(par) do params[k] = v; print("setting param "..k) end
+ for k,v in pairs(par) do params[k] = v; log:info("setting param "..k) end
local typ = typ or "make"
local p = p or {}
local fn = fn
for k,v in pairs(p) do
params[k]=v
- print("Adding: ",k,v)
+ log:info("Adding: ",k,v)
end
-- print( fn % params)
local command = {
@@ -50,14 +51,14 @@ Make.run_command = function(self,filename,s)
local command = s.command
local params = s.params
params["filename"] = filename
- print("parse_lg process file: "..filename)
+ log:info("parse_lg process file: "..filename)
--for k,v in pairs(params) do print(k..": "..v) end
if type(command) == "function" then
return command(filename,params)
elseif type(command) == "string" then
local run = command % params
- print("Execute: " .. run)
- return os.execute(run)
+ log:info("Execute: " .. run)
+ return mkutils.execute(run)
end
return false, "parse_lg: Command is not string or function"
end
@@ -95,8 +96,8 @@ Make.image_convert = function(self, images)
command(p)
elseif type(command) == "string" then
local c = command % p
- print("Make4ht convert: "..c)
- os.execute(c)
+ log:info("Make4ht convert: "..c)
+ mkutils.execute(c)
end
break
end
@@ -125,7 +126,7 @@ Make.file_matches = function(self, files)
msg = msg or "No message given"
table.insert(statuses[file],status)
if status == false then
- print(msg)
+ log:info(msg)
break
end
end
@@ -173,14 +174,14 @@ Make.run = function(self)
self.run_count[v.command] = run_count
local repetition = v.repetition
if repetition and run_count > repetition then
- print ("Make4ht: ".. command .." can be executed only "..repetition .."x")
+ log:warning (command .." can be executed only "..repetition .."x")
else
- print("Make4ht: " .. command)
- local status = os.execute(command)
+ log:info("executing: " .. command)
+ local status = mkutils.execute(command)
table.insert(return_codes,{name=v.name,status=status})
end
else
- print("Unknown command type, must be string or function - " ..v.name..": "..type(v.command))
+ log:warning("Unknown command type, must be string or function - " ..v.name..": "..type(v.command))
end
local correct_exit = params.correct_exit or nil
if correct_exit then
@@ -188,7 +189,7 @@ Make.run = function(self)
local current_status = last_return.status or 0
if current_status ~= correct_exit then
local last_name = last_return.name or "unknown"
- print("Make4ht: Fatal error. Command "..last_name .." returned exit code "..current_status)
+ log:fatal("Fatal error. Command "..last_name .." returned exit code "..current_status)
os.exit(1)
end
end
@@ -208,7 +209,7 @@ Make.run = function(self)
end
self:file_matches(files)
else
- print("No lg file. tex4ht run failed?")
+ log:warning("No lg file. tex4ht run failed?")
end
return return_codes
end