gitweb: Use here-doc

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Jakub Narebski 2006-08-22 23:42:53 +02:00 committed by Junio C Hamano
parent 77a153fd92
commit 59b9f61a3f

View File

@ -1185,11 +1185,13 @@ sub die_error {
my $error = shift || "Malformed query, file missing or permission denied"; my $error = shift || "Malformed query, file missing or permission denied";
git_header_html($status); git_header_html($status);
print "<div class=\"page_body\">\n" . print <<EOF;
"<br/><br/>\n" . <div class="page_body">
"$status - $error\n" . <br /><br />
"<br/>\n" . $status - $error
"</div>\n"; <br />
</div>
EOF
git_footer_html(); git_footer_html();
exit; exit;
} }
@ -2022,9 +2024,11 @@ sub git_blame2 {
my $num_colors = scalar(@rev_color); my $num_colors = scalar(@rev_color);
my $current_color = 0; my $current_color = 0;
my $last_rev; my $last_rev;
print "<div class=\"page_body\">\n"; print <<HTML;
print "<table class=\"blame\">\n"; <div class="page_body">
print "<tr><th>Commit</th><th>Line</th><th>Data</th></tr>\n"; <table class="blame">
<tr><th>Commit</th><th>Line</th><th>Data</th></tr>
HTML
while (<$fd>) { while (<$fd>) {
/^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/; /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
my $full_rev = $1; my $full_rev = $1;
@ -2566,9 +2570,10 @@ sub git_blobdiff {
git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav); git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
git_print_header_div('commit', esc_html($co{'title'}), $hash_base); git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
} else { } else {
print "<div class=\"page_nav\">\n" . print <<HTML;
"<br/><br/></div>\n" . <div class="page_nav"><br/><br/></div>
"<div class=\"title\">$hash vs $hash_parent</div>\n"; <div class="title">$hash vs $hash_parent</div>
HTML
} }
git_print_page_path($file_name, "blob", $hash_base); git_print_page_path($file_name, "blob", $hash_base);
print "<div class=\"page_body\">\n" . print "<div class=\"page_body\">\n" .
@ -2704,9 +2709,11 @@ sub git_commitdiff_plain {
-content_disposition => "inline; filename=\"git-$hash.patch\""); -content_disposition => "inline; filename=\"git-$hash.patch\"");
my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'}); my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
my $comment = $co{'comment'}; my $comment = $co{'comment'};
print "From: $co{'author'}\n" . print <<TEXT;
"Date: $ad{'rfc2822'} ($ad{'tz_local'})\n". From: $co{'author'}
"Subject: $co{'title'}\n"; Date: $ad{'rfc2822'} ($ad{'tz_local'})
Subject: $co{'title'}
TEXT
if (defined $tagname) { if (defined $tagname) {
print "X-Git-Tag: $tagname\n"; print "X-Git-Tag: $tagname\n";
} }
@ -2950,13 +2957,15 @@ sub git_rss {
my @revlist = map { chomp; $_ } <$fd>; my @revlist = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading git-rev-list failed"); close $fd or die_error(undef, "Reading git-rev-list failed");
print $cgi->header(-type => 'text/xml', -charset => 'utf-8'); print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n". print <<XML;
"<rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n"; <?xml version="1.0" encoding="utf-8"?>
print "<channel>\n"; <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
print "<title>$project</title>\n". <channel>
"<link>" . esc_html("$my_url?p=$project;a=summary") . "</link>\n". <title>$project $my_uri $my_url</title>
"<description>$project log</description>\n". <link>${\esc_html("$my_url?p=$project;a=summary")}</link>
"<language>en</language>\n"; <description>$project log</description>
<language>en</language>
XML
for (my $i = 0; $i <= $#revlist; $i++) { for (my $i = 0; $i <= $#revlist; $i++) {
my $commit = $revlist[$i]; my $commit = $revlist[$i];
@ -3005,13 +3014,15 @@ sub git_opml {
my @list = git_get_projects_list(); my @list = git_get_projects_list();
print $cgi->header(-type => 'text/xml', -charset => 'utf-8'); print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n". print <<XML;
"<opml version=\"1.0\">\n". <?xml version="1.0" encoding="utf-8"?>
"<head>". <opml version="1.0">
" <title>$site_name Git OPML Export</title>\n". <head>
"</head>\n". <title>$site_name Git OPML Export</title>
"<body>\n". </head>
"<outline text=\"git RSS feeds\">\n"; <body>
<outline text="git RSS feeds">
XML
foreach my $pr (@list) { foreach my $pr (@list) {
my %proj = %$pr; my %proj = %$pr;
@ -3030,7 +3041,9 @@ sub git_opml {
my $html = "$my_url?p=$proj{'path'};a=summary"; my $html = "$my_url?p=$proj{'path'};a=summary";
print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n"; print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n";
} }
print "</outline>\n". print <<XML;
"</body>\n". </outline>
"</opml>\n"; </body>
</opml>
XML
} }