gitweb: Use here-doc
Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jakub Narebski committed
Aug 22, 2006 at 23:42 UTC
59b9f61a3f76762dc975e99cc05335a3b97ad1f9
1 file changed
+44
-31
gitweb/gitweb.perl
+44
-31
@@ -1185,11 +1185,13 @@ sub die_error {
1185
my $error = shift || "Malformed query, file missing or permission denied";
1186
1187
git_header_html($status);
1188
- print "<div class=\"page_body\">\n" .
1189
- "<br/><br/>\n" .
1190
- "$status - $error\n" .
1191
- "<br/>\n" .
1192
- "</div>\n";
1188
+ print <<EOF;
1189
+<div class="page_body">
1190
+<br /><br />
1191
+$status - $error
1192
+<br />
1193
+</div>
1194
+EOF
1195
git_footer_html();
1196
exit;
1197
}
@@ -2022,9 +2024,11 @@ sub git_blame2 {
2024
my $num_colors = scalar(@rev_color);
2025
my $current_color = 0;
2026
my $last_rev;
2025
- print "<div class=\"page_body\">\n";
2026
- print "<table class=\"blame\">\n";
2027
- print "<tr><th>Commit</th><th>Line</th><th>Data</th></tr>\n";
2027
+ print <<HTML;
2028
+<div class="page_body">
2029
+<table class="blame">
2030
+<tr><th>Commit</th><th>Line</th><th>Data</th></tr>
2031
+HTML
2032
while (<$fd>) {
2033
/^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
2034
my $full_rev = $1;
@@ -2566,9 +2570,10 @@ sub git_blobdiff {
2570
git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
2571
git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
2572
} else {
2569
- print "<div class=\"page_nav\">\n" .
2570
- "<br/><br/></div>\n" .
2571
- "<div class=\"title\">$hash vs $hash_parent</div>\n";
2573
+ print <<HTML;
2574
+<div class="page_nav"><br/><br/></div>
2575
+<div class="title">$hash vs $hash_parent</div>
2576
+HTML
2577
}
2578
git_print_page_path($file_name, "blob", $hash_base);
2579
print "<div class=\"page_body\">\n" .
@@ -2704,9 +2709,11 @@ sub git_commitdiff_plain {
2709
-content_disposition => "inline; filename=\"git-$hash.patch\"");
2710
my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
2711
my $comment = $co{'comment'};
2707
- print "From: $co{'author'}\n" .
2708
- "Date: $ad{'rfc2822'} ($ad{'tz_local'})\n".
2709
- "Subject: $co{'title'}\n";
2712
+ print <<TEXT;
2713
+From: $co{'author'}
2714
+Date: $ad{'rfc2822'} ($ad{'tz_local'})
2715
+Subject: $co{'title'}
2716
+TEXT
2717
if (defined $tagname) {
2718
print "X-Git-Tag: $tagname\n";
2719
}
@@ -2950,13 +2957,15 @@ sub git_rss {
2957
my @revlist = map { chomp; $_ } <$fd>;
2958
close $fd or die_error(undef, "Reading git-rev-list failed");
2959
print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
2953
- print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
2954
- "<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n";
2955
- print "<channel>\n";
2956
- print "<title>$project</title>\n".
2957
- "<link>" . esc_html("$my_url?p=$project;a=summary") . "</link>\n".
2958
- "<description>$project log</description>\n".
2959
- "<language>en</language>\n";
2960
+ print <<XML;
2961
+<?xml version="1.0" encoding="utf-8"?>
2962
+<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
2963
+<channel>
2964
+<title>$project $my_uri $my_url</title>
2965
+<link>${\esc_html("$my_url?p=$project;a=summary")}</link>
2966
+<description>$project log</description>
2967
+<language>en</language>
2968
+XML
2969
2970
for (my $i = 0; $i <= $#revlist; $i++) {
2971
my $commit = $revlist[$i];
@@ -3005,13 +3014,15 @@ sub git_opml {
3014
my @list = git_get_projects_list();
3015
3016
print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
3008
- print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
3009
- "<opml version=\"1.0\">\n".
3010
- "<head>".
3011
- " <title>$site_name Git OPML Export</title>\n".
3012
- "</head>\n".
3013
- "<body>\n".
3014
- "<outline text=\"git RSS feeds\">\n";
3017
+ print <<XML;
3018
+<?xml version="1.0" encoding="utf-8"?>
3019
+<opml version="1.0">
3020
+<head>
3021
+ <title>$site_name Git OPML Export</title>
3022
+</head>
3023
+<body>
3024
+<outline text="git RSS feeds">
3025
+XML
3026
3027
foreach my $pr (@list) {
3028
my %proj = %$pr;
@@ -3030,7 +3041,9 @@ sub git_opml {
3041
my $html = "$my_url?p=$proj{'path'};a=summary";
3042
print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n";
3043
}
3033
- print "</outline>\n".
3034
- "</body>\n".
3035
- "</opml>\n";
3044
+ print <<XML;
3045
+</outline>
3046
+</body>
3047
+</opml>
3048
+XML
3049
}