File Coverage

blib/lib/SVN/Notify/Filter/Markdown.pm
Criterion Covered Total %
statement 14 14 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 20 21 95.2


line stmt bran cond sub pod time code
1             package SVN::Notify::Filter::Markdown;
2              
3 1     1   45432 use strict;
  1         4  
  1         46  
4 1     1   1310 use Text::Markdown ();
  1         211791  
  1         28  
5 1     1   2838 use SVN::Notify ();
  1         21546  
  1         271  
6             $SVN::Notify::Filter::Markdown::VERSION = '0.05';
7              
8             sub log_message {
9 2     2 0 129116 my ($notify, $lines) = @_;
10 2 100       11 return $lines unless $notify->content_type eq 'text/html';
11 1         19 my $m = Text::Markdown->new;
12 1         20 return [ $m->markdown( join $/, @{ $lines } ) ];
  1         21  
13             }
14              
15             1;
16              
17             =head1 Name
18              
19             SVN::Notify::Filter::Markdown - Convert SVN::Notify log messages from Markdown to HTML
20              
21             =head1 Synopsis
22              
23             Use F in F:
24              
25             svnnotify --p "$1" --r "$2" --to you@example.com --handler HTML \
26             --filter Markdown
27              
28             Use the class in a custom script:
29              
30             use SVN::Notify;
31              
32             my $notifier = SVN::Notify->new(
33             repos_path => $path,
34             revision => $rev,
35             to => 'you@example.com',
36             handler => 'HTML::ColorDiff',
37             filters => [ 'Markdown' ],
38             );
39             $notifier->prepare;
40             $notifier->execute;
41              
42             =head1 Description
43              
44             This module filters SVN::Notify log message output to convert it from Markdown
45             format to HTML. Essentially, this means that if you write your commit log
46             messages in Markdown format and like to use
47             L or
48             L to format your
49             commit notifications, you can use this filter to convert the Markdown
50             formatting in the log message to HTML. Just pass C<--filter Markdown> to your
51             call to C in F and you're good to go.
52              
53             If you don't know what any of this means, read the L
54             documentation. It talks about using SVN::Notify to send nicely formatted
55             emails for every Subversion commit. This module just makes them even more
56             nicely formatted.
57              
58             =head1 See Also
59              
60             =over
61              
62             =item L
63              
64             =item L
65              
66             =item L
67              
68             =back
69              
70             =head1 Support
71              
72             This module is stored in an open L
73             repository|http://github.com/theory/svn-notify-filter-markdown/>. Feel free to
74             fork and contribute!
75              
76             Please file bug reports via L
77             Issues|http://github.com/theory/svn-notify-filter-markdown/issues/> or by
78             sending mail to
79             L.
80              
81             =head1 Author
82              
83             David E. Wheeler
84              
85             =head1 Copyright and License
86              
87             Copyright (c) 2008-2011 David E. Wheeler. Some Rights Reserved.
88              
89             This module is free software; you can redistribute it and/or modify it under
90             the same terms as Perl itself.
91              
92             =cut