summaryrefslogtreecommitdiff
path: root/support/make4ht/make4ht-htlatex.lua
diff options
context:
space:
mode:
Diffstat (limited to 'support/make4ht/make4ht-htlatex.lua')
-rw-r--r--support/make4ht/make4ht-htlatex.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/support/make4ht/make4ht-htlatex.lua b/support/make4ht/make4ht-htlatex.lua
index 033b25b632..4975e947e6 100644
--- a/support/make4ht/make4ht-htlatex.lua
+++ b/support/make4ht/make4ht-htlatex.lua
@@ -5,7 +5,7 @@ local error_logparser = require("make4ht-errorlogparser")
local Make = Make or {}
-- this function reads the LaTeX log file and tries to detect fatal errors in the compilation
local function testlogfile(par)
- local logfile = par.input .. ".log"
+ local logfile = mkutils.file_in_builddir(par.input .. ".log", par)
local f = io.open(logfile,"r")
if not f then
log:warning("Make4ht: cannot open log file "..logfile)
@@ -29,6 +29,9 @@ local function testlogfile(par)
end
end
end
+ -- info about packages with no corresponding .4ht files
+ local missing_4ht = error_logparser.get_missing_4ht_files(content)
+ for _, filename in ipairs(missing_4ht) do log:info("Unsupported file: " .. filename) end
-- test for fatal errors
if text:match("No pages of output") or text:match("TeX capacity exceeded, sorry") or text:match("That makes 100 errors") or text:match("Emergency stop") then return 1 end
return 0
@@ -40,18 +43,17 @@ Make.testlogfile = testlogfile
--env.Make:add("htlatex", "${htlatex} ${latex_par} '\\\makeatletter\\def\\HCode{\\futurelet\\HCode\\HChar}\\def\\HChar{\\ifx\"\\HCode\\def\\HCode\"##1\"{\\Link##1}\\expandafter\\HCode\\else\\expandafter\\Link\\fi}\\def\\Link#1.a.b.c.{\\g@addto@macro\\@documentclasshook{\\RequirePackage[#1,html]{tex4ht}\\let\\HCode\\documentstyle\\def\\documentstyle{\\let\\documentstyle\\HCode\\expandafter\\def\\csname tex4ht\\endcsname{#1,html}\\def\\HCode####1{\\documentstyle[tex4ht,}\\@ifnextchar[{\\HCode}{\\documentstyle[tex4ht]}}}\\makeatother\\HCode '${config}${tex4ht_sty_par}'.a.b.c.\\input ' ${input}")
-- template for calling LaTeX with tex4ht loaded
-Make.latex_command = "${htlatex} --interaction=${interaction} ${latex_par} '\\makeatletter"..
+Make.latex_command = "${htlatex} --interaction=${interaction} ${build_dir_arg} ${latex_par} '\\makeatletter"..
"\\def\\HCode{\\futurelet\\HCode\\HChar}\\def\\HChar{\\ifx\"\\HCode"..
"\\def\\HCode\"##1\"{\\Link##1}\\expandafter\\HCode\\else"..
-"\\expandafter\\Link\\fi}\\def\\Link#1.a.b.c.{\\AddToHook"..
-"{class/before}{\\RequirePackage[#1,html]{tex4ht}${packages}}"..
+"\\expandafter\\Link\\fi}\\def\\Link#1.a.b.c.{"..
"\\let\\HCode\\documentstyle\\def\\documentstyle{\\let\\documentstyle"..
"\\HCode\\expandafter\\def\\csname tex4ht\\endcsname{#1,html}\\def"..
"\\HCode####1{\\documentstyle[tex4ht,}\\@ifnextchar[{\\HCode}{"..
-"\\documentstyle[tex4ht]}}}\\makeatother\\HCode ${tex4ht_sty_par}.a.b.c."..
+"\\documentstyle[tex4ht]}}\\RequirePackage[#1,html]{tex4ht}${packages}}\\makeatother\\HCode ${tex4ht_sty_par}.a.b.c."..
"\\input \"\\detokenize{${tex_file}}\"'"
-Make.plain_command = '${htlatex} --interaction=${interaction} ${latex_par}' ..
+Make.plain_command = '${htlatex} --interaction=${interaction} ${build_dir_arg} ${latex_par}' ..
"'\\def\\Link#1.a.b.c.{\\expandafter\\def\\csname tex4ht\\endcsname{\\expandafter\\def\\csname tex4ht\\endcsname{#1,html}\\input tex4ht.sty }}" ..
"\\def\\HCode{\\futurelet\\HCode\\HChar}\\def\\HChar{\\ifx\"\\HCode\\def\\HCode\"##1\"{\\Link##1}\\expandafter\\HCode\\else\\expandafter\\Link\\fi}" ..
"\\HCode ${tex4ht_sty_par}.a.b.c.\\input \"\\detokenize{${tex_file}}\"'"
@@ -68,7 +70,11 @@ function m.htlatex(par, latex_command)
devnull = " > nul 2>&1"
end
par.interaction = par.interaction or "batchmode"
- -- remove all terminal output from the batchmode
+ if par.builddir~="" then
+ par.build_dir_arg = "--output-directory=${builddir}" % par
+ else
+ par.build_dir_arg = ""
+ end
if par.interaction == "batchmode" then
command = command .. devnull
end