def make_ncx(self): context = simpleTALES.Context(allowPythonPath=1) context.addGlobal('data', self.data) compiled = simpleTAL.compileXMLTemplate(templates.ncx) fd = open(os.path.join(self.root_dir, 'toc.ncx'), 'wb') compiled.expand(context, fd, outputEncoding=self.encoding, docType=NCX_DOCTYPE) fd.close()
def make_titlepage(self): context = simpleTALES.Context() context.addGlobal('data', self.data) compiled = simpleTAL.compileXMLTemplate(templates.titlepage) fd0 = open(os.path.join(self.root_dir, 'titlepage.html'), 'wb') compiled.expand(context, fd0, outputEncoding=self.encoding,suppressXMLDeclaration=True) fd0.close()
def make_opf(self): context = simpleTALES.Context() context.addGlobal('data', self.data) context.addGlobal('date', datetime.date.isoformat(datetime.date.today())) compiled = simpleTAL.compileXMLTemplate(templates.opf) fd = open(os.path.join(self.root_dir, 'content.opf'), 'wb') compiled.expand(context, fd, outputEncoding=self.encoding) fd.close()