From 954a6183756a073723a7c9fd8d2feb13132876b0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 1 Oct 2006 02:16:11 -0700 Subject: gitweb: make leftmost column of blame less cluttered. Instead of labelling each and every line with clickable commit object name, this makes the blame output to show them only on the first line of each group of lines from the same revision. Placing too many lines in one group would make the commit object name to appear too widely separated and also makes it consume more memory, the number of lines in one group is capped to 20 lines or so. Also it makes mouse-over to show the minimum authorship and authordate information for extra cuteness ;-). Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 99 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 86 insertions(+), 13 deletions(-) mode change 100755 => 100644 gitweb/gitweb.perl (limited to 'gitweb') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl old mode 100755 new mode 100644 index 3e9d4a0052..55d1b2c355 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2430,9 +2430,64 @@ sub git_tag { git_footer_html(); } +sub git_blame_flush_chunk { + my ($name, $revdata, $color, $rev, @line) = @_; + my $label = substr($rev, 0, 8); + my $line = scalar(@line); + my $cnt = 0; + my $pop = ''; + + if ($revdata->{$rev} ne '') { + $pop = ' title="' . esc_html($revdata->{$rev}) . '"'; + } + + for (@line) { + my ($lineno, $data) = @$_; + $cnt++; + print "\n"; + if ($cnt == 1) { + print " 1) { + print " rowspan=\"$line\""; + } + print ">"; + print $cgi->a({-href => href(action=>"commit", + hash=>$rev, + file_name=>$name)}, + $label); + print "\n"; + } + print "". + "" . + esc_html($lineno) . "\n"; + print "" . esc_html($data) . "\n"; + print "\n"; + } +} + +# We can have up to N*2 lines. If it is more than N lines, split it +# into two to avoid orphans. +sub git_blame_flush_chunk_1 { + my ($chunk_cap, $name, $revdata, $color, $rev, @chunk) = @_; + if ($chunk_cap < @chunk) { + my @first = splice(@chunk, 0, @chunk/2); + git_blame_flush_chunk($name, + $revdata, + $color, + $rev, + @first); + } + git_blame_flush_chunk($name, + $revdata, + $color, + $rev, + @chunk); +} + sub git_blame2 { my $fd; my $ftype; + my $chunk_cap = 20; my ($have_blame) = gitweb_check_feature('blame'); if (!$have_blame) { @@ -2475,27 +2530,45 @@ sub git_blame2 { HTML + my @chunk = (); + my %revdata = (); while (<$fd>) { /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/; - my $full_rev = $1; - my $rev = substr($full_rev, 0, 8); - my $lineno = $2; - my $data = $3; - + my ($full_rev, $author, $date, $lineno, $data) = + /^([0-9a-f]{40}).*?\s\((.*?)\s+([-\d]+ [:\d]+ [-+\d]+)\s+(\d+)\)\s(.*)/; + if (!exists $revdata{$full_rev}) { + $revdata{$full_rev} = "$author, $date"; + } if (!defined $last_rev) { $last_rev = $full_rev; } elsif ($last_rev ne $full_rev) { + git_blame_flush_chunk_1($chunk_cap, + $file_name, + \%revdata, + $rev_color[$current_color], + $last_rev, @chunk); + @chunk = (); $last_rev = $full_rev; $current_color = ++$current_color % $num_colors; } - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; + elsif ($chunk_cap * 2 < @chunk) { + # We have more than N*2 lines from the same + # revision. Flush N lines and leave N lines + # in @chunk to avoid orphaned lines. + my @first = splice(@chunk, 0, $chunk_cap); + git_blame_flush_chunk($file_name, + \%revdata, + $rev_color[$current_color], + $last_rev, @first); + } + push @chunk, [$lineno, $data]; + } + if (@chunk) { + git_blame_flush_chunk_1($chunk_cap, + $file_name, + \%revdata, + $rev_color[$current_color], + $last_rev, @chunk); } print "
CommitLineData
" . - $cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)}, - esc_html($rev)) . "" . - esc_html($lineno) . "" . esc_html($data) . "
\n"; print ""; -- cgit v1.2.3 From 2172ce4b01c862e66e3d581282dc92223cbd28fa Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 3 Oct 2006 02:30:47 -0700 Subject: gitweb: prepare for repositories with packed refs. When a repository is initialized long time ago with symbolic HEAD, and "git-pack-refs --prune" is run, HEAD will be a dangling symlink to refs/heads/ somewhere. Running -e "$dir/HEAD" to guess if $dir is a git repository does not give us the right answer anymore in such a case. Also factor out two places that checked if the repository can be exported with similar code into a call to a new function, check_export_ok. Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'gitweb') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 55d1b2c355..671a4e6e6f 100644 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -180,6 +180,22 @@ sub feature_pickaxe { return ($_[0]); } +# checking HEAD file with -e is fragile if the repository was +# initialized long time ago (i.e. symlink HEAD) and was pack-ref'ed +# and then pruned. +sub check_head_link { + my ($dir) = @_; + my $headfile = "$dir/HEAD"; + return ((-e $headfile) || + (-l $headfile && readlink($headfile) =~ /^refs\/heads\//)); +} + +sub check_export_ok { + my ($dir) = @_; + return (check_head_link($dir) && + (!$export_ok || -e "$dir/$export_ok")); +} + # rename detection options for git-diff and git-diff-tree # - default is '-M', with the cost proportional to # (number of removed files) * (number of new files). @@ -212,7 +228,7 @@ our $project = $cgi->param('p'); if (defined $project) { if (!validate_pathname($project) || !(-d "$projectroot/$project") || - !(-e "$projectroot/$project/HEAD") || + !check_head_link("$projectroot/$project") || ($export_ok && !(-e "$projectroot/$project/$export_ok")) || ($strict_export && !project_in_list($project))) { undef $project; @@ -289,7 +305,7 @@ sub evaluate_path_info { # find which part of PATH_INFO is project $project = $path_info; $project =~ s,/+$,,; - while ($project && !-e "$projectroot/$project/HEAD") { + while ($project && !check_head_link("$projectroot/$project")) { $project =~ s,/*[^/]*$,,; } # validate project @@ -816,8 +832,7 @@ sub git_get_projects_list { my $subdir = substr($File::Find::name, $pfxlen + 1); # we check related file in $projectroot - if (-e "$projectroot/$subdir/HEAD" && (!$export_ok || - -e "$projectroot/$subdir/$export_ok")) { + if (check_export_ok("$projectroot/$subdir")) { push @list, { path => $subdir }; $File::Find::prune = 1; } @@ -838,8 +853,7 @@ sub git_get_projects_list { if (!defined $path) { next; } - if (-e "$projectroot/$path/HEAD" && (!$export_ok || - -e "$projectroot/$path/$export_ok")) { + if (check_export_ok("$projectroot/$path")) { my $pr = { path => $path, owner => decode("utf8", $owner, Encode::FB_DEFAULT), -- cgit v1.2.3 From 9074484a2ba28cd41a78e0b10074a8882653bf3a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 4 Oct 2006 14:54:32 -0700 Subject: Revert 954a6183756a073723a7c9fd8d2feb13132876b0 Luben makes a good argument against it, and I agree with him in general. The clickable handle that appear at seemingly random places makes them look as if they are separating groups when it is not. This also restores the executable bit I lost by mistake. Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 99 +++++++----------------------------------------------- 1 file changed, 13 insertions(+), 86 deletions(-) mode change 100644 => 100755 gitweb/gitweb.perl (limited to 'gitweb') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl old mode 100644 new mode 100755 index 671a4e6e6f..32bd7b6f9c --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2444,64 +2444,9 @@ sub git_tag { git_footer_html(); } -sub git_blame_flush_chunk { - my ($name, $revdata, $color, $rev, @line) = @_; - my $label = substr($rev, 0, 8); - my $line = scalar(@line); - my $cnt = 0; - my $pop = ''; - - if ($revdata->{$rev} ne '') { - $pop = ' title="' . esc_html($revdata->{$rev}) . '"'; - } - - for (@line) { - my ($lineno, $data) = @$_; - $cnt++; - print "\n"; - if ($cnt == 1) { - print " 1) { - print " rowspan=\"$line\""; - } - print ">"; - print $cgi->a({-href => href(action=>"commit", - hash=>$rev, - file_name=>$name)}, - $label); - print "\n"; - } - print "". - "" . - esc_html($lineno) . "\n"; - print "" . esc_html($data) . "\n"; - print "\n"; - } -} - -# We can have up to N*2 lines. If it is more than N lines, split it -# into two to avoid orphans. -sub git_blame_flush_chunk_1 { - my ($chunk_cap, $name, $revdata, $color, $rev, @chunk) = @_; - if ($chunk_cap < @chunk) { - my @first = splice(@chunk, 0, @chunk/2); - git_blame_flush_chunk($name, - $revdata, - $color, - $rev, - @first); - } - git_blame_flush_chunk($name, - $revdata, - $color, - $rev, - @chunk); -} - sub git_blame2 { my $fd; my $ftype; - my $chunk_cap = 20; my ($have_blame) = gitweb_check_feature('blame'); if (!$have_blame) { @@ -2544,45 +2489,27 @@ sub git_blame2 { HTML - my @chunk = (); - my %revdata = (); while (<$fd>) { /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/; - my ($full_rev, $author, $date, $lineno, $data) = - /^([0-9a-f]{40}).*?\s\((.*?)\s+([-\d]+ [:\d]+ [-+\d]+)\s+(\d+)\)\s(.*)/; - if (!exists $revdata{$full_rev}) { - $revdata{$full_rev} = "$author, $date"; - } + my $full_rev = $1; + my $rev = substr($full_rev, 0, 8); + my $lineno = $2; + my $data = $3; + if (!defined $last_rev) { $last_rev = $full_rev; } elsif ($last_rev ne $full_rev) { - git_blame_flush_chunk_1($chunk_cap, - $file_name, - \%revdata, - $rev_color[$current_color], - $last_rev, @chunk); - @chunk = (); $last_rev = $full_rev; $current_color = ++$current_color % $num_colors; } - elsif ($chunk_cap * 2 < @chunk) { - # We have more than N*2 lines from the same - # revision. Flush N lines and leave N lines - # in @chunk to avoid orphaned lines. - my @first = splice(@chunk, 0, $chunk_cap); - git_blame_flush_chunk($file_name, - \%revdata, - $rev_color[$current_color], - $last_rev, @first); - } - push @chunk, [$lineno, $data]; - } - if (@chunk) { - git_blame_flush_chunk_1($chunk_cap, - $file_name, - \%revdata, - $rev_color[$current_color], - $last_rev, @chunk); + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; } print "
CommitLineData
" . + $cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)}, + esc_html($rev)) . "" . + esc_html($lineno) . "" . esc_html($data) . "
\n"; print ""; -- cgit v1.2.3 From 9dc5f8c9c2a10f77ecfa448c93da6ceec759df73 Mon Sep 17 00:00:00 2001 From: Luben Tuikov Date: Wed, 4 Oct 2006 00:12:17 -0700 Subject: gitweb: blame: print commit-8 on the leading row of a commit-block Print commit-8 only on the first, leading row of a commit block, to complement the per-commit block coloring. Signed-off-by: Luben Tuikov Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gitweb') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 32bd7b6f9c..dc21cd6471 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2495,17 +2495,23 @@ HTML my $rev = substr($full_rev, 0, 8); my $lineno = $2; my $data = $3; + my $print_c8 = 0; if (!defined $last_rev) { $last_rev = $full_rev; + $print_c8 = 1; } elsif ($last_rev ne $full_rev) { $last_rev = $full_rev; $current_color = ++$current_color % $num_colors; + $print_c8 = 1; } print "\n"; - print "" . - $cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)}, - esc_html($rev)) . "\n"; + print ""; + if ($print_c8 == 1) { + print $cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)}, + esc_html($rev)); + } + print "\n"; print "" . esc_html($lineno) . "\n"; print "" . esc_html($data) . "\n"; -- cgit v1.2.3 From c8aeaaf7fc7dd93a284218e6a2b6e96b90e3100c Mon Sep 17 00:00:00 2001 From: Luben Tuikov Date: Wed, 4 Oct 2006 00:13:38 -0700 Subject: gitweb: blame: Mouse-over commit-8 shows author and date Signed-off-by: Luben Tuikov Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gitweb') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index dc21cd6471..a99fabf4ad 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2490,11 +2490,9 @@ sub git_blame2 { CommitLineData HTML while (<$fd>) { - /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/; - my $full_rev = $1; + my ($full_rev, $author, $date, $lineno, $data) = + /^([0-9a-f]{40}).*?\s\((.*?)\s+([-\d]+ [:\d]+ [-+\d]+)\s+(\d+)\)\s(.*)/; my $rev = substr($full_rev, 0, 8); - my $lineno = $2; - my $data = $3; my $print_c8 = 0; if (!defined $last_rev) { @@ -2506,7 +2504,11 @@ HTML $print_c8 = 1; } print "\n"; - print ""; + print ""; if ($print_c8 == 1) { print $cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)}, esc_html($rev)); -- cgit v1.2.3 From b2d3476e15cefdbd94366d4cf46fd05c1623034f Mon Sep 17 00:00:00 2001 From: Alan Chandler Date: Tue, 3 Oct 2006 13:49:03 +0100 Subject: Gitweb - provide site headers and footers This allows web sites with a header and footer standard for each page to add them to the pages produced by gitweb. Two new variables $site_header and $site_footer are defined (default to null) each of which can specify a file containing the header and footer html. In addition, if the $stylesheet variable is undefined, a new array @stylesheets (which defaults to a single element of gitweb.css) can be used to specify more than one style sheet. This allows the clasical gitweb.css styles to be retained, but a site wide style sheet used within the header and footer areas. Signed-off-by: Alan Chandler Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'gitweb') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index a99fabf4ad..e4ebce6224 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -41,11 +41,19 @@ our $home_link_str = "++GITWEB_HOME_LINK_STR++"; # replace this with something more descriptive for clearer bookmarks our $site_name = "++GITWEB_SITENAME++" || $ENV{'SERVER_NAME'} || "Untitled"; +# filename of html text to include at top of each page +our $site_header = "++GITWEB_SITE_HEADER++"; # html text to include at home page our $home_text = "++GITWEB_HOMETEXT++"; +# filename of html text to include at bottom of each page +our $site_footer = "++GITWEB_SITE_FOOTER++"; + +# URI of stylesheets +our @stylesheets = ("++GITWEB_CSS++"); +our $stylesheet; +# default is not to define style sheet, but it can be overwritten later +undef $stylesheet; -# URI of default stylesheet -our $stylesheet = "++GITWEB_CSS++"; # URI of GIT logo our $logo = "++GITWEB_LOGO++"; # URI of GIT favicon, assumed to be image/png type @@ -1366,8 +1374,17 @@ sub git_header_html { $title - EOF +# print out each stylesheet that exist + if (defined $stylesheet) { +#provides backwards capability for those people who define style sheet in a config file + print ''."\n"; + } else { + foreach my $stylesheet (@stylesheets) { + next unless $stylesheet; + print ''."\n"; + } + } if (defined $project) { printf(''."\n", @@ -1385,8 +1402,15 @@ EOF } print "\n" . - "\n" . - "
\n" . + "\n"; + + if (-f $site_header) { + open (my $fd, $site_header); + print <$fd>; + close $fd; + } + + print "
\n" . "" . "\"git\"" . "\n"; @@ -1437,8 +1461,15 @@ sub git_footer_html { print $cgi->a({-href => href(project=>undef, action=>"project_index"), -class => "rss_logo"}, "TXT") . "\n"; } - print "
\n" . - "\n" . + print "
\n" ; + + if (-f $site_footer) { + open (my $fd, $site_footer); + print <$fd>; + close $fd; + } + + print "\n" . ""; } -- cgit v1.2.3 From eeef88cd20f2965325cde66e97a616bce4a757f0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 5 Oct 2006 13:55:58 -0700 Subject: gitweb: use blame --porcelain This makes gitweb (git_blame2) use "blame --porcelain", which lets the caller to figure out which line in the original version each line comes from. Using this information, change the behaviour of clicking the line number to go to the line of the blame output for the original commit. Before, clicking the line number meant "scoll up to show this line at the beginning of the page", which was not all that useful. The new behaviour lets you click on the line you are interested in to view the line in the context it was introduced, and keep digging deeper as you examine it. Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 65 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 21 deletions(-) (limited to 'gitweb') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 0ac05cc718..68347ac975 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -974,6 +974,9 @@ sub parse_date { $date{'hour_local'} = $hour; $date{'minute_local'} = $min; $date{'tz_local'} = $tz; + $date{'iso-tz'} = sprintf ("%04d-%02d-%02d %02d:%02d:%02d %s", + 1900+$year, $mon+1, $mday, + $hour, $min, $sec, $tz); return %date; } @@ -2501,7 +2504,8 @@ sub git_blame2 { if ($ftype !~ "blob") { die_error("400 Bad Request", "Object is not a blob"); } - open ($fd, "-|", git_cmd(), "blame", '-l', '--', $file_name, $hash_base) + open ($fd, "-|", git_cmd(), "blame", '--porcelain', '--', + $file_name, $hash_base) or die_error(undef, "Open git-blame failed"); git_header_html(); my $formats_nav = @@ -2525,33 +2529,52 @@ sub git_blame2 { HTML - while (<$fd>) { - my ($full_rev, $author, $date, $lineno, $data) = - /^([0-9a-f]{40}).*?\s\((.*?)\s+([-\d]+ [:\d]+ [-+\d]+)\s+(\d+)\)\s(.*)/; + my %metainfo = (); + while (1) { + $_ = <$fd>; + last unless defined $_; + my ($full_rev, $lineno, $orig_lineno, $group_size) = + /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/; + if (!exists $metainfo{$full_rev}) { + $metainfo{$full_rev} = {}; + } + my $meta = $metainfo{$full_rev}; + while (<$fd>) { + last if (s/^\t//); + if (/^(\S+) (.*)$/) { + $meta->{$1} = $2; + } + } + my $data = $_; my $rev = substr($full_rev, 0, 8); - my $print_c8 = 0; - - if (!defined $last_rev) { - $last_rev = $full_rev; - $print_c8 = 1; - } elsif ($last_rev ne $full_rev) { - $last_rev = $full_rev; + my $author = $meta->{'author'}; + my %date = parse_date($meta->{'author-time'}, + $meta->{'author-tz'}); + my $date = $date{'iso-tz'}; + if ($group_size) { $current_color = ++$current_color % $num_colors; - $print_c8 = 1; } print "\n"; - print "\n"; } - print "\n"; - print "\n"; + my $blamed = href(action => 'blame', + file_name => $meta->{'filename'}, + hash_base => $full_rev); + print ""; print "\n"; print "\n"; } -- cgit v1.2.3 From d15c55aa052434aee75c73da4ed771af3e3b6f61 Mon Sep 17 00:00:00 2001 From: Luben Tuikov Date: Wed, 11 Oct 2006 00:30:05 -0700 Subject: gitweb: blame porcelain: lineno and orig lineno swapped Signed-off-by: Luben Tuikov Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gitweb') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 68347ac975..41d047766c 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2533,7 +2533,7 @@ HTML while (1) { $_ = <$fd>; last unless defined $_; - my ($full_rev, $lineno, $orig_lineno, $group_size) = + my ($full_rev, $orig_lineno, $lineno, $group_size) = /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/; if (!exists $metainfo{$full_rev}) { $metainfo{$full_rev} = {}; -- cgit v1.2.3 From 48fd688ab0ba7d41ff4286aee20f6f0b86e4c41c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 12 Oct 2006 00:47:03 -0700 Subject: gitweb: spell "blame --porcelain" with -p Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gitweb') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 41d047766c..34b88ce8eb 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2504,7 +2504,7 @@ sub git_blame2 { if ($ftype !~ "blob") { die_error("400 Bad Request", "Object is not a blob"); } - open ($fd, "-|", git_cmd(), "blame", '--porcelain', '--', + open ($fd, "-|", git_cmd(), "blame", '-p', '--', $file_name, $hash_base) or die_error(undef, "Open git-blame failed"); git_header_html(); -- cgit v1.2.3
CommitLineData
"; - if ($print_c8 == 1) { - print $cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)}, + print " rowspan=\"$group_size\"" if ($group_size > 1); + print ">"; + print $cgi->a({-href => href(action=>"commit", + hash=>$full_rev, + file_name=>$file_name)}, esc_html($rev)); + print "" . - esc_html($lineno) . ""; + print $cgi->a({ -href => "$blamed#l$orig_lineno", + -id => "l$lineno", + -class => "linenr" }, + esc_html($lineno)); + print "" . esc_html($data) . "