diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2010-03-14 09:29:54 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-03-14 09:29:54 -0400 |
commit | 1bde001d3be2814c3e49d1927b22f2d15193b1d9 (patch) | |
tree | 88abea7597d3e8fa258001cc87d7a8aba2390609 /coverage/htmlfiles | |
parent | 3f43a51c7a1e4532d57dc3cd95fa6c4397c87f50 (diff) | |
download | python-coveragepy-git-1bde001d3be2814c3e49d1927b22f2d15193b1d9.tar.gz |
HTML line numbers are clickable, and highlight the line on arrival. Also, noticed that IE8 didn't line up the line number properly, so added an unfortunate meta tag to make it right. Closes issue #55.
Diffstat (limited to 'coverage/htmlfiles')
-rw-r--r-- | coverage/htmlfiles/coverage_html.js | 8 | ||||
-rw-r--r-- | coverage/htmlfiles/pyfile.html | 10 | ||||
-rw-r--r-- | coverage/htmlfiles/style.css | 16 |
3 files changed, 30 insertions, 4 deletions
diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js index 2acba5c2..b6bde6ca 100644 --- a/coverage/htmlfiles/coverage_html.js +++ b/coverage/htmlfiles/coverage_html.js @@ -65,6 +65,14 @@ function index_page_ready($) { // -- pyfile stuff -- +function pyfile_ready($) { + // If we're directed to a particular line number, highlight the line. + var frag = location.hash; + if (frag.length > 2 && frag[1] == 'n') { + $(frag).addClass('highlight'); + } +} + function toggle_lines(btn, cls) { btn = $(btn); var hide = "hide_"+cls; diff --git a/coverage/htmlfiles/pyfile.html b/coverage/htmlfiles/pyfile.html index 209887b7..4aa4309f 100644 --- a/coverage/htmlfiles/pyfile.html +++ b/coverage/htmlfiles/pyfile.html @@ -1,11 +1,17 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + {# IE8 rounds line-height incorrectly, and adding this emulateIE7 line makes it right! #} + {# http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/7684445e-f080-4d8f-8529-132763348e21 #} + <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> <title>Coverage for {{cu.name|escape}}: {{nums.pc_covered|format_pct}}%</title> <link rel='stylesheet' href='style.css' type='text/css'> <script type='text/javascript' src='jquery-1.3.2.min.js'></script> <script type='text/javascript' src='coverage_html.js'></script> + <script type='text/javascript' charset='utf-8'> + jQuery(document).ready(pyfile_ready); + </script> </head> <body> @@ -31,7 +37,7 @@ <tr> <td class='linenos' valign='top'> {% for line in lines %} - <p id='n{{line.number}}' class='{{line.class}}'>{{line.number}}</p> + <p id='n{{line.number}}' class='{{line.class}}'><a href='#n{{line.number}}'>{{line.number}}</a></p> {% endfor %} </td> <td class='text' valign='top'> diff --git a/coverage/htmlfiles/style.css b/coverage/htmlfiles/style.css index 25e7d115..a9ab5358 100644 --- a/coverage/htmlfiles/style.css +++ b/coverage/htmlfiles/style.css @@ -5,8 +5,8 @@ html, body, h1, h2, h3, p, td, th { padding: 0; border: 0; outline: 0; - font-weight: inherit; - font-style: inherit; + font-weight: normal; + font-style: normal; font-size: 100%; font-family: inherit; vertical-align: baseline; @@ -108,6 +108,18 @@ h2.stats { font-size: .625em; /* 10/16 */ line-height: 1.6em; /* 16/10 */ } +.linenos p.highlight { + background: #ffdd00; + } +.linenos p a { + text-decoration: none; + color: #999999; + } +.linenos p a:hover { + text-decoration: underline; + color: #999999; + } + td.text { width: 100%; } |