Skip to content

Commit 05cfc7e

Browse files
henry2coxoberpar
authored andcommitted
genhtml: Add option to change HTML footer text
Introduce new command-line option --footer and associated lcovrc option genhtml_footer that can be used to change the footer text shown at the bottom of each generated HTML page. [oberpar: Split original commit, added commit message, fixed typos and capitalization, fixed man page short option] Signed-off-by: Henry Cox <[email protected]>
1 parent 1eb18f1 commit 05cfc7e

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

Diff for: bin/genhtml

+6-1
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ our $date = get_date_string();
258258

259259
our @info_filenames; # List of .info files to use as data source
260260
our $header_title; # Title at top of HTML report page (above table)
261+
our $footer; # String at bottom of HTML report page
261262
our $test_title; # Title shown in header table of each page
262263
our $output_directory; # Name of directory in which to store output
263264
our $base_filename; # Optional name of file containing baseline data
@@ -356,6 +357,7 @@ if ($config || %opt_rc)
356357
apply_config({
357358
"genhtml_css_file" => \$css_filename,
358359
"genhtml_header" => \$header_title,
360+
"genhtml_footer" => \$footer,
359361
"genhtml_hi_limit" => \$hi_limit,
360362
"genhtml_med_limit" => \$med_limit,
361363
"genhtml_line_field_width" => \$line_field_width,
@@ -404,6 +406,7 @@ $br_coverage = $lcov_branch_coverage if (!defined($br_coverage));
404406
# Parse command line options
405407
if (!GetOptions("output-directory|o=s" => \$output_directory,
406408
"header-title=s" => \$header_title,
409+
"footer=s" => \$footer,
407410
"title|t=s" => \$test_title,
408411
"description-file|d=s" => \$desc_filename,
409412
"keep-descriptions|k" => \$keep_descriptions,
@@ -632,6 +635,7 @@ HTML output:
632635
-t, --title TITLE Show TITLE in header table of each page
633636
-c, --css-file CSSFILE Use external style sheet file CSSFILE
634637
--header-title BANNER Banner text at top of each HTML page
638+
--footer FOOTER Footer text at bottom of each HTML page
635639
--no-source Do not create source code view
636640
--num-spaces NUM Replace tabs with NUM spaces in source view
637641
--highlight Highlight lines with converted-only data
@@ -4415,13 +4419,14 @@ sub write_html_epilog(*$;$)
44154419
{
44164420
$break_code = " target=\"_parent\"";
44174421
}
4422+
my $f = defined($main::footer) ? $footer : "Generated by: <a href=\"$lcov_url\"$break_code>$lcov_version</a>";
44184423

44194424
# *************************************************************
44204425

44214426
write_html($_[0], <<END_OF_HTML)
44224427
<table width="100%" border=0 cellspacing=0 cellpadding=0>
44234428
<tr><td class="ruler"><img src="$_[1]glass.png" width=3 height=3 alt=""></td></tr>
4424-
<tr><td class="versionInfo">Generated by: <a href="$lcov_url"$break_code>$lcov_version</a></td></tr>
4429+
<tr><td class="versionInfo">$f</td></tr>
44254430
</table>
44264431
<br>
44274432
END_OF_HTML

Diff for: lcovrc

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
# Default is "LCOV - coverage report"
1717
#genhtml_header = Coverage report for my project
1818

19+
# Footer text to use at the bottom of each page
20+
# Default is LCOV tool version
21+
#genhtml_footer = My footer text
22+
1923
# Specify coverage rate limits (in %) for classifying file entries
2024
# HI: hi_limit <= rate <= 100 graph color: green
2125
# MED: med_limit <= rate < hi_limit graph color: orange

Diff for: man/genhtml.1

+14
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ genhtml \- Generate HTML view from LCOV coverage data files
2020
.RB [ \-\-header-title
2121
.IR banner ]
2222
.br
23+
.RB [ \-\-footer
24+
.IR string ]
25+
.br
2326
.RB [ \-t | \-\-title
2427
.IR title ]
2528
.br
@@ -231,6 +234,17 @@ simply identifies this as an LCOV coverage report.
231234
A potential use is to specify the name of the project or project branch and
232235
build ID.
233236

237+
.RE
238+
.BI "\-\-footer " FOOTER
239+
.RS
240+
Display
241+
.I FOOTER
242+
in footer of all pages.
243+
244+
.I FOOTER
245+
is written to the footer portion of each generated HTML page.
246+
The default simply identifies the LCOV tool version used to generate the report.
247+
234248
.RE
235249
.BI "\-d " description\-file
236250
.br

Diff for: man/lcovrc.5

+19
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ section 'OPTIONS' below.
5757
# Alternate header text to use at top of each page
5858
.br
5959
#genhtml_header = Coverage report for my project
60+
.br
61+
62+
# Alternate footer text to use at the bottom of each page
63+
.br
64+
#genhtml_footer = My footer text
65+
.br
6066

6167
# Coverage rate limits
6268
.br
@@ -340,6 +346,19 @@ This option corresponds to the \-\-header\-title command line option of
340346
Default is "LCOV - coverage report".
341347
.PP
342348

349+
.BR genhtml_footer " ="
350+
.I string
351+
.IP
352+
Specify footer text to use at bottom of each HTML page.
353+
.br
354+
355+
This option corresponds to the \-\-footer command line option of
356+
.BR genhtml .
357+
.br
358+
359+
Default is LCOV tool version string.
360+
.PP
361+
343362
.BR genhtml_dark_mode " ="
344363
.IR 0 | 1
345364
.IP

0 commit comments

Comments
 (0)