SVN::Web::RSS - SVN::Web action to generate an RSS feed


SVN-Web documentation Contained in the SVN-Web distribution.

Index


Code Index:

NAME

Top

SVN::Web::RSS - SVN::Web action to generate an RSS feed

SYNOPSIS

Top

In config.yaml

  actions:
    ...
    rss:
      class: SVN::Web::RSS
      action_menu:
        show:
          - file
          - directory
        link_text: (rss)
        head_only: 1
        icon: /css/trac/feed-icon-16x16.png
      opts:
        publisher: address@domain
    ...

DESCRIPTION

Top

Generates an RSS feed of commits to a file or path in the Subversion repository.

CONFIGURATION

Top

The following options may be specified in config.yaml.

publisher

The e-mail address of the feed's publisher. This is placed in to the <dc:publisher> element in the RSS output.

There is no default. If not specified then no <dc:publisher> element is included.

Note: RSS dates have a specific format. Accordingly, the timezone and timedate_format configuration options are ignored by this action.

OPTIONS

Top

See SVN::Web::Log.

TEMPLATE VARIABLES

Top

See SVN::Web::Log.

EXCEPTIONS

Top

See SVN::Web::Log.

COPYRIGHT

Top


SVN-Web documentation Contained in the SVN-Web distribution.
package SVN::Web::RSS;
@ISA = qw(SVN::Web::Log);
use strict;
use SVN::Web::Log;

our $VERSION = 0.53;

my %default_opts = (publisher => '');

# <dc:date> elements have a specific format that we must use, overriding
# the user's choice
sub format_svn_timestamp {
    my $self    = shift;
    my $cstring = shift;

    my $time = SVN::Core::time_from_cstring($cstring) / 1_000_000;

    return POSIX::strftime('%Y-%m-%dT%H:%M:%S', gmtime($time));
}

sub run {
    my $self = shift;

    my $data = $self->SUPER::run(@_)->{data};

    $self->{opts} = { %default_opts, %{ $self->{opts} } };

    return {
        template => 'rss',
	mimetype => 'text/xml',
        data     => { %{$data},
		      publisher => $self->{opts}{publisher},
		    }
    };
}

1;