diff options
author | Karl Berry <karl@freefriends.org> | 2018-04-09 21:19:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-04-09 21:19:50 +0000 |
commit | 9b15e307f4036a19f6e40fc2672ddc90ed1d5812 (patch) | |
tree | 432ba6ea3a93304f45a2752e873fd593cbe6b324 /Build | |
parent | 2ab2eba6c86168c5190e2aae2e521821ea624728 (diff) |
tex4ebook (9apr18)
git-svn-id: svn://tug.org/texlive/trunk@47414 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook b/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook index 5c9f65573f7..02906427453 100755 --- a/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook +++ b/Build/source/texk/texlive/linked_scripts/tex4ebook/tex4ebook @@ -7,6 +7,7 @@ require("lapp-mk4") -- require("ebookutils") local ebookutils = require "mkutils" local mkparams = require "mkparams" +local mk_config = require "make4ht-config" -- Setting local latex_cmd="latex" @@ -37,6 +38,7 @@ tex4ebook [switches] filename ["tex4ht.sty op." "tex4ht op." "t4ht op" "latex op -s,--shell-escape Enable shell escape in htlatex run -t,--tidy Run html tidy on html output. May result in wrong spacing! -v,--version Display version number +-x,--xetex Use xelatex for document compilation <filename> (string) Input file name ]] @@ -52,12 +54,14 @@ else end if args.version then - print "tex4ebook v0.1e" + print "tex4ebook v0.2" return end if args.lua then latex_cmd="dvilualatex" +elseif args.xetex then + latex_cmd="xelatex --no-pdf" end @@ -125,12 +129,17 @@ local latex_par = latex_par + args[5] args.filename=input_file local params = mkparams.process_args(args) + +local output_format = params.output_format --args.format +-- use epub as default output_format +output_format = output_format or "epub" +local extensions = ebookutils.load_extensions(params.extensions, output_format) -- but also support tex4ebook!s own parameters local oldparams = { -- htlatex=latex_cmd -- ,input=input -- ,tex_file = tex_file - format=args.format + format= output_format -- ,latex_par=latex_par -- ,tex4ht_sty_par=tex4ht_sty_par -- ,tex4ht_par=tex4ht_par @@ -152,14 +161,28 @@ end params.tex4ht_sty_par=params.tex4ht_sty_par .. ",charset=utf-8,"..args.format params.tex4ht_par= " -cmozhtf -utf8" .. params.tex4ht_par -if output_formats[args.format] then - executor=require("exec_"..args.format) + +if output_formats[output_format] then + executor=require("exec_"..output_format) params=executor.prepare(params) + if #extensions > 0 then + params = ebookutils.extensions_prepare_parameters(extensions,params) + end else - print("Unknown output format: "..args.format) + print("Unknown output format: "..output_format) return end +-- find tex4ebook configuration file +local configname = "tex4ebook" +local conffile = mk_config.find_config(configname) or mk_config.find_xdg_config(configname) +if conffile then + print("Using configuration file: " .. conffile) + ebookutils.load_config(params, conffile) +else + print "No conffile" +end + local build_file = input.. ".mk4" if args["build-file"] and args["build-file"] ~= "nil" then @@ -171,6 +194,10 @@ local config_file = ebookutils.load_config(params, build_file) params["config_file"] = config_file --config_file.Make:run() print("${htlatex} ${input} \"${tex4ht_sty_par}\" \"${tex4ht_par}\" \"${t4ht_par}\" \"${latex_par}\"" % params) +if #extensions > 0 then + config_file.Make = ebookutils.extensions_modify_build(extensions, config_file.Make) +end + executor.run(input,params) executor.writeContainer() executor.clean() |