summaryrefslogtreecommitdiff
path: root/scripts/context
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-01-13 11:15:05 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-01-13 11:15:05 +0100
commita72850024a910d5f83e76d26137403666b3c7902 (patch)
treeeb67e742a1e699630d0f886d72a437192308743f /scripts/context
parentef78ab8a5c18ea5f94f4e271e8e5f5416708f7a9 (diff)
downloadcontext-a72850024a910d5f83e76d26137403666b3c7902.tar.gz
2015-01-13 11:02:00
Diffstat (limited to 'scripts/context')
-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)