Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add -restrict option to html_basic..

Option defaults to on.
  • Loading branch information...
commit 3848cae24923b3517a85460812acdb0af8eed24e 1 parent af603bf
@pjcj authored
Showing with 34 additions and 11 deletions.
  1. +2 −0  Changes
  2. +2 −0  bin/cover
  3. +30 −11 lib/Devel/Cover/Report/Html_basic.pm
View
2  Changes
@@ -3,6 +3,8 @@ Devel::Cover history
{{$NEXT}}
- Fix segv in constant folding of xor ops (gitbub 40).
- Fix various problems running Devel::Cover under tainting (github 41).
+ - Add JavaScript to filter results in html_basic (David Cantrell) (github 42).
+ Use -norestrict option to keep previous behaviour.
Release 0.99 - 31 December 2012
- Improve documentation (Olaf Alders) (github 34).
View
2  bin/cover
@@ -419,6 +419,8 @@ The following reports are currently available:
text - detailed textual summary
html - detailed HTML reports
+ html_basic - detailed HTML reports with syntax highlighting
+ compilation - output in a format similar to Perl
=head1 OPTIONS
View
41 lib/Devel/Cover/Report/Html_basic.pm
@@ -379,12 +379,14 @@ sub get_options
{
my ($self, $opt) = @_;
$opt->{option}{outputfile} = "coverage.html";
+ $opt->{option}{restrict} = 1;
$threshold->{$_} = $opt->{"report_$_"} for
grep { defined $opt->{"report_$_"} } qw( c0 c1 c2 );
die "Invalid command line options" unless
GetOptions($opt->{option},
qw(
outputfile=s
+ restrict!
));
}
@@ -569,25 +571,35 @@ $Templates{summary} = <<'EOT';
</table>
<div><br></br></div>
+[% IF R.options.option.restrict %]
<script language=javascript>
- function filter_files(filter_by) {
- var allelements = document.getElementsByTagName("tr");
- var re_now = new RegExp(filter_by, 'i');
- for(var i = 0; i < allelements.length; i++) {
- if(allelements[i].className) {
- if(filter_by == "" || allelements[i].className == "Total" || (filter_by.length && re_now.test(allelements[i].className))) {
- allelements[i].style.display = "table-row";
- } else if(filter_by.length && !re_now.test(allelements[i].className)) {
- allelements[i].style.display = "none";
- }
+function filter_files(filter_by) {
+ var allelements = document.getElementsByTagName("tr");
+ var re_now = new RegExp(filter_by, "i");
+ for (var i = 0; i < allelements.length; i++) {
+ if (allelements[i].className) {
+ if (filter_by == "" || allelements[i].className == "Total" ||
+ (filter_by.length && re_now.test(allelements[i].className))) {
+ allelements[i].style.display = "table-row";
+ } else if (filter_by.length &&
+ !re_now.test(allelements[i].className)) {
+ allelements[i].style.display = "none";
}
}
}
+}
</script>
-<form name=filterform action='javascript:filter_files(document.forms["filterform"]["filterfield"].value)'>Restrict to regex: <input type=text name=filterfield><input type=submit></form>
+
+<form name=filterform
+ action='javascript:filter_files(document.forms["filterform"]["filterfield"].value)'>
+ Restrict to regex:
+ <input type=text name=filterfield><input type=submit>
+</form>
+
<br />
+[% END %]
<table class="sortable" id="coverage_table">
<thead>
@@ -816,6 +828,13 @@ This module provides a HTML reporting mechanism for coverage data. It
is designed to be called from the C<cover> program. It will add syntax
highlighting if C<PPI::HTML> or C<Perl::Tidy> is installed.
+=head1 OPTIONS
+
+The following command line options are supported:
+
+ -outputfile - name of output file (default coverage.html)
+ -restrict - add restrict to regex form (default on)
+
=head1 SEE ALSO
Devel::Cover

0 comments on commit 3848cae

Please sign in to comment.
Something went wrong with that request. Please try again.