diff options
author | Marius <mariausol@gmail.com> | 2011-05-14 17:20:12 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-05-14 17:20:12 +0300 |
commit | bcc46b67b4d49116c17086f6a20f6de1220dc688 (patch) | |
tree | 71cb87c71e683cffd113242383638ba6667ecbec /scripts | |
parent | f498e5373a3cbd7da0c32567b55735ffb8fcb4f3 (diff) | |
download | context-bcc46b67b4d49116c17086f6a20f6de1220dc688.tar.gz |
beta 2011.05.14 16:14
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-epub.lua | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua index e345ff9fd..15282ddab 100644 --- a/scripts/context/lua/mtx-epub.lua +++ b/scripts/context/lua/mtx-epub.lua @@ -19,7 +19,7 @@ mtxrun --script epub --make mydocument local application = logs.application { name = "mtx-epub", - banner = "ConTeXt EPUB Helpers 0.10", + banner = "ConTeXt EPUB Helpers 0.11", helpinfo = helpinfo, } @@ -64,8 +64,15 @@ local package = [[ ]] local mimetypes = { - xhtml = "application/xhtml+xml", - css = "text/css", + xhtml = "application/xhtml+xml", + css = "text/css", + -- default = "text/plain", +} + +local idmakers = { + ncx = function(filename) return "ncx" end, + css = function(filename) return "stylesheet" end, + default = function(filename) return file.nameonly(filename) end, } -- specification = { @@ -112,13 +119,14 @@ function scripts.epub.make() local suffix = file.suffix(filename) local mime = mimetypes[suffix] if mime then + local idmaker = idmakers[suffix] or idmakers.default file.copy(filename,file.join(epubpath,"OPS",filename)) - used[#used+1] = format("<item id='%s' href='%s' media-type='%s'/>",i,filename,mime) + used[#used+1] = format("<item id='%s' href='%s' media-type='%s'/>",idmaker(filename),filename,mime) end end container = format(container,epubroot) - package = format(package,identifier,identifier,concat(used,"\n"),root) + package = format(package,identifier,identifier,concat(used,"\n"),file.removesuffix(root)) io.savedata(file.join(epubpath,"mimetype"),mimetype) io.savedata(file.join(epubpath,"META-INF","container.xml"),container) |