blib/lib/Template/Plugin/Trac.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 93.9% 31 / 33 CC 2 SCAR 2.6
CC
2
Cov
96%
init
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
↑ Summary
1 package Template::Plugin::Trac;
2  
3 ###############################################################################
4 # Required inclusions.
5 ###############################################################################
6 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Text::Trac;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use base qw(Template::Plugin::Filter);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 ###############################################################################
12 # Version number.
13 ###############################################################################
14 2 our $VERSION = '1.03';
15  
16 ###############################################################################
17 # Subroutine: init()
18 ###############################################################################
19 # Initializes the template plugin.
20 ###############################################################################
21 4 ▶sub init {
Subroutine init: called CC=2 SCAR=7.0
Pod documented
22 4 my $self = shift;
23 4 $self->{'_DYNAMIC'} = 1;
24 4 ▶ $self->install_filter( $self->{'_ARGS'}->[0] || 'trac' );
Condition50%1/2
$self->{'_ARGS'}[0] || 'trac'
l!l
04
MC/DC0%0/1
$self->{'_ARGS'}[0] || 'trac'
$self->{'_ARGS'}[0]
Truth table50%1/2
A
A= $self->{'_ARGS'}[0]
Aresult
11
00
25 4 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 4 ▶sub filter {
Subroutine filter: called CC=1 SCAR=0.0
Pod documented
34 4 my ($self, $text, $args, $config) = @_;
35 4 my $parser = Text::Trac->new( %{$config} );
36 4 return $parser->parse( $text );
37 }
38  
39 2 1;
40  
41 =for stopwords WikiFormatting
42  
43 =head1 NAME
44  
45 Template::Plugin::Trac - Template::Toolkit filter for Text::Trac
46  
47 =head1 SYNOPSIS
48  
49 [% USE Trac %]
50 ...
51 [% FILTER trac %]
52 = Heading One =
53 == Heading Two ==
54 [% END %]
55 ...
56 [% text | trac %]
57  
58 =head1 DESCRIPTION
59  
60 C<Template::Plugin::Trac> is a plugin for C<Template::Toolkit>, which formats
61 your text using Trac's WikiFormatting style.
62  
63 =head1 METHODS
64  
65 =over
66  
67 =item init()
68  
69 Initializes the template plugin.
70  
71 =item filter($txt, $args, $config)
72  
73 Filters the given text, by running it through C<Text::Trac>.
74  
75 =back
76  
77 =head1 AUTHOR
78  
79 Graham TerMarsch <cpan@howlingfrog.com>
80  
81 =head1 COPYRIGHT
82  
83 Copyright (C) 2006-2007, Graham TerMarsch. All rights Reserved.
84  
85 This is free software; you can redistribute it and/or modify it under the same
86 terms as Perl itself.
87  
88 =head1 SEE ALSO
89  
90 =over
91  
92 =item L<Text::Trac>
93  
94 =item L<Template::Plugin::Filter>
95  
96 =back
97  
98 =cut
↑ Summary