Skip to content

Commit

Permalink
Fixed bug relating to unsanitised pattern (michal-h21#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danie-1 committed Jun 16, 2024
1 parent a883721 commit 213e1a1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tex4ebook-exec_epub.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,18 @@ function remove_empty_guide(content)
return content:gsub("<guide>%s*</guide>","")
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


Expand Down

0 comments on commit 213e1a1

Please sign in to comment.