From 29cd74524abf7568452da7e59903759c267635ed Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 14 Mar 2010 09:29:54 -0400 Subject: 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. --- coverage/htmlfiles/coverage_html.js | 8 ++++++++ coverage/htmlfiles/pyfile.html | 10 ++++++++-- coverage/htmlfiles/style.css | 16 ++++++++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) (limited to 'coverage/htmlfiles') diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js index 2acba5c..b6bde6c 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 209887b..4aa4309 100644 --- a/coverage/htmlfiles/pyfile.html +++ b/coverage/htmlfiles/pyfile.html @@ -1,11 +1,17 @@ - + + {# 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 #} + Coverage for {{cu.name|escape}}: {{nums.pc_covered|format_pct}}% + @@ -31,7 +37,7 @@ {% for line in lines %} -

{{line.number}}

+

{{line.number}}

{% endfor %} diff --git a/coverage/htmlfiles/style.css b/coverage/htmlfiles/style.css index 25e7d11..a9ab535 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%; } -- cgit v1.2.1