summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/tex4ebook
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-10 22:21:28 +0000
committerKarl Berry <karl@freefriends.org>2019-01-10 22:21:28 +0000
commit0446755d9f93d095627779097695fa3468811b93 (patch)
tree31b8f58994f6d3c32a58fb54e238ee0472646543 /Master/texmf-dist/scripts/tex4ebook
parent8368bb1a1e80c128b441a121a8fda08f0e32d5ae (diff)
tex4ebook (10jan19)
git-svn-id: svn://tug.org/texlive/trunk@49665 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/tex4ebook')
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/exec_epub.lua9
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/exec_mobi.lua13
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/tex4ebook41
3 files changed, 47 insertions, 16 deletions
diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua b/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
index d556c10ef55..8502f280597 100755
--- a/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
+++ b/Master/texmf-dist/scripts/tex4ebook/exec_epub.lua
@@ -13,6 +13,8 @@ local mimetype_name="mimetype"
outputdir=""
outputfile=""
outputfilename=""
+-- the directory where the epub file should be moved to
+destdir=""
basedir = ""
tidy = false
local include_fonts = false
@@ -45,6 +47,10 @@ function prepare(params)
--ebookutils.mkdirectories(ebookutils.prepare_path(outputdir.."/"))
metadir = basedir .."/" .. metadir_name --"metadir-"..randname
makedir(metadir)
+ if params.outdir ~= "" then
+ destdir = params.outdir .. "/"
+ makedir(destdir)
+ end
--local dd = ebookutils.prepare_path(metadir.."/")
--for _,d in pairs(dd) do print("metadir path: "..d) end
-- lfs.mkdir(metadir)
@@ -56,6 +62,7 @@ function prepare(params)
tidy = params.tidy
include_fonts = params.include_fonts
params["t4ht_par"] = params["t4ht_par"] -- + "-d"..string.format(params["t4ht_dir_format"],outputdir)
+ params.tex4ht_sty_par = params.tex4ht_sty_par .. ",uni-html4"
return(params)
end
@@ -311,7 +318,7 @@ function make_opf()
print("Pack metadir " .. os.execute("cd "..basedir.." && "..zip.." -qXr9D " .. outputfile.." "..metadir_name))
print("Pack outputdir " .. os.execute("cd "..basedir.." && "..zip.." -qXr9D " .. outputfile.." "..outputdir_name))
print("Copy generated epub ")
- ebookutils.cp(basedir .."/"..outputfile, outputfile)
+ ebookutils.cp(basedir .."/"..outputfile, destdir .. outputfile)
end
diff --git a/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua b/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua
index be9148b5a10..11871ade769 100755
--- a/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua
+++ b/Master/texmf-dist/scripts/tex4ebook/exec_mobi.lua
@@ -1,5 +1,6 @@
module(...,package.seeall)
local eb = require("exec_epub")
+local ebookutils = require("mkutils")
function prepare(params)
return eb.prepare(params)
@@ -11,7 +12,17 @@ end
function writeContainer()
local ret = eb.writeContainer()
- print("Pack mobi "..os.execute("kindlegen " .. eb.outputfile))
+ -- convert the epub file to mobi
+ local epubpath = eb.basedir .. "/" .. eb.outputfile
+ print("Pack mobi "..os.execute("kindlegen " .. epubpath))
+ -- find the mobi filename
+ local mobifile = epubpath:gsub("epub$", "mobi")
+ local mobidist = eb.destdir .. eb.outputfile:gsub("epub$", "mobi")
+ -- copy the mobi file to the destination directory
+ -- the destination directory will be created by the epub writer, so it is possible to use
+ -- the cp function which doesn't try to create directory
+ ebookutils.cp(mobifile, mobidist)
+
return ret
end
diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook b/Master/texmf-dist/scripts/tex4ebook/tex4ebook
index b6ac969b50c..9e396ffc3f8 100755
--- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook
+++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook
@@ -27,19 +27,31 @@ local include_fonts = false
local arg_message = [[
tex4ebook - ebook generation support for LaTeX
Usage:
-tex4ebook [switches] filename ["tex4ht.sty op." "tex4ht op." "t4ht op" "latex op"]
--c,--config (default xhtml) Custom config file
--e,--build-file (default nil) If build file is different than `filename`.mk4
--f,--format (default epub) Output format. Supported values: epub, epub3, mobi
--h,--help Display help message
--l,--lua Runs htlualatex instead of htlatex
--m,--mode (default default) Switch which can be used in the makefile
--r,--resolution (default 167)
--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
+tex4ebook [switches] filename ["tex4ht.sty op."] ["tex4ht op."] ["t4ht op"] ["latex op"]
+ -c,--config (default xhtml) Custom config file
+ -d,--output-dir (default nil) Output directory
+ -e,--build-file (default nil) If build file is different than `filename`.mk4
+ -f,--format (default epub) Output format. Supported values: epub, epub3, mobi
+ -h,--help Display help message
+ -l,--lua Use lualatex for document compilation
+ -m,--mode (default default) Switch which can be used in the makefile
+ -r,--resolution (default 167)
+ -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
+
+Positional optional argumens:
+ ["tex4ht.sty op."] Additional parameters for tex4ht.sty
+ ["tex4ht op."] Options for tex4ht command
+ ["t4ht op"] Options for t4ht command
+ ["latex op"] Additional options for LaTeX
+
+Documentation: https://tug.org/applications/tex4ht/mn.html
+Issue tracker for tex4ht bugs: https://puszcza.gnu.org.ua/bugs/?group=tex4ht
+Issue tracker for tex4ebook bugs: https://github.com/michal-h21/tex4ebook/issues
]]
-- This option is no longer available, all files must be unicode
@@ -54,7 +66,7 @@ else
end
if args.version then
- print "tex4ebook v0.2a"
+ print "tex4ebook v0.2b"
return
end
@@ -111,6 +123,7 @@ end--]]
--print ("nazdar ${world}" % {world="svete"})
--print(args.config)
+
local input = ebookutils.remove_extension(input_file)
local config=ebookutils.remove_extension(args.config)
-- local tex4ht_sty_par = config ..tex4ht_sty_par..","+args.format