man SVN::Notify::HTML () - Subversion activity HTML notification

Name

SVN::Notify::HTML - Subversion activity HTML notification

Synopsis

Use svnnotify in post-commit:

  svnnotify --repos-path "$1" --revision "$2" \
    --to developers@example.com --handler HTML [options]

Use the class in a custom script:

  use SVN::Notify::HTML;

  my $notifier = SVN::Notify::HTML->new(%params);
  $notifier->prepare;
  $notifier->execute;

Description

This subclass of SVN::Notify sends HTML formatted email messages for Subversion activity, rather than the default plain text.

Prerequisites

In addition to the modules required by SVN::Notify, this class requires:

HTML::Entities

Usage

To use SVN::Notify::HTML, simply follow the instructions in SVN::Notify, but when using svnnotify, specify CW--handler HTML.

Class Interface

Constructor

new

new

  my $notifier = SVN::Notify->new(%params);

Constructs and returns a new SVN::Notify object. All parameters supported by SVN::Notity are supported here, but SVN::Notify::HTML supports a few additional parameters:

linkize
  svnnotify --linkize
A boolean attribute to specify whether or not to linkize the SVN log messagethat is, to turn any URLs or email addresses in the log message into links.
ticket_regex
  svnnotify --ticket-regex '\[?\s*(Ticket\s*#\s*(\d+))\s*\]?'
This attribute is inherited from SVN::Notify, but its semantics are slightly different: it should return two matches instead of one: the text to linkify and the ticket ID itself. The example shown matches ([Ticket#1234], 1234) or ([ Ticket # 1234 ], 1234). Make your regex as specific as possible, preferably wrapped in \b tags and the like.

Class Methods

content_type

Returns the content type of the notification message, text/html. Used to set the Content-Type header for the message.

Instance Interface

Instance Methods

start_body

  $notifier->start_body($file_handle);

This method starts the body of the notification message. It outputs the opening CW<html>, CW<head>, CW<style>, and CW<body> tags. Note that if the CWlanguage attribute is set to a value, it will be specified in the CW<html> tag.

output_css

  $notifier->output_css($file_handle);

This method starts outputs the CSS for the HTML message. It is called by CWstart_body(), and which wraps the output of CWoutput_css() in the appropriate CW<style> tags.

output_metadata

  $notifier->output_metadata($file_handle);

This method outputs a definition list containting the metadata of the commit, including the revision number, author (user), and date of the revision. If the CWsvnweb_url or CWviewcvs_url attribute has been set, then the appropriate URL for the revision will be used to turn the revision number into a link.

output_log_message

  $notifier->output_log_message($file_handle);

Outputs the commit log message in CW<pre> tags, and the label Log Message in CW<h3> tags. If the CWbugzilla_url attribute is set, then any strings like Bug 2 or bug # 567 will be turned into links.

output_file_lists

  $notifier->output_log_message($file_handle);

Outputs the lists of modified, added, deleted, files, as well as the list of files for which properties were changed as unordered lists. The labels used for each group are pulled in from the CWfile_label_map() class method and output in CW<h3> tags.

end_body

  $notifier->end_body($file_handle);

Closes out the body of the email by outputting the closing CW</body> and CW</html> tags. Designed to be called when the body of the message is complete, and before any call to CWoutput_attached_diff().

output_diff

  $notifier->output_diff($out_file_handle, $diff_file_handle);

Sends the output of CWsvnlook diff to the specified file handle for inclusion in the notification message. The diff is output between CW<pre> tags, and Each line of the diff file is escaped by CWHTML::Entities::encode_entities(). The diff data will be read from CW$diff_file_handle and printed to CW$out_file_handle.

See Also

SVN::Notify

Author

David Wheeler <david@kineticode.com>

Copyright and License

Copyright (c) 2004-2005 Kineticode, Inc. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.