summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtx-epub.lua29
1 files changed, 16 insertions, 13 deletions
diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua
index 7b3ba2ebd..a383cfd90 100644
--- a/scripts/context/lua/mtx-epub.lua
+++ b/scripts/context/lua/mtx-epub.lua
@@ -282,21 +282,24 @@ local function relocateimages(imagedata,oldname,newname,subpath,rename)
report("relocating images")
local n = 0
local done = gsub(data,[[(id=")(.-)(".-background%-image *: *url%()(.-)(%))]], function(s1,id,s2,name,s3)
- local newname = imagedata[id].newname
- if newname then
- if subpath then
- name = joinfile(subpath,basename(newname))
- else
- name = basename(newname)
+ local data = imagedata[id]
+ if data then
+ local newname = data[id].newname
+ if newname then
+ if subpath then
+ name = joinfile(subpath,basename(newname))
+ else
+ name = basename(newname)
+ end
+ -- name = url.addscheme(name)
end
- -- name = url.addscheme(name)
- end
- if newname then
- n = n + 1
- if rename then
- name = joinfile(subpath,addsuffix(id,suffix(name)))
+ if newname then
+ n = n + 1
+ if rename then
+ name = joinfile(subpath,addsuffix(id,suffix(name)))
+ end
+ return s1 .. id .. s2 .. name .. s3
end
- return s1 .. id .. s2 .. name .. s3
end
end)
report("%s images relocated in %a",n,newname)