def setupAndRun(self, patchedDir, prefaceDir, outputDir, buildName): self.patchedDir = patchedDir self.prefaceDir = prefaceDir self.outputDir = outputDir self.booksUsfm = books.loadBooks(patchedDir) self.printer = ReaderPrinter(self.outputDir) bookTex = u'' for bookName in books.silNames: if self.booksUsfm.has_key(bookName): self.translateBook(self.booksUsfm[bookName]) print ' (' + bookName + ')' f = open(self.outputDir + buildName, 'w') f.write(u""" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Open English Bible</title> </head> <style media="all" type="text/css"> span.c-num { color: #AAAAAA; } span.v-num-1 { display : none; } span.v-num { color: #AAAAAA; font-size: small} </style> <body> <h1>Open English Bible</h1> """.encode('utf-8')) f.write('<p><i>Draft built ' + datetime.date.today().strftime("%A, %d %B %Y") + '</i><br />Version ' + buildName + '</p>\n\n<p><p>') f.write(self.printer.rendered.encode('utf-8')) f.write('</body></html>') f.close()
def setupAndRun(self, patchedDir, prefaceDir, outputDir): self.patchedDir = patchedDir self.prefaceDir = prefaceDir self.outputDir = outputDir self.booksUsfm = books.loadBooks(patchedDir) self.printer = ReaderPrinter(self.outputDir) for bookName in books.silNames: if self.booksUsfm.has_key(bookName): tokens = parseUsfm.parseString(self.booksUsfm[bookName]) for t in tokens: t.renderOn(self.printer) self.printer.close() print ' (' + bookName + ')' self.printer.close() index = header + ur""" <h1>Open English Bible</h1> <p>Release of """ + datetime.date.today().strftime("%A %d. %B %Y") + u"""</p> </div> </body> </html> """ f = open(self.outputDir + u'/index.html', 'w') f.write(index.encode('utf-8')) f.close()
def setupAndRun(self, patchedDir, outputDir): self.outputDir = outputDir self.booksUsfm = books.loadBooks(patchedDir) for bookName in books.silNames: if self.booksUsfm.has_key(bookName): print " " + bookName self.translateBook(self.booksUsfm[bookName])
def setupAndRun(self, patchedDir, outputDir): self.outputDir = outputDir self.booksUsfm = books.loadBooks(patchedDir) for bookName in books.silNames: if bookName in self.booksUsfm: print(' ' + bookName) self.translateBook(self.booksUsfm[bookName])
def setupAndRun(self, patchedDir, outputDir): self.outputDir = outputDir self.booksUsfm = books.loadBooks(patchedDir) for bookName in books.silNames: if self.booksUsfm.has_key(bookName): print ' ' + bookName self.translateBook(self.booksUsfm[bookName])
def setupAndRun(self, patchedDir, outputDir): self.patchedDir = patchedDir self.outputDir = outputDir self.booksUsfm = books.loadBooks(patchedDir) self.printer = ReaderPrinter(self.outputDir) tokens = [] print " ** Parsing" for bookName in books.silNames: if self.booksUsfm.has_key(bookName): tokens = tokens + parseUsfm.parseString(self.booksUsfm[bookName]) self.tokenStream = TokenStream(tokens) print " ** Rendering" self.printer.renderStream(self.tokenStream)
def setupAndRun(self, patchedDir, outputDir, buildName): self.patchedDir = patchedDir self.outputDir = outputDir self.booksUsfm = books.loadBooks(patchedDir) self.printer = CSVPrinter(self.outputDir) for bookName in books.silNames: if self.booksUsfm.has_key(bookName): tokens = parseUsfm.parseString(self.booksUsfm[bookName]) for t in tokens: t.renderOn(self.printer) self.printer.close() print ' (' + bookName + ')' self.printer.close() f = open(self.outputDir + buildName, 'w') f.write(self.printer.rendered.encode('utf-8')) f.close()
def setupAndRun(self, patchedDir, outputDir, buildName): self.outputDir = outputDir self.booksUsfm = books.loadBooks(patchedDir) bookText = u""" ================== Open English Bible ================== Version:""" + buildName + """ """ for bookName in books.silNames: if self.booksUsfm.has_key(bookName): bookText = bookText + self.translateBook(self.booksUsfm[bookName]) print ' (' + bookName + ')' self.saveAll(bookText, buildName)
def setupAndRun(self, patchedDir, outputDir, buildName): self.patchedDir = patchedDir self.outputDir = outputDir self.booksUsfm = books.loadBooks(patchedDir) self.printer = LoutPrinter(self.outputDir) for bookName in books.silNames: if self.booksUsfm.has_key(bookName): tokens = parseUsfm.parseString(self.booksUsfm[bookName]) for t in tokens: t.renderOn(self.printer) self.printer.close() print ' (' + bookName + ')' self.printer.close() f = open(self.outputDir + buildName, 'w') f.write(ur"""@Include { oebbook } @Book @Title {} @Author {} @Edition {} @Publisher {} @BeforeTitlePage {} @OnTitlePage {} @AfterTitlePage {} @AtEnd {} @InitialLanguage { English } @PageOrientation { Portrait } @PageHeaders { Titles } @ColumnNumber { 1 } @FirstPageNumber { 1 } @IntroFirstPageNumber { 1 } @OptimizePages { No } @GlossaryText { @Null } @IndexText { @Null } @IndexAText { @Null } @IndexBText { @Null } // """.encode('utf-8')) f.write(self.printer.rendered.encode('utf-8')) f.close()
def loadUSFM(self, usfmDir): self.booksUsfm = books.loadBooks(usfmDir)