def generatehtml(self): global OUTPUTDIR global counter self.html12 = str(counter) + ".html" counter = counter + 1 self.htmldiff = str(counter) + ".html" counter = counter + 1 fi = open(OUTPUTDIR + self.html12, "wb") fi.write( getTALstr( """ <html><head></head> <body> <tal:block tal:replace="python:'File: '+self.filename"/><br> <tal:block tal:replace="python:'Page: '+str(self.page)"/><br> <tal:block tal:replace="python:'Rating: '+str(self.rating)"/><br> <pre tal:condition="python:self.message" tal:replace="python:'Message: '+str(self.message)"/><br> <hr> <table cellspacing="0" cellpadding="0"> <tr><td><img tal:attributes="src python:self.file1"/></td><td><img tal:attributes="src python:self.file2"/></td></tr> <tr><td>pdf2swf Version</td><td>pdftoppm Version</td></tr> </table> <hr> </body> </html>""", {"self": self})) fi.close() fi = open(OUTPUTDIR + self.htmldiff, "wb") fi.write( getTALstr( """ <html><head></head> <body> <tal:block tal:replace="python:'File: '+self.filename"/><br> <tal:block tal:replace="python:'Page: '+str(self.page)"/><br> <tal:block tal:replace="python:'Rating: '+str(self.rating)"/><br> <pre tal:condition="python:self.message" tal:replace="python:'Message: '+str(self.message)"/><br> <hr> <img tal:attributes="src python:self.file12"/> <hr> </body> </html>""", {"self": self})) fi.close() if self.message: self.htmlmessage = str(counter) + ".html" counter = counter + 1 fi = open(OUTPUTDIR + self.htmlmessage, "wb") fi.write( getTALstr( """ <html><head></head> <body> <pre tal:content="raw python:self.message"> </pre> </body> </html>""", {"self": self})) fi.close()
def generatehtml(self): global OUTPUTDIR global counter self.html12 = str(counter) + ".html" counter = counter + 1 self.htmldiff = str(counter) + ".html" counter = counter + 1 fi = open(OUTPUTDIR + self.html12, "wb") fi.write(getTALstr(""" <html><head></head> <body> <tal:block tal:replace="python:'File: '+self.filename"/><br> <tal:block tal:replace="python:'Page: '+str(self.page)"/><br> <tal:block tal:replace="python:'Rating: '+str(self.rating)"/><br> <pre tal:condition="python:self.message" tal:replace="python:'Message: '+str(self.message)"/><br> <hr> <table cellspacing="0" cellpadding="0"> <tr><td><img tal:attributes="src python:self.file1"/></td><td><img tal:attributes="src python:self.file2"/></td></tr> <tr><td>pdf2swf Version</td><td>pdftoppm Version</td></tr> </table> <hr> </body> </html>""", {"self": self})) fi.close() fi = open(OUTPUTDIR + self.htmldiff, "wb") fi.write(getTALstr(""" <html><head></head> <body> <tal:block tal:replace="python:'File: '+self.filename"/><br> <tal:block tal:replace="python:'Page: '+str(self.page)"/><br> <tal:block tal:replace="python:'Rating: '+str(self.rating)"/><br> <pre tal:condition="python:self.message" tal:replace="python:'Message: '+str(self.message)"/><br> <hr> <img tal:attributes="src python:self.file12"/> <hr> </body> </html>""", {"self": self})) fi.close() if self.message: self.htmlmessage = str(counter) + ".html" counter = counter + 1 fi = open(OUTPUTDIR + self.htmlmessage, "wb") fi.write(getTALstr(""" <html><head></head> <body> <pre tal:content="raw python:self.message"> </pre> </body> </html>""", {"self": self})) fi.close()
pages.sort(compare_pages) position = 1 for page in pages: page.generatehtml() page.position = position position = position + 1 fi = open(OUTPUTDIR + "index.html", "wb") fi.write(getTALstr("""<html> <head></head> <body> <table border="1"><tr><th>Position</th><th>Rating</th><th>File</th><th>Size</th><th>Page</th><th>Images</th><th>Diff</th><th>Further Info</th></tr> <tal:block tal:repeat="page pages"> <tr> <td tal:content="python:page.position"/> <td tal:content="python:page.rating"/> <td tal:content="python:page.filename"/> <td tal:content="raw python:page.getsizes()"/> <td tal:content="python:page.page"/> <td><a tal:attributes="href python:page.html12">Side by Side</a></td> <td><a tal:attributes="href python:page.htmldiff">Difference</a></td> <td><a tal:condition="python:page.message" tal:attributes="href python:page.htmlmessage">Error message</a></td> </tr> </tal:block> </table> </body> </html>""", {"pages": pages})) fi.close()
position = 1 for page in pages: page.generatehtml() page.position = position position = position + 1 fi = open(OUTPUTDIR + "index.html", "wb") fi.write( getTALstr( """<html> <head></head> <body> <table border="1"><tr><th>Position</th><th>Rating</th><th>File</th><th>Size</th><th>Page</th><th>Images</th><th>Diff</th><th>Further Info</th></tr> <tal:block tal:repeat="page pages"> <tr> <td tal:content="python:page.position"/> <td tal:content="python:page.rating"/> <td tal:content="python:page.filename"/> <td tal:content="raw python:page.getsizes()"/> <td tal:content="python:page.page"/> <td><a tal:attributes="href python:page.html12">Side by Side</a></td> <td><a tal:attributes="href python:page.htmldiff">Difference</a></td> <td><a tal:condition="python:page.message" tal:attributes="href python:page.htmlmessage">Error message</a></td> </tr> </tal:block> </table> </body> </html>""", {"pages": pages})) fi.close()