Skip to content

Commit c095813

Browse files
Peter Oberparleiteroberpar
authored andcommitted
genhtml: Implement option to allow HTML in test description
Add lcovrc directive genhtml_desc_html to allow using HTML markup in test case description text. Signed-off-by: Peter Oberparleiter <[email protected]>
1 parent 4f2c3ae commit c095813

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

bin/genhtml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ use Digest::MD5 qw(md5_base64);
7373

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

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

304305
our $cwd = `pwd`; # Current working directory
305306
chomp($cwd);
@@ -370,6 +371,7 @@ if ($config || %opt_rc)
370371
"genhtml_branch_field_width" => \$br_field_width,
371372
"genhtml_sort" => \$sort,
372373
"genhtml_charset" => \$charset,
374+
"genhtml_desc_html" => \$rc_desc_html,
373375
"lcov_function_coverage" => \$lcov_func_coverage,
374376
"lcov_branch_coverage" => \$lcov_branch_coverage,
375377
});
@@ -2656,8 +2658,10 @@ sub write_description_file($$$$$$$)
26562658

26572659
foreach $test_name (sort(keys(%description)))
26582660
{
2659-
write_test_table_entry(*HTML_HANDLE, $test_name,
2660-
escape_html($description{$test_name}));
2661+
my $desc = $description{$test_name};
2662+
2663+
$desc = escape_html($desc) if (!$rc_desc_html);
2664+
write_test_table_entry(*HTML_HANDLE, $test_name, $desc);
26612665
}
26622666

26632667
write_test_table_epilog(*HTML_HANDLE);

lcovrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ genhtml_sort = 1
9090
# Specify the character set of all generated HTML pages
9191
genhtml_charset=UTF-8
9292

93+
# Allow HTML markup in test case description text if non-zero
94+
genhtml_desc_html=0
95+
9396
# Location of the gcov tool (same as --gcov-info option of geninfo)
9497
#geninfo_gcov_tool = gcov
9598

man/lcovrc.5

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ genhtml_sort = 1
149149
genhtml_charset=UTF\-8
150150
.br
151151

152+
# Allow HTML markup in test case description text if non\-zero
153+
.br
154+
genhtml_desc_html=0
155+
.br
156+
152157
# Location of the gcov tool
153158
.br
154159
#geninfo_gcov_tool = gcov
@@ -546,6 +551,21 @@ when a custom HTML prolog is specified (see also
546551

547552
Default is UTF-8.
548553
.PP
554+
555+
.BR genhtml_desc_html " ="
556+
.IR 0 | 1
557+
.IP
558+
If non-zero, test case descriptions may contain HTML markup.
559+
560+
Set this option to one if you want to embed HTML markup (for example to
561+
include links) in test case descriptions. When set to zero, HTML markup
562+
characters will be escaped to show up as plain text on the test case
563+
description page.
564+
.br
565+
566+
Default is 0.
567+
.PP
568+
.
549569
.BR geninfo_gcov_tool " ="
550570
.I path_to_gcov
551571
.IP

0 commit comments

Comments
 (0)