@@ -270,6 +270,7 @@ sub parse_dir_prefix(@);
270
270
271
271
# HTML related prototypes
272
272
sub escape_html ($);
273
+ sub escape_id ($);
273
274
sub get_bar_graph_code ($$$);
274
275
275
276
sub write_png_files ();
@@ -7635,6 +7636,16 @@ END_OF_HTML
7635
7636
END_OF_HTML
7636
7637
}
7637
7638
7639
+ sub escape_id ($)
7640
+ {
7641
+ my ($name ) = @_ ;
7642
+
7643
+ # Name/ID attribute requirements according to HTML 4.01 Transitional
7644
+ $name =~ s / [^A-Za-z0-9-_:.]/ _/ g ;
7645
+
7646
+ return $name ;
7647
+ }
7648
+
7638
7649
# write_file_table_entry(handle, base_dir,
7639
7650
# [ name, [filename, fileDetails, fileHref, cbdata],
7640
7651
# activeTlaCols,
@@ -7702,10 +7713,10 @@ sub write_file_table_entry(*$$@)
7702
7713
# visible (you have to scroll up to see it).
7703
7714
# the fix is to put the anchor in the next column
7704
7715
if ($primary_key eq ' owner' ) {
7705
- $anchor = " <a id=$name >NAME</a>" ;
7716
+ $anchor = ' <a id="N ' . escape_id( $name ) . ' " >NAME</a>' ;
7706
7717
} elsif ($primary_key eq ' date' ) {
7707
7718
my $bin = $SummaryInfo::ageHeaderToBin {$name };
7708
- $anchor = " <a id=$bin >NAME</a>" ;
7719
+ $anchor = " <a id=\" B $bin \" >NAME</a>" ;
7709
7720
}
7710
7721
}
7711
7722
@@ -7714,10 +7725,10 @@ sub write_file_table_entry(*$$@)
7714
7725
if ($main::frames ) {
7715
7726
# href to anchor in frame doesn't seem to work in either firefox
7716
7727
# or chrome. However, this seems like the right syntax.
7717
- $tableHref .= " href=\" $file_link #__LINE__ \" target=\" source\" "
7728
+ $tableHref .= " href=\" $file_link #L__LINE__ \" target=\" source\" "
7718
7729
if 0;
7719
7730
} else {
7720
- $tableHref = " href=\" $file_link #__LINE__ \" " ;
7731
+ $tableHref = " href=\" $file_link #L__LINE__ \" " ;
7721
7732
}
7722
7733
}
7723
7734
# First column: name
@@ -7759,12 +7770,12 @@ sub write_file_table_entry(*$$@)
7759
7770
if ($page_type eq ' owner' ) {
7760
7771
$bin = $esc_name
7761
7772
if ($primary_key eq ' name' );
7762
- $namecode .= " -bin_owner." . $html_ext . " #" . $bin ;
7773
+ $namecode .= " -bin_owner." . $html_ext . " #N " . escape_id( $bin ) ;
7763
7774
$help = " owner $bin " ;
7764
7775
} elsif ($page_type eq ' date' ) {
7765
7776
$bin = $SummaryInfo::ageHeaderToBin {$name }
7766
7777
if ($primary_key eq ' name' );
7767
- $namecode .= " -bin_date." . $html_ext . " #$bin " ;
7778
+ $namecode .= " -bin_date." . $html_ext . " #B $bin " ;
7768
7779
$help =
7769
7780
" the period '" . $SummaryInfo::ageGroupHeader [$bin ] . " '" ;
7770
7781
} else {
@@ -8029,9 +8040,10 @@ END_OF_HTML
8029
8040
sub write_test_table_entry (*$$)
8030
8041
{
8031
8042
# *************************************************************
8043
+ my $name = escape_id($_ [1]);
8032
8044
8033
8045
write_html($_ [0], <<END_OF_HTML );
8034
- <dt>$_ [1]<a id="$_ [1] "> </a></dt>
8046
+ <dt>$_ [1]<a id="T $name "> </a></dt>
8035
8047
<dd>$_ [2]<br><br></dd>
8036
8048
END_OF_HTML
8037
8049
@@ -8330,7 +8342,8 @@ sub get_branch_html($$)
8330
8342
my $line = $differentialBranch -> line();
8331
8343
my $next = $fileDetail -> nextBranchTlaGroup($tla , $line );
8332
8344
$class .= " tlaBg$tla " ;
8333
- $href = " <a href=\" #" . (defined ($next ) ? $next : ' top' ) .
8345
+ $href =
8346
+ " <a href=\" #" . (defined ($next ) ? " L$next " : ' top' ) .
8334
8347
" \" title=\" TITLE\" >$char </a>" ;
8335
8348
$tlaLinks {$tla } = $href ;
8336
8349
}
@@ -8438,7 +8451,7 @@ sub write_source_line(*$$$$)
8438
8451
my $next = $cbdata -> sourceDetail()-> nextTlaGroup($bucket , $line );
8439
8452
$tlaIsHref = 1;
8440
8453
# if no next segment in this category - then go to top to page.
8441
- $next = ' top ' if (! defined ($next )) ;
8454
+ $next = defined ($next ) ? " L $next " : " top " ;
8442
8455
my $anchorClass = " " ;
8443
8456
if ($tla ne ' UNK' ) {
8444
8457
$class .= " tlaBg$bucket " ;
@@ -8489,7 +8502,7 @@ sub write_source_line(*$$$$)
8489
8502
8490
8503
# Write out a line number navigation anchor every $nav_resolution
8491
8504
# lines if necessary
8492
- $anchor_start = " <a id=\" $line \" >" ;
8505
+ $anchor_start = " <a id=\" L $line \" >" ;
8493
8506
$anchor_end = " </a>" ;
8494
8507
8495
8508
# *************************************************************
@@ -8617,7 +8630,7 @@ sub write_source_line(*$$$$)
8617
8630
-> nextInDateBin($newBin , $bucket , $line );
8618
8631
$cbdata -> nextDate($newBin , $bucket , $next );
8619
8632
8620
- $next = " top " if (! defined ($next )) ;
8633
+ $next = defined ($next ) ? " L $next " : " top " ;
8621
8634
my $dateBin = $SummaryInfo::ageGroupHeader [$newBin ];
8622
8635
my $label =
8623
8636
$main::use_legacyLabels ?
@@ -8636,7 +8649,7 @@ sub write_source_line(*$$$$)
8636
8649
my $next = $cbdata -> sourceDetail()
8637
8650
-> nextInOwnerBin($src_owner , $bucket , $line );
8638
8651
$cbdata -> nextOwner($src_owner , $bucket , $next );
8639
- $next = " top " if (! defined ($next )) ;
8652
+ $next = defined ($next ) ? " L $next " : " top " ;
8640
8653
my $label =
8641
8654
$main::use_legacyLabels ?
8642
8655
$SummaryInfo::tlaToLegacySrcLabel {$bucket } :
@@ -8817,7 +8830,7 @@ sub write_overview_line(*$$$)
8817
8830
# *************************************************************
8818
8831
8819
8832
write_html($_ [0], <<END_OF_HTML );
8820
- <area shape="rect" coords="0,$y1 ,$x2 ,$y2 " href="$_ [1].gcov.$html_ext #$_ [3]" target="source" alt="overview">
8833
+ <area shape="rect" coords="0,$y1 ,$x2 ,$y2 " href="$_ [1].gcov.$html_ext #L $_ [3]" target="source" alt="overview">
8821
8834
END_OF_HTML
8822
8835
8823
8836
# *************************************************************
@@ -8941,7 +8954,7 @@ sub buildDateSummaryTable($$$$$$$$$)
8941
8954
my $href = $SummaryInfo::ageGroupHeader [$bin ];
8942
8955
if (defined ($detailLink )) {
8943
8956
$href =
8944
- " <a href=\" $page #$bin \" title=\" click to go to coverage summary for the period '$href '\" >$href </a>" ;
8957
+ " <a href=\" $page #B $bin \" title=\" click to go to coverage summary for the period '$href '\" >$href </a>" ;
8945
8958
}
8946
8959
$hit -= $found # negative number
8947
8960
if ($main::opt_missed );
@@ -8988,7 +9001,7 @@ sub buildDateSummaryTable($$$$$$$$$)
8988
9001
if ($covType ne ' line' );
8989
9002
$popup .= " in “$dateBin ” bin\" " ;
8990
9003
$value =
8991
- " <a href=\" #$firstAppearance \" $popup$color >$value </a>" ;
9004
+ " <a href=\" #L $firstAppearance \" $popup$color >$value </a>" ;
8992
9005
}
8993
9006
push (@dataRow , [undef , $class , $value ]);
8994
9007
}
@@ -9065,7 +9078,8 @@ sub buildOwnerSummaryTable($$$$$$$$$)
9065
9078
my $href = $esc_name ;
9066
9079
if (defined ($detailLink )) {
9067
9080
$href =
9068
- " <a href=\" $page #$name \" title=\" click to go to coverage summary for owner '$esc_name '\" >$esc_name </a>" ;
9081
+ " <a href=\" $page #N" . escape_id($name ) .
9082
+ " \" title=\" click to go to coverage summary for owner '$esc_name '\" >$esc_name </a>" ;
9069
9083
}
9070
9084
$hit -= $found # negative number
9071
9085
if ($main::opt_missed );
@@ -9108,7 +9122,7 @@ sub buildOwnerSummaryTable($$$$$$$$$)
9108
9122
if ($covType ne ' line' );
9109
9123
$popup .= " in “$name ” bin\" " ;
9110
9124
$value =
9111
- " <a href=\" #$firstAppearance \" $popup$color >$value </a>" ;
9125
+ " <a href=\" #L $firstAppearance \" $popup$color >$value </a>" ;
9112
9126
}
9113
9127
push (@dataRow , [undef , $class , $value ]);
9114
9128
}
@@ -9147,7 +9161,7 @@ sub buildHeaderSummaryTableRow
9147
9161
$main::use_legacyLabels ? $SummaryInfo::tlaToLegacy {$tla } :
9148
9162
$tla ;
9149
9163
$popup .= " $label \" " ;
9150
- $value = " <a href=\" #$firstAppearance \" $popup >$value </a>" ;
9164
+ $value = " <a href=\" #L $firstAppearance \" $popup >$value </a>" ;
9151
9165
}
9152
9166
push (@row , [undef , " headerCovTableEntry" , $value ]);
9153
9167
}
@@ -10327,8 +10341,8 @@ sub write_file_table(*$$$$$)
10327
10341
my $href = $testname ;
10328
10342
# Insert link to description of available
10329
10343
if ($test_description {$testname }) {
10330
- $href = " <a href=\" $base_dir " .
10331
- " descriptions. $html_ext # $ testname\" >" . " $testname </a>" ;
10344
+ $href = " <a href=\" $base_dir " . " descriptions. $html_ext #T " .
10345
+ escape_id( $ testname) . " \" >" . " $testname </a>" ;
10332
10346
}
10333
10347
write_file_table_detail_entry(*HTML_HANDLE, $base_dir ,
10334
10348
$href , $showBinDetail , $activeTlaCols , @results );
@@ -10627,7 +10641,7 @@ END_OF_HTML
10627
10641
10628
10642
write_html(*HTML_HANDLE, <<END_OF_HTML );
10629
10643
<tr>
10630
- <td class="coverFn"><a href="$source #$startline ">$name </a></td>
10644
+ <td class="coverFn"><a href="$source #L $startline ">$name </a></td>
10631
10645
$tlaRow
10632
10646
<td class="$countstyle ">$count </td>
10633
10647
$lineProportionRow
@@ -10673,7 +10687,7 @@ END_OF_HTML
10673
10687
}
10674
10688
write_html(*HTML_HANDLE, <<END_OF_HTML );
10675
10689
<tr>
10676
- <td class="coverFnAlias"><a href="$source #$startline ">$alias </a></td>
10690
+ <td class="coverFnAlias"><a href="$source #L $startline ">$alias </a></td>
10677
10691
$tlaRow
10678
10692
<td class="$style ">$hit </td>
10679
10693
$lineProportionRow
0 commit comments