+
+ for ilustr in document.edoc.findall("//ilustr"):
+ shutil.copy(os.path.join(ilustr_path, ilustr.get("src")), temp)
+
+ for sponsor in book_info.sponsors:
+ ins = etree.Element("data-sponsor", name=sponsor)
+ logo = sponsor_logo(sponsor)
+ if logo:
+ fname = 'sponsor-%s' % os.path.basename(logo)
+ shutil.copy(logo, os.path.join(temp, fname))
+ ins.set('src', fname)
+ root.insert(0, ins)
+
+ if book_info.sponsor_note:
+ root.set("sponsor-note", book_info.sponsor_note)
+
+ texml = document.transform(style)
+
+ if cover:
+ with open(os.path.join(temp, 'cover.png'), 'w') as f:
+ bound_cover.save(f, quality=80)
+
+ del document # no longer needed large object :)
+