diff --git a/tex4ebook-exec_epub.lua b/tex4ebook-exec_epub.lua index de07c19..a2faf6b 100644 --- a/tex4ebook-exec_epub.lua +++ b/tex4ebook-exec_epub.lua @@ -150,11 +150,18 @@ function remove_empty_guide(content) return content:gsub("%s*","") end +local function startswith(str, prefix) + return str:sub(1, prefix:len()) == prefix +end + local function remove_builddir(filename) -- make4ht adds the build dir to all output files, -- but we don't want them there, because it is appended to the outdir local builddir = Make.params.builddir - return filename:gsub("^" .. builddir .. "/", "") + if startswith(filename, builddir .. "/") then + return filename:sub((builddir .. "/"):len() + 1) + end + return filename end