Skip to content

Commit

Permalink
genhtml: Implement option to allow HTML in test description
Browse files Browse the repository at this point in the history
Add lcovrc directive genhtml_desc_html to allow using HTML markup in
test case description text.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
  • Loading branch information
Peter Oberparleiter authored and oberpar committed Jun 10, 2014
1 parent 4f2c3ae commit c095813
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bin/genhtml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ use Digest::MD5 qw(md5_base64);

# Global constants
our $title = "LCOV - code coverage report";
our $lcov_version = 'LCOV version 1.11 pre (CVS $Revision: 1.78 $)';
our $lcov_version = 'LCOV version 1.11 pre (CVS $Revision: 1.79 $)';
our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
our $tool_name = basename($0);

Expand Down Expand Up @@ -300,6 +300,7 @@ our @rate_name = ("Lo", "Med", "Hi");
our @rate_png = ("ruby.png", "amber.png", "emerald.png");
our $lcov_func_coverage = 1;
our $lcov_branch_coverage = 0;
our $rc_desc_html = 0; # lcovrc: genhtml_desc_html

our $cwd = `pwd`; # Current working directory
chomp($cwd);
Expand Down Expand Up @@ -370,6 +371,7 @@ if ($config || %opt_rc)
"genhtml_branch_field_width" => \$br_field_width,
"genhtml_sort" => \$sort,
"genhtml_charset" => \$charset,
"genhtml_desc_html" => \$rc_desc_html,
"lcov_function_coverage" => \$lcov_func_coverage,
"lcov_branch_coverage" => \$lcov_branch_coverage,
});
Expand Down Expand Up @@ -2656,8 +2658,10 @@ sub write_description_file($$$$$$$)

foreach $test_name (sort(keys(%description)))
{
write_test_table_entry(*HTML_HANDLE, $test_name,
escape_html($description{$test_name}));
my $desc = $description{$test_name};

$desc = escape_html($desc) if (!$rc_desc_html);
write_test_table_entry(*HTML_HANDLE, $test_name, $desc);
}

write_test_table_epilog(*HTML_HANDLE);
Expand Down
3 changes: 3 additions & 0 deletions lcovrc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ genhtml_sort = 1
# Specify the character set of all generated HTML pages
genhtml_charset=UTF-8

# Allow HTML markup in test case description text if non-zero
genhtml_desc_html=0

# Location of the gcov tool (same as --gcov-info option of geninfo)
#geninfo_gcov_tool = gcov

Expand Down
20 changes: 20 additions & 0 deletions man/lcovrc.5
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ genhtml_sort = 1
genhtml_charset=UTF\-8
.br

# Allow HTML markup in test case description text if non\-zero
.br
genhtml_desc_html=0
.br

# Location of the gcov tool
.br
#geninfo_gcov_tool = gcov
Expand Down Expand Up @@ -546,6 +551,21 @@ when a custom HTML prolog is specified (see also

Default is UTF-8.
.PP

.BR genhtml_desc_html " ="
.IR 0 | 1
.IP
If non-zero, test case descriptions may contain HTML markup.

Set this option to one if you want to embed HTML markup (for example to
include links) in test case descriptions. When set to zero, HTML markup
characters will be escaped to show up as plain text on the test case
description page.
.br

Default is 0.
.PP
.
.BR geninfo_gcov_tool " ="
.I path_to_gcov
.IP
Expand Down

0 comments on commit c095813

Please sign in to comment.