return d
def html_report(self):
- return WEBCHART_CLASS(self.label, iter(self._descendants().values())).html()
+ txt = self.text_report()
+ fmt = """
+ <table>
+ <tbody>
+ {}
+ </tbody>
+ </table>
+ <p>{}</p>
+ """.format("\n".join("<tr><td>{}</td></tr>".format(x.replace("\t", "</td><td>")) for x in txt.split("\n") if not x.startswith("#")),
+ "\n".join("{}<br>".format(x) for x in txt.split("\n") if x.startswith("#")))
+ return WEBCHART_CLASS(self.label, iter(self._descendants().values())).html(fmt)
class JobTreeSummarizer(MultiSummarizer):
self.label = label
self.summarizers = summarizers
- def html(self):
+ def html(self, bodytext=''):
return '''<!doctype html><html><head>
<title>{} stats</title>
<script type="text/javascript" src="{}"></script>
<script type="text/javascript">{}</script>
+ <style>
+ table {{
+ width: 80%
+ }}
+ td {{
+ width: 20%;
+ }}
+ </style>
{}
- </head><body></body></html>
+ </head><body>{}</body></html>
'''.format(escape(self.label),
- self.JSLIB, self.js(), self.headHTML())
+ self.JSLIB, self.js(), self.headHTML(),
+ bodytext)
def js(self):
return 'var chartdata = {};\n{}'.format(