summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2011-05-14 16:14:00 +0200
committerHans Hagen <pragma@wxs.nl>2011-05-14 16:14:00 +0200
commitc3399ce5c6a0c348a84fe26673f6f132da3477ea (patch)
treebd23fc3a729ea977e0a8aedeb6aea6d7118f0345 /scripts
parent8c9a346751ae80d3ed1e7876c8e10c7f4ebfbb7e (diff)
downloadcontext-c3399ce5c6a0c348a84fe26673f6f132da3477ea.tar.gz
beta 2011.05.14 16:14
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-epub.lua18
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)