~allison/ubuntu/raring/libsvn-web-perl/fix-for-1106378

« back to all changes in this revision

Viewing changes to lib/SVN/Web/Template/trac/_log_msg

  • Committer: Bazaar Package Importer
  • Author(s): David Moreno Garza
  • Date: 2007-11-30 14:01:12 UTC
  • Revision ID: james.westby@ubuntu.com-20071130140112-8kmxip5x9oaefnz2
Tags: upstream-0.53
ImportĀ upstreamĀ versionĀ 0.53

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
[%# This file defines a macro, 'log_msg', that you should call to format
 
2
    Subversion log messages.
 
3
 
 
4
    The macro can pass the message through multiple filters to ensure that
 
5
    it is formatted correctly.
 
6
 
 
7
    To override this file, either edit it directly, or (preferred), make
 
8
    a copy of it, and use the 'templatedirs' directive in config.yaml
 
9
    to specify the directory you copied it to.  Then edit the copy.
 
10
 
 
11
    Here is the default definition.  It converts the message to HTML, and
 
12
    retains the original line breaks.
 
13
%]
 
14
 
 
15
[% MACRO log_msg(text)
 
16
   text | html | html_line_break %]
 
17
 
 
18
[%# Here is a more complex example.  There's the same HTML conversion as
 
19
    before.  In addition,
 
20
 
 
21
    * Template::Plugin::Clickable and Template::Plugin::Clickable::Email
 
22
      are used to find URIs and e-mail addresses and make them clickable.
 
23
 
 
24
    * Strings that look like 'r1234' in the log message are converted
 
25
      to links to the 'revision' action for this repository.  Note the
 
26
      use of ${c.script} and ${c.repos} to ensure that the correct
 
27
      repository is used.
 
28
 
 
29
    * Strings that look like 'rt#1234' are converted to links to the
 
30
      relevant RT ticket in the CPAN ticketing system.
 
31
 
 
32
    Comment out the previous definition, and remove the '#' on the first
 
33
    line of this definition to use it.
 
34
%]
 
35
 
 
36
[%#
 
37
   USE Clickable;
 
38
   USE click_email = Clickable::Email;
 
39
   USE revision    = Subst
 
40
     pattern     = 'r(\d+)'
 
41
     replacement = "<a href='${c.script}/${c.repos}/revision?rev=\$1'>r\$1</a>"
 
42
     global      = 1;
 
43
   USE rt          = Subst
 
44
     pattern     = 'rt#(\d+)'
 
45
     replacement = '<a href="http://rt.cpan.org/NoAuth/Bug.html?id=$1">rt#$1</a>'
 
46
     global      = 1;
 
47
 
 
48
   MACRO log_msg(text)
 
49
       text | html | html_line_break | clickable | $click_email | $revision | $rt;
 
50
 
 
51
%]
 
52
 
 
53
[%# You can also define different results per-repository.  For example,
 
54
    if you have two repositories that both use 'rt#1234' to refer to tickets,
 
55
    but that use two different RT instances, you might define it like so:
 
56
%]
 
57
 
 
58
[%#
 
59
   USE rt1 = Subst
 
60
     pattern     = 'rt#(\d+)'                     
 
61
     replacement = '<a href="/rt1/rt.cgi?id=$1">rt#$1</a>'
 
62
     global      = 1;
 
63
 
 
64
   USE rt2 = Subst
 
65
     pattern     = 'rt#(\d+)'                     
 
66
     replacement = '<a href="/rt2/rt.cgi?id=$1">rt#$1</a>'
 
67
     global      = 1;
 
68
 
 
69
   MACRO log_msg(text)
 
70
     SWITCH c.repos;
 
71
     CASE 'repo1';
 
72
       text | html | html_line_break | $rt1;
 
73
     CASE 'repo2';
 
74
       text | html | html_line_break | $rt2;
 
75
     CASE;
 
76
       text | html | html_line_break;
 
77
     END;
 
78
%]
 
 
b'\\ No newline at end of file'