summaryrefslogtreecommitdiff
path: root/support/tex4ebook/tex4ebook-exec_azw3.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-08 03:02:12 +0000
committerNorbert Preining <norbert@preining.info>2020-09-08 03:02:12 +0000
commitbc2d0660f4f460b55009ab4e525f2a0e4cde6187 (patch)
treed35815089faf23c45f4f21690e42cfcc7c65a5fd /support/tex4ebook/tex4ebook-exec_azw3.lua
parent57edbaffbe7daad894e3036a4123acd03e0fdb9b (diff)
CTAN sync 202009080302
Diffstat (limited to 'support/tex4ebook/tex4ebook-exec_azw3.lua')
-rw-r--r--support/tex4ebook/tex4ebook-exec_azw3.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/support/tex4ebook/tex4ebook-exec_azw3.lua b/support/tex4ebook/tex4ebook-exec_azw3.lua
new file mode 100644
index 0000000000..33e8a1182c
--- /dev/null
+++ b/support/tex4ebook/tex4ebook-exec_azw3.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$", "azw3")
+ 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