+def html(db):
+ '''Print work item status as HTML.'''
+
+ print '''<html>
+<head>
+ <title>Work item status</title>
+ <style type="text/css">
+ body { background: #CCCCB0; color: black; }
+ a { text-decoration: none; }
+ table { border-collapse: collapse; border-style: solid none;
+ border-width: 3px; margin-bottom: 3ex; empty-cells: show; }
+ table th { text-align: left; border-style: none none solid none;
+ border-width: 3px; padding-right: 10px; }
+ table td { text-align: left; border-style: none none dotted none;
+ border-width: 1px; padding-right: 10px; }
+
+ a { color: blue; }
+ </style>
+</head>
+
+<body>
+
+<h1>History</h1>
+<p><img src="burndown.png" alt="burndown" /></p>
+
+<h1>Status by blueprint</h1>
+<table>
+ <tr><th>Blueprint</th> <th>todo/postponed/done</th> <th>Completion</th></tr>
+'''
+
+ data = blueprint_status(db)
+
+ completion = []
+ for (bp, (todo, done, postponed)) in data.iteritems():
+ completion.append((bp,
+ int(float(postponed+done)/(todo+done+postponed)*100 + 0.5)))
+
+ completion.sort(key=lambda k: k[1], reverse=True)
+
+ for (bp, percent) in completion:
+ print ' <tr><td><a href="%s/ubuntu/+spec/%s">%s</a></td> <td>%i/%i/%i</td> <td>%i%%</td></tr>' % (
+ blueprints_base_url, bp, bp, data[bp][0], data[bp][2],
+ data[bp][1], percent)
+
+ print '</table>'
+
+ print '</body></html>'
+