Subject: | wish: line number anchors in html (w/patch!) |
Today I wanted to send a link to someone to say "look at the coverage of this subroutine, around like 300". The attached patch adds an anchor around some line numbers so you can make urls like this:
coverage.html#300
There are probably some other bits of the code that need the same modification, as well as some way to discover the feature. Perhaps making each line number a hyperlink to itself would do that.
Thanks for Devel::Cover!
Mark
--- Html_basic.pm.orig 2005-07-09 10:28:59.427072304 -0500
+++ Html_basic.pm 2005-07-09 10:29:26.749918600 -0500
@@ -490,7 +490,7 @@
[% FOREACH line = lines %]
<tr align="RIGHT" valign="CENTER">
- <td [% bg(colour = "number") %]> [% line.number %] </td>
+ <td [% bg(colour = "number") %]> <a name="[% line.number %]">[% line.number %]</a> </td>
[% FOREACH cr = line.criteria %]
<td [% bg(colour = cr.bg) %]>
[% IF cr.link.defined && cr.text %]
--- Html_minimal.pm.orig 2005-07-09 10:38:08.996525048 -0500
+++ Html_minimal.pm 2005-07-09 10:35:55.037889856 -0500
@@ -503,7 +503,7 @@
$sloc = escape_HTML($sloc);
- print $out qq'<tr><td class="h">$.</td>';
+ print $out qq'<tr><td class="h"><a name="$.">$.</a></td>';
my $metric = get_coverage_for_line($opt, $file_data, $.);