summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_azw.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-09-07 21:24:02 +0000
committerKarl Berry <karl@freefriends.org>2020-09-07 21:24:02 +0000
commitc332fb0ced3affd7fa1d93fed75108915db3cb7f (patch)
treea4fd48e0fb1c720f7e57f6c344a0ee65386036b6 /Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_azw.lua
parenta4f2e39309134e43404848efae785e7b37319393 (diff)
tex4ebook (7sep20)
git-svn-id: svn://tug.org/texlive/trunk@56290 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_azw.lua')
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/tex4ebook-exec_azw.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_azw.lua b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_azw.lua
new file mode 100755
index 00000000000..397292b648b
--- /dev/null
+++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_azw.lua
@@ -0,0 +1,35 @@
+module(...,package.seeall)
+local eb = require("tex4ebook-exec_epub")
+local ebookutils = require("mkutils")
+local log = logging.new "exec_azw"
+
+function prepare(params)
+ return eb.prepare(params)
+end
+
+function run(out,params)
+ return eb.run(out, params)
+end
+
+function writeContainer()
+ local ret = eb.writeContainer()
+ -- convert the epub file to azw
+ local epubpath = eb.basedir .. "/" .. eb.outputfile
+
+ -- find the azw filename
+ local azwfile = eb.outputfile:gsub("epub$", "azw")
+ local azwdist = eb.destdir .. azwfile
+ local command = "kindlegen " .. epubpath .. " -o " .. azwfile
+ log:info("Pack azw ".. command)
+ local status, output = ebookutils.execute(command)
+ -- copy the azw 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(eb.basedir .. "/" .. azwfile, azwdist)
+
+ return ret
+end
+
+function clean()
+ return eb.clean()
+end