line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Template::Extension::SLASH_VAR; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = "0.24"; |
4
|
0
|
|
|
0
|
0
|
0
|
sub Version { $VERSION; } |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
85
|
|
7
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
603
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my %fields_parent = ( |
12
|
|
|
|
|
|
|
ecp_compatibility_mode => 0, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $re_var = q{ |
17
|
|
|
|
|
|
|
((<\s* # first < |
18
|
|
|
|
|
|
|
[Tt][Mm][Pp][Ll]_[Vv][Aa][Rr] # interesting TMPL_VAR tag only |
19
|
|
|
|
|
|
|
(?:.*?)>) # this is H:T standard tag |
20
|
|
|
|
|
|
|
((?:.*?) # delete alla after here |
21
|
|
|
|
|
|
|
<\s*\/ # if there is the tag |
22
|
|
|
|
|
|
|
[Tt][Mm][Pp][Ll]_[Vv][Aa][Rr] |
23
|
|
|
|
|
|
|
\s*>)) |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub init { |
27
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
28
|
2
|
|
|
|
|
11
|
while (my ($key,$val) = each(%fields_parent)) { |
29
|
2
|
|
33
|
|
|
21
|
$self->{$key} = $self->{$key} || $val; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub push_filter { |
35
|
4
|
|
|
4
|
0
|
7
|
my $self = shift; |
36
|
4
|
|
|
|
|
8
|
push @{$self->{filter_internal}},@{&_get_filter($self)}; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
12
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _get_filter { |
40
|
4
|
|
|
4
|
|
6
|
my $self = shift; |
41
|
4
|
|
|
|
|
6
|
my @ret ; |
42
|
|
|
|
|
|
|
# Sorry for this :->. I've an e-commerce project called ecp that |
43
|
|
|
|
|
|
|
# use a modified vanguard compatibility mode %%...%% |
44
|
|
|
|
|
|
|
# This disable vanguard_compatibility_mode |
45
|
4
|
50
|
|
|
|
13
|
if ($self->{ecp_compatibility_mode}) { |
46
|
0
|
|
|
|
|
0
|
push @ret,\&_ecp_vanguard_syntax ; |
47
|
0
|
|
|
|
|
0
|
$self->{options}->{vanguard_compatibility_mode}=0; |
48
|
|
|
|
|
|
|
} |
49
|
4
|
|
|
|
|
9
|
push @ret,\&_slash_var; |
50
|
4
|
|
|
|
|
16
|
return \@ret; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# funzione filtro per aggiungere il tag |
55
|
|
|
|
|
|
|
# da tenere fintanto che la nostra patch non sia inserita nella |
56
|
|
|
|
|
|
|
# distribuzione standard del modulo |
57
|
|
|
|
|
|
|
sub _slash_var { |
58
|
8
|
|
|
8
|
|
912
|
my $template = shift; |
59
|
8
|
|
|
|
|
165
|
while ($$template =~/(?=$re_var)/sgx) { |
60
|
9
|
|
|
|
|
25
|
my $two = $2; |
61
|
9
|
100
|
|
|
|
150
|
if ($3 !~/(?:$re_var)/sx) { |
62
|
8
|
|
|
|
|
156
|
$$template =~s{\Q$1}{$two}s; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
8
|
|
|
|
|
23
|
return $$template; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _ecp_vanguard_syntax { |
69
|
0
|
|
|
0
|
|
|
my $template = shift; |
70
|
0
|
0
|
|
|
|
|
if ($$template =~/%%([-\w\/\.+]+)%%/) { |
71
|
0
|
|
|
|
|
|
$$template =~ s/%%([-\w\/\.+]+)%%//g; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |