diff options
Diffstat (limited to 'coverage/html.py')
-rw-r--r-- | coverage/html.py | 81 |
1 files changed, 69 insertions, 12 deletions
diff --git a/coverage/html.py b/coverage/html.py index f7e8604..b2329b5 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -1,6 +1,7 @@ """HTML reporting for coverage.py""" import os +from coverage import __version__ from coverage.report import Reporter from coverage.templite import Templite @@ -53,8 +54,8 @@ class HtmlReporter(Reporter): def escape(t): """HTML-escape the text in t.""" - return ( - t.replace("&", "&").replace("<", "<").replace(">", ">") + return (t + .replace("&", "&").replace("<", "<").replace(">", ">") .replace("'", "'").replace('"', """) .replace(" ", " ") ) @@ -70,22 +71,61 @@ SOURCE = """\ <!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> -<title>Coverage of {{cu.filename|escape}}</title> +<title>Coverage for {{cu.name|escape}}</title> <style> +html, body { + margin: 0; + padding: 0; + font-size: 85%; + } +p { + margin: 0; + padding: 0; + } +#header { + background: #ffd472; + width: 100%; + font-family: verdana, sans-serif; + } + +#source { + padding: 1em; + font-family: "courier new", monospace; + } + +#footer { + background: #ffe9b8; + font-size: 85%; + font-family: verdana, sans-serif; + color: #666666; + font-variant: italic; + } + +.content { + padding: 1em; + } + +a.nav { + text-decoration: none; + color: inherit; + } +a.nav:hover { + text-decoration: underline; + color: inherit; + } + .linenos { - background: #eee; + background: #eeeeee; } .linenos p { text-align: right; margin: 0; padding: 0 .5em 0 .5em; - font-family: "courier new", monospace; - color: #999; + color: #999999; } -.source p { +.text p { margin: 0; padding: 0 0 0 .5em; - font-family: "courier new", monospace; white-space: nowrap; } @@ -99,18 +139,25 @@ SOURCE = """\ background: #e2e2e2; } -.source p.mis { +.text p.mis { background: #ffdddd; } -.source p.run { +.text p.run { background: #ddffdd; } -.source p.exc { +.text p.exc { background: #eeeeee; } </style> </head> <body> +<div id='header'> + <div class='content'> + <p>Coverage for <b>{{cu.filename|escape}}</b></p> + </div> +</div> + +<div id='source'> <table cellspacing='0' cellpadding='0'> <tr> <td class='linenos' valign='top'> @@ -118,13 +165,23 @@ SOURCE = """\ <p class='{{line.class}}'>{{line.number}}</p> {% endfor %} </td> -<td class='source' valign='top'> +<td class='text' valign='top'> {% for line in lines %} <p class='{{line.class}}'>{{line.text.rstrip|escape|not_empty}}</p> {% endfor %} </td> </tr> </table> +</div> + +<div id='footer'> + <div class='content'> + <p> + <a class='nav' href='http://bitbucket.org/ned/coveragepy/'>coverage.py v{{__version__}}</a> + </p> + </div> +</div> + </body> </html> """ |