- From: Terje Bless <link@hutz.w3.org>
- Date: Mon, 17 May 2004 21:04:00 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/httpd/cgi-bin In directory hutz:/tmp/cvs-serv20449 Modified Files: Tag: validator-0_6_0-branch check Log Message: Final tweak to source display from Ville. Closes Bug #717. Index: check =================================================================== RCS file: /sources/public/validator/httpd/cgi-bin/check,v retrieving revision 1.305.2.129 retrieving revision 1.305.2.130 diff -u -d -r1.305.2.129 -r1.305.2.130 --- check 17 May 2004 07:52:14 -0000 1.305.2.129 +++ check 17 May 2004 21:03:57 -0000 1.305.2.130 @@ -2202,9 +2202,7 @@ # # Create a HTML representation of the document. sub show_source { - my $File = shift; - my $line = 1; - my $lines = scalar @{$File->{Content}}; + my $File = shift; my $comment = ''; if ($File->{'Error Flagged'}) { @@ -2215,7 +2213,7 @@ $File->{Content}->[0] = substr $File->{Content}->[0], ($File->{BOM} ? 3 : 0); # remove BOM - print <<"EOF"; + print <<".EOF."; <div id="source" class="mtb"> <h2>Source Listing</h2> @@ -2223,12 +2221,14 @@ $comment <div> <pre> -EOF +.EOF. + my $line = 1; + my $maxhlen = length scalar @{$File->{Content}}; for (@{$File->{Content}}) { - my $hline = (' ' x (length("$lines") - length("$line"))) . $line; - printf qq(<a id="line-%s"><strong>%s</strong>: %s</a>\n), - $line, $hline, ent $_; + my $hline = (' ' x ($maxhlen - length("$line"))) . $line; + printf qq(<a id="line-%s" name="line-%s"><strong>%s</strong>: %s</a>\n), + $line, $line, $hline, ent $_; $line++; } print " </pre>\n </div>\n </div>";
Received on Monday, 17 May 2004 17:05:51 UTC