summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua')
-rwxr-xr-xMaster/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua
index 75304e24942..539cf930ab6 100755
--- a/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua
+++ b/Master/texmf-dist/scripts/tex4ebook/tex4ebook-exec_epub.lua
@@ -157,6 +157,10 @@ function make_opf()
local id=table.concat(dir_part,"-")..fname.."_"..ext
-- remove invalid characters from id start
id = id:gsub("^[%.%-]*","")
+ -- remove colons
+ id = id:gsub(":", "_")
+ -- id cannot start by number, add trailing "x" character
+ id = id:gsub("^([%d])", "x%1")
return "<item id='"..id .. "' href='"..item.."' media-type='"..mimetype.."' />",id
end
local find_all_files= function(s,r)
@@ -277,9 +281,9 @@ function make_opf()
end
end
local function find_zip()
- if io.popen("zip -v","r"):close() then
+ if assert(io.popen("zip -v","r"):close()) then
return "zip"
- elseif io.popen("miktex-zip -v","r"):close() then
+ elseif assert(io.popen("miktex-zip -v","r"):close()) then
return "miktex-zip"
end
log:warning "It appears you don't have zip command installed. I can't pack the ebook"