"patch" => \&git_patch,
"patches" => \&git_patches,
"remotes" => \&git_remotes,
- "rss" => \&git_rss,
"atom" => \&git_atom,
"search" => \&git_search,
"search_help" => \&git_search_help,
# finally, we have the hash of allowed extra_options for the commands that
# allow them
our %allowed_options = (
- "--no-merges" => [ qw(rss atom log shortlog history) ],
+ "--no-merges" => [ qw(atom log shortlog history) ],
);
# fill %input_params with the CGI parameters. All values except for 'opt'
$href_params{'-title'} = 'log';
}
- foreach my $format (qw(RSS Atom)) {
+ foreach my $format (qw(Atom)) {
my $type = lc($format);
my %link_attr = (
'-rel' => 'alternate',
}
$href_params{'-title'} ||= 'log';
- foreach my $format (qw(RSS Atom)) {
+ foreach my $format (qw(Atom)) {
$href_params{'action'} = lc($format);
print $cgi->a({-href => href(%href_params),
-title => "$href_params{'-title'} $format feed",
}
print "<div class=\"pre\">" .
$cgi->a({-href => $file_href.'#l'.$lno,
- -class => "linenr"}, sprintf('%4i', $lno)) .
- ' ' . $ltext . "</div>\n";
+ -class => "linenr"}, sprintf('%4i ', $lno)) .
+ $ltext . "</div>\n";
}
}
if ($lastfile) {
chomp $line;
$nr++;
$line = untabify($line);
- printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr">%4i</a> %s</div>\n!,
+ printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr">%4i </a>%s</div>\n!,
$nr, esc_attr(href(-replay => 1)), $nr, $nr,
$highlight ? sanitize($line) : esc_html($line, -nbsp=>1);
}
}
## ......................................................................
-## feeds (RSS, Atom; OPML)
+## feeds (Atom; OPML)
sub git_feed {
my $format = shift || 'atom';
my $have_blame = gitweb_check_feature('blame');
# Atom: http://www.atomenabled.org/developers/syndication/
- # RSS: http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
- if ($format ne 'rss' && $format ne 'atom') {
+ if ($format ne 'atom') {
die_error(400, "Unknown web feed format");
}
if (defined $descr) {
$descr = esc_html($descr);
} else {
- $descr = "$project " .
- ($format eq 'rss' ? 'RSS' : 'Atom') .
- " feed";
+ $descr = "$project Atom feed";
}
my $owner = git_get_project_owner($project);
$owner = esc_html($owner);
}
$alt_url = esc_attr($alt_url);
print qq!<?xml version="1.0" encoding="utf-8"?>\n!;
- if ($format eq 'rss') {
- print <<XML;
-<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
-<channel>
-XML
- print "<title>$title</title>\n" .
- "<link>$alt_url</link>\n" .
- "<description>$descr</description>\n" .
- "<language>en</language>\n" .
- # project owner is responsible for 'editorial' content
- "<managingEditor>$owner</managingEditor>\n";
- if (defined $logo || defined $favicon) {
- # prefer the logo to the favicon, since RSS
- # doesn't allow both
- my $img = esc_url($logo || $favicon);
- print "<image>\n" .
- "<url>$img</url>\n" .
- "<title>$title</title>\n" .
- "<link>$alt_url</link>\n" .
- "</image>\n";
- }
- if (%latest_date) {
- print "<pubDate>$latest_date{'rfc2822'}</pubDate>\n";
- print "<lastBuildDate>$latest_date{'rfc2822'}</lastBuildDate>\n";
- }
- print "<generator>gitweb v.$version/$git_version</generator>\n";
- } elsif ($format eq 'atom') {
- print <<XML;
+ print <<XML;
<feed xmlns="http://www.w3.org/2005/Atom">
XML
- print "<title>$title</title>\n" .
- "<subtitle>$descr</subtitle>\n" .
- '<link rel="alternate" type="text/html" href="' .
- $alt_url . '" />' . "\n" .
- '<link rel="self" type="' . $content_type . '" href="' .
- $cgi->self_url() . '" />' . "\n" .
- "<id>" . esc_url(href(-full=>1)) . "</id>\n" .
- # use project owner for feed author
- "<author><name>$owner</name></author>\n";
- if (defined $favicon) {
- print "<icon>" . esc_url($favicon) . "</icon>\n";
- }
- if (defined $logo) {
- # not twice as wide as tall: 72 x 27 pixels
- print "<logo>" . esc_url($logo) . "</logo>\n";
- }
- if (! %latest_date) {
- # dummy date to keep the feed valid until commits trickle in:
- print "<updated>1970-01-01T00:00:00Z</updated>\n";
- } else {
- print "<updated>$latest_date{'iso-8601'}</updated>\n";
- }
- print "<generator version='$version/$git_version'>gitweb</generator>\n";
+ print "<title>$title</title>\n" .
+ "<subtitle>$descr</subtitle>\n" .
+ '<link rel="alternate" type="text/html" href="' .
+ $alt_url . '" />' . "\n" .
+ '<link rel="self" type="' . $content_type . '" href="' .
+ $cgi->self_url() . '" />' . "\n" .
+ "<id>" . esc_url(href(-full=>1)) . "</id>\n" .
+ # use project owner for feed author
+ "<author><name>$owner</name></author>\n";
+ if (defined $favicon) {
+ print "<icon>" . esc_url($favicon) . "</icon>\n";
+ }
+ if (defined $logo) {
+ # not twice as wide as tall: 72 x 27 pixels
+ print "<logo>" . esc_url($logo) . "</logo>\n";
+ }
+ if (! %latest_date) {
+ # dummy date to keep the feed valid until commits trickle in:
+ print "<updated>1970-01-01T00:00:00Z</updated>\n";
+ } else {
+ print "<updated>$latest_date{'iso-8601'}</updated>\n";
}
+ print "<generator version='$version/$git_version'>gitweb</generator>\n";
# contents
for (my $i = 0; $i <= $#commitlist; $i++) {
# print element (entry, item)
my $co_url = href(-full=>1, action=>"commitdiff", hash=>$commit);
- if ($format eq 'rss') {
- print "<item>\n" .
- "<title>" . esc_html($co{'title'}) . "</title>\n" .
- "<author>" . esc_html($co{'author'}) . "</author>\n" .
- "<pubDate>$cd{'rfc2822'}</pubDate>\n" .
- "<guid isPermaLink=\"true\">$co_url</guid>\n" .
- "<link>" . esc_html($co_url) . "</link>\n" .
- "<description>" . esc_html($co{'title'}) . "</description>\n" .
- "<content:encoded>" .
- "<![CDATA[\n";
- } elsif ($format eq 'atom') {
- print "<entry>\n" .
- "<title type=\"html\">" . esc_html($co{'title'}) . "</title>\n" .
- "<updated>$cd{'iso-8601'}</updated>\n" .
- "<author>\n" .
- " <name>" . esc_html($co{'author_name'}) . "</name>\n";
- if ($co{'author_email'}) {
- print " <email>" . esc_html($co{'author_email'}) . "</email>\n";
- }
- print "</author>\n" .
- # use committer for contributor
- "<contributor>\n" .
- " <name>" . esc_html($co{'committer_name'}) . "</name>\n";
- if ($co{'committer_email'}) {
- print " <email>" . esc_html($co{'committer_email'}) . "</email>\n";
- }
- print "</contributor>\n" .
- "<published>$cd{'iso-8601'}</published>\n" .
- "<link rel=\"alternate\" type=\"text/html\" href=\"" . esc_attr($co_url) . "\" />\n" .
- "<id>" . esc_html($co_url) . "</id>\n" .
- "<content type=\"xhtml\" xml:base=\"" . esc_url($my_url) . "\">\n" .
- "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n";
- }
+ print "<entry>\n" .
+ "<title type=\"html\">" . esc_html($co{'title'}) . "</title>\n" .
+ "<updated>$cd{'iso-8601'}</updated>\n" .
+ "<author>\n" .
+ " <name>" . esc_html($co{'author_name'}) . "</name>\n";
+ if ($co{'author_email'}) {
+ print " <email>" . esc_html($co{'author_email'}) . "</email>\n";
+ }
+ print "</author>\n" .
+ # use committer for contributor
+ "<contributor>\n" .
+ " <name>" . esc_html($co{'committer_name'}) . "</name>\n";
+ if ($co{'committer_email'}) {
+ print " <email>" . esc_html($co{'committer_email'}) . "</email>\n";
+ }
+ print "</contributor>\n" .
+ "<published>$cd{'iso-8601'}</published>\n" .
+ "<link rel=\"alternate\" type=\"text/html\" href=\"" . esc_attr($co_url) . "\" />\n" .
+ "<id>" . esc_html($co_url) . "</id>\n" .
+ "<content type=\"xhtml\" xml:base=\"" . esc_url($my_url) . "\">\n" .
+ "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n";
my $comment = $co{'comment'};
print "<pre>\n";
foreach my $line (@$comment) {
print "] ".
"$file</li>\n";
}
- if ($format eq 'rss') {
- print "</ul>]]>\n" .
- "</content:encoded>\n" .
- "</item>\n";
- } elsif ($format eq 'atom') {
- print "</ul>\n</div>\n" .
- "</content>\n" .
- "</entry>\n";
- }
+ print "</ul>\n</div>\n" .
+ "</content>\n" .
+ "</entry>\n";
}
# end of feed
- if ($format eq 'rss') {
- print "</channel>\n</rss>\n";
- } elsif ($format eq 'atom') {
- print "</feed>\n";
- }
-}
-
-sub git_rss {
- git_feed('rss');
+ print "</feed>\n";
}
sub git_atom {
<title>$title OPML Export$filter</title>
</head>
<body>
-<outline text="git RSS feeds">
+<outline text="git Atom feeds">
XML
foreach my $pr (@list) {
}
my $path = esc_html(chop_str($proj{'path'}, 25, 5));
- my $rss = esc_attr(href('project' => $proj{'path'}, 'action' => 'rss', -full => 1));
+ my $atom = esc_attr(href('project' => $proj{'path'}, 'action' => 'atom', -full => 1));
my $html = esc_attr(href('project' => $proj{'path'}, 'action' => 'summary', -full => 1));
- print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n";
+ print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$atom\" htmlUrl=\"$html\"/>\n";
}
print <<XML;
</outline>