line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Trac; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# Required inclusions. |
5
|
|
|
|
|
|
|
############################################################################### |
6
|
1
|
|
|
1
|
|
149379
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
8
|
1
|
|
|
1
|
|
15
|
use Text::Trac; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
10
|
|
9
|
1
|
|
|
1
|
|
22
|
use base qw(Template::Plugin::Filter); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
780
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
############################################################################### |
12
|
|
|
|
|
|
|
# Version number. |
13
|
|
|
|
|
|
|
############################################################################### |
14
|
|
|
|
|
|
|
our $VERSION = '1.02'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
############################################################################### |
17
|
|
|
|
|
|
|
# Subroutine: init() |
18
|
|
|
|
|
|
|
############################################################################### |
19
|
|
|
|
|
|
|
# Initializes the template plugin. |
20
|
|
|
|
|
|
|
############################################################################### |
21
|
|
|
|
|
|
|
sub init { |
22
|
4
|
|
|
4
|
1
|
148416
|
my $self = shift; |
23
|
4
|
|
|
|
|
16
|
$self->{'_DYNAMIC'} = 1; |
24
|
4
|
|
50
|
|
|
45
|
$self->install_filter( $self->{'_ARGS'}->[0] || 'trac' ); |
25
|
4
|
|
|
|
|
161
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
############################################################################### |
29
|
|
|
|
|
|
|
# Subroutine: filter($txt, $args, $config) |
30
|
|
|
|
|
|
|
############################################################################### |
31
|
|
|
|
|
|
|
# Filters the given text, by running it through 'Text::Trac'. |
32
|
|
|
|
|
|
|
############################################################################### |
33
|
|
|
|
|
|
|
sub filter { |
34
|
4
|
|
|
4
|
1
|
435
|
my ($self, $text, $args, $config) = @_; |
35
|
4
|
|
|
|
|
8
|
my $parser = Text::Trac->new( %{$config} ); |
|
4
|
|
|
|
|
24
|
|
36
|
4
|
|
|
|
|
60
|
return $parser->parse( $text ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Template::Plugin::Trac - TT filter for Text::Trac |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
[% USE Trac %] |
48
|
|
|
|
|
|
|
... |
49
|
|
|
|
|
|
|
[% FILTER trac %] |
50
|
|
|
|
|
|
|
= Heading One = |
51
|
|
|
|
|
|
|
== Heading Two == |
52
|
|
|
|
|
|
|
[% END %] |
53
|
|
|
|
|
|
|
... |
54
|
|
|
|
|
|
|
[% text | trac %] |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
C is a plugin for TT, which formats your text using |
59
|
|
|
|
|
|
|
Trac's WikiFormatting style. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 METHODS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=over |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item init() |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Initializes the template plugin. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item filter($txt, $args, $config) |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Filters the given text, by running it through C. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=back |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 AUTHOR |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Graham TerMarsch |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 COPYRIGHT |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Copyright (C) 2006-2007, Graham TerMarsch. All rights Reserved. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the same |
84
|
|
|
|
|
|
|
terms as Perl itself. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SEE ALSO |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
L, |
89
|
|
|
|
|
|
|
L. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |