summaryrefslogtreecommitdiff
path: root/support/make4ht/make4ht-htlatex.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-01-24 03:00:54 +0000
committerNorbert Preining <norbert@preining.info>2020-01-24 03:00:54 +0000
commite1192611f0655a1ccaff0dff2f53c7c65fa5db07 (patch)
tree232f5be17a2221a57cc6515bfe8692772b3a3e89 /support/make4ht/make4ht-htlatex.lua
parentf7e5d81fe9880913485f7f8c541eeca7adf4c195 (diff)
CTAN sync 202001240300
Diffstat (limited to 'support/make4ht/make4ht-htlatex.lua')
-rw-r--r--support/make4ht/make4ht-htlatex.lua21
1 files changed, 19 insertions, 2 deletions
diff --git a/support/make4ht/make4ht-htlatex.lua b/support/make4ht/make4ht-htlatex.lua
index 214972e8bb..f141070406 100644
--- a/support/make4ht/make4ht-htlatex.lua
+++ b/support/make4ht/make4ht-htlatex.lua
@@ -51,11 +51,17 @@ Make.latex_command = "${htlatex} --interaction=${interaction} ${latex_par} '\\ma
"\\documentstyle[tex4ht]}}}\\makeatother\\HCode ${tex4ht_sty_par}.a.b.c."..
"\\input \"\\detokenize{${tex_file}}\"'"
+Make.plain_command = '${htlatex} --interaction=${interaction} ${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}}\"'"
+
local m = {}
-function m.htlatex(par)
- local command = Make.latex_command
+function m.htlatex(par, latex_command)
+ -- latex_command can be also plain_command for Plain TeX
+ local command = latex_command or Make.latex_command
local devnull = " > /dev/null 2>&1"
if os.type == "windows" then
command = command:gsub("'",'')
@@ -72,4 +78,15 @@ function m.htlatex(par)
return Make.testlogfile(par)
end
+function m.httex(par)
+ local newpar = {}
+ for k,v in pairs(par) do newpar[k] = v end
+ -- change executable name from *latex to *tex
+ newpar.htlatex = newpar.htlatex:gsub("latex", "tex")
+ -- plain tex command doesn't support etex extensions
+ -- which are necessary for TeX4ht. just quick hack to fix this
+ if newpar.htlatex == "tex" then newpar.htlatex = "etex" end
+ return m.htlatex(newpar, Make.plain_command)
+end
+
return m