diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-09-06 14:15:04 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2014-09-06 14:15:04 +0200 |
commit | e09fab77f609ec2b8083836551b2c225a351eae9 (patch) | |
tree | 5619b4ace62be05078e8ffbc6a445dd4d4b94c78 /scripts | |
parent | 564b126de3c406f7dc430de4fc2863b0309442b0 (diff) | |
download | context-e09fab77f609ec2b8083836551b2c225a351eae9.tar.gz |
2014-09-06 13:41:00
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-epub.lua | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua index 5c6f2cf10..e9a4140a2 100644 --- a/scripts/context/lua/mtx-epub.lua +++ b/scripts/context/lua/mtx-epub.lua @@ -341,9 +341,10 @@ function scripts.epub.make() local function copyone(filename,alternative) if registerone(filename) then - local target = file.join(epubpath,"OEBPS",filename) - file.copy(alternative or filename,target) - application.report("copying %s to %s",alternative or filename,target) + local target = file.join(epubpath,"OEBPS",file.basename(filename)) + local source = alternative or filename + file.copy(source,target) + application.report("copying %s to %s",source,target) end end @@ -360,16 +361,22 @@ function scripts.epub.make() for i=1,#files do local filename = files[i] if type(filename) == "string" then -if file.suffix(filename) == "xhtml" then - local alternative = file.replacesuffix(filename,"html") - if lfs.isfile(alternative) then - copyone(filename,alternative) - else - copyone(filename) - end -else - copyone(filename) -end + local suffix = file.suffix(filename) + if suffix == "xhtml" then + local alternative = file.replacesuffix(filename,"html") + if lfs.isfile(alternative) then + copyone(filename,alternative) + else + copyone(filename) + end + elseif suffix == "css" then + if not lfs.isfile(filename) then + filename = resolvers.findfile(filename) + end + copyone(filename) + else + copyone(filename) + end end end end |