line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=head1 NAME |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
Templer::Plugin::Strict - A XML-like strict syntax for templates tags. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=cut |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 DESCRIPTION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
This class implements a layout template filter plugin for C which |
11
|
|
|
|
|
|
|
allows empty-element template tags to be written as in XML. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
This allows the following syntax |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=over |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=item C<> |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=item C<> |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=item C<> |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=back |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 LICENSE |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it |
30
|
|
|
|
|
|
|
under the terms of either: |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
a) the GNU General Public License as published by the Free Software |
33
|
|
|
|
|
|
|
Foundation; either version 2, or (at your option) any later version, |
34
|
|
|
|
|
|
|
or |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
b) the Perl "Artistic License". |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 AUTHOR |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Bruno Beaufils |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Copyright (C) 2015 Bruno Beaufils . |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This library is free software. You can modify and or distribute it under |
51
|
|
|
|
|
|
|
the same terms as Perl itself. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 METHODS |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
11
|
|
|
11
|
|
5177
|
use strict; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
264
|
|
61
|
11
|
|
|
11
|
|
43
|
use warnings; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
2243
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
package Templer::Plugin::Strict; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 new |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Constructor. No arguments are supported/expected. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub new |
74
|
|
|
|
|
|
|
{ |
75
|
3
|
|
|
3
|
1
|
6
|
my ( $proto, %supplied ) = (@_); |
76
|
3
|
|
33
|
|
|
9
|
my $class = ref($proto) || $proto; |
77
|
|
|
|
|
|
|
|
78
|
3
|
|
|
|
|
5
|
my $self = {}; |
79
|
3
|
|
|
|
|
5
|
bless( $self, $class ); |
80
|
3
|
|
|
|
|
5
|
return $self; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 available |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This plugin is always available. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub available |
91
|
|
|
|
|
|
|
{ |
92
|
1
|
|
|
1
|
1
|
10
|
return 1; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 filter |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Filter the given template. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub filter |
103
|
|
|
|
|
|
|
{ |
104
|
3
|
|
|
3
|
1
|
5
|
my ( $self, $str ) = (@_); |
105
|
|
|
|
|
|
|
|
106
|
3
|
|
|
|
|
32
|
$str =~ s{\/]*)/\>}{}ig; |
107
|
3
|
|
|
|
|
13
|
$str =~ s{\/]*)/\>}{}ig; |
108
|
3
|
|
|
|
|
13
|
$str =~ s{\}{}ig; |
109
|
|
|
|
|
|
|
|
110
|
3
|
|
|
|
|
8
|
return $str; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Templer::Plugin::Factory->new() |
114
|
|
|
|
|
|
|
->register_filter( "strict", "Templer::Plugin::Strict" ); |