def transform(wldoc, verbose=False,
style=None, html_toc=False,
- sample=None, cover=None, flags=None):
+ sample=None, cover=None, flags=None, resources=None):
""" produces a EPUB file
sample=n: generate sample e-book (with at least n paragraphs)
if not style:
style = get_resource('epub/style.css')
zip.write(style, os.path.join('OPS', 'style.css'))
+ if resources:
+ if os.path.isdir(resources):
+ for dp, dirs, files in os.walk(resources):
+ for fname in files:
+ fpath = os.path.join(dp, fname)
+ if os.path.isfile(fpath):
+ zip.write(fpath, os.path.join('OPS', fname))
+ else:
+ print "resources path %s is not directory" % resources
+
if cover:
if cover is True:
transform_flags = [
Option('-w', '--working-copy', dest='working-copy',
action='store_true', default=False,
- help='mark the output as a working copy')
+ help='mark the output as a working copy'),
+ Option('-R', '--resources', dest='resources', metavar='DIR',
+ help='a directory with additional resources'),
]