line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
###############################################################################
|
2
|
|
|
|
|
|
|
#unparsed.pm
|
3
|
|
|
|
|
|
|
#Last Change: 2009-01-16
|
4
|
|
|
|
|
|
|
#Copyright (c) 2009 Marc-Seabstian "Maluku" Lucksch
|
5
|
|
|
|
|
|
|
#Version 0.2
|
6
|
|
|
|
|
|
|
####################
|
7
|
|
|
|
|
|
|
#This file is an addon to the Dotiac::DTL project.
|
8
|
|
|
|
|
|
|
#http://search.cpan.org/perldoc?Dotiac::DTL
|
9
|
|
|
|
|
|
|
#
|
10
|
|
|
|
|
|
|
#unparsed.pm is published under the terms of the MIT license, which basically
|
11
|
|
|
|
|
|
|
#means "Do with it whatever you want". For more information, see the
|
12
|
|
|
|
|
|
|
#license.txt file that should be enclosed with libsofu distributions. A copy of
|
13
|
|
|
|
|
|
|
#the license is (at the time of writing) also available at
|
14
|
|
|
|
|
|
|
#http://www.opensource.org/licenses/mit-license.php .
|
15
|
|
|
|
|
|
|
###############################################################################
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Dotiac::DTL::Tag::unparsed;
|
19
|
1
|
|
|
1
|
|
7
|
use base qw/Dotiac::DTL::Tag/;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
86
|
|
20
|
1
|
|
|
1
|
|
6
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
21
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1611
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION=0.2;
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new {
|
26
|
5
|
|
|
5
|
1
|
262
|
my $class=shift;
|
27
|
5
|
|
|
|
|
14
|
my $self={p=>shift()};
|
28
|
5
|
|
|
|
|
5
|
my $name=shift;
|
29
|
5
|
|
|
|
|
8
|
my $obj=shift;
|
30
|
5
|
|
|
|
|
7
|
my $data=shift;
|
31
|
5
|
|
|
|
|
5
|
my $pos=shift;
|
32
|
5
|
|
|
|
|
8
|
my $found="";
|
33
|
5
|
|
100
|
|
|
26
|
my %name=Dotiac::DTL::get_variables(($name || ""),"as");
|
34
|
5
|
100
|
66
|
|
|
339
|
$self->{filters}=[split /\|/,$name{""}->[0]] if $name{""} and $name{""}->[0];
|
35
|
5
|
100
|
66
|
|
|
29
|
$self->{var}=$name{"as"}->[0] if $name{"as"} and $name{"as"}->[0];
|
36
|
5
|
|
|
|
|
18
|
$self->{content}=$obj->unparsed($data,$pos,\$found,"unparsed","endunparsed");
|
37
|
5
|
|
|
|
|
278
|
bless $self,$class;
|
38
|
5
|
|
|
|
|
19
|
return $self;
|
39
|
|
|
|
|
|
|
}
|
40
|
|
|
|
|
|
|
sub print {
|
41
|
5
|
|
|
5
|
1
|
161
|
my $self=shift;
|
42
|
5
|
|
|
|
|
25
|
print $self->{p};
|
43
|
5
|
|
|
|
|
7
|
my $vars=shift;
|
44
|
5
|
|
|
|
|
8
|
my $escape=shift;
|
45
|
5
|
|
|
|
|
9
|
my $c=$self->{content};
|
46
|
5
|
100
|
|
|
|
13
|
$c=Dotiac::DTL::apply_filters($c,$vars,0,@{$self->{filters}})->string() if $self->{filters};
|
|
2
|
|
|
|
|
8
|
|
47
|
5
|
100
|
|
|
|
418
|
if ($self->{var}) {
|
48
|
2
|
|
|
|
|
6
|
$vars->{$self->{var}}=$c;
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
else {
|
51
|
3
|
|
|
|
|
4
|
print $c;
|
52
|
|
|
|
|
|
|
}
|
53
|
5
|
|
|
|
|
28
|
$self->{n}->print($vars,$escape,@_);
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
sub string {
|
56
|
5
|
|
|
5
|
1
|
147
|
my $self=shift;
|
57
|
5
|
|
|
|
|
5
|
my $vars=shift;
|
58
|
5
|
|
|
|
|
7
|
my $escape=shift;
|
59
|
5
|
|
|
|
|
11
|
my $c=$self->{content};
|
60
|
5
|
100
|
|
|
|
11
|
$c=Dotiac::DTL::apply_filters($c,$vars,0,@{$self->{filters}})->string() if $self->{filters};
|
|
2
|
|
|
|
|
19
|
|
61
|
5
|
100
|
|
|
|
424
|
if ($self->{var}) {
|
62
|
2
|
|
|
|
|
6
|
$vars->{$self->{var}}=$c;
|
63
|
2
|
|
|
|
|
14
|
return $self->{p}.$self->{n}->string($vars,$escape,@_);
|
64
|
|
|
|
|
|
|
}
|
65
|
|
|
|
|
|
|
else {
|
66
|
3
|
|
|
|
|
18
|
return $self->{p}.$c.$self->{n}->string($vars,$escape,@_);
|
67
|
|
|
|
|
|
|
}
|
68
|
|
|
|
|
|
|
}
|
69
|
|
|
|
|
|
|
sub perl {
|
70
|
5
|
|
|
5
|
1
|
753
|
my $self=shift;
|
71
|
5
|
|
|
|
|
8
|
my $fh=shift;
|
72
|
5
|
|
|
|
|
6
|
my $id=shift;
|
73
|
5
|
|
|
|
|
31
|
$self->SUPER::perl($fh,$id,@_);
|
74
|
5
|
|
|
|
|
255
|
print $fh "my ";
|
75
|
5
|
|
|
|
|
29
|
print $fh (Data::Dumper->Dump([$self->{content}],["\$content$id"]));
|
76
|
5
|
100
|
|
|
|
211
|
if ($self->{filters}) {
|
77
|
2
|
|
|
|
|
4
|
print $fh "my ";
|
78
|
2
|
|
|
|
|
12
|
print $fh (Data::Dumper->Dump([$self->{filters}],["\$filters$id"]));
|
79
|
|
|
|
|
|
|
}
|
80
|
5
|
100
|
|
|
|
118
|
if ($self->{var}) {
|
81
|
2
|
|
|
|
|
3
|
print $fh "my ";
|
82
|
2
|
|
|
|
|
12
|
print $fh (Data::Dumper->Dump([$self->{var}],["\$var$id"]));
|
83
|
|
|
|
|
|
|
}
|
84
|
5
|
|
|
|
|
184
|
return $self->{n}->perl($fh,$id+1,@_)
|
85
|
|
|
|
|
|
|
}
|
86
|
|
|
|
|
|
|
sub perlinit {
|
87
|
5
|
|
|
5
|
1
|
342
|
my $self=shift;
|
88
|
5
|
|
|
|
|
7
|
my $fh=shift;
|
89
|
5
|
|
|
|
|
8
|
my $id=shift;
|
90
|
5
|
|
|
|
|
30
|
return $self->{n}->perlinit($fh,$id+1,@_)
|
91
|
|
|
|
|
|
|
}
|
92
|
|
|
|
|
|
|
sub perlprint {
|
93
|
5
|
|
|
5
|
1
|
188
|
my $self=shift;
|
94
|
5
|
|
|
|
|
7
|
my $fh=shift;
|
95
|
5
|
|
|
|
|
6
|
my $id=shift;
|
96
|
5
|
|
|
|
|
7
|
my $level=shift;
|
97
|
5
|
|
|
|
|
29
|
$self->SUPER::perlprint($fh,$id,$level,@_);
|
98
|
5
|
100
|
|
|
|
69
|
if ($self->{var}) {
|
|
|
100
|
|
|
|
|
|
99
|
2
|
100
|
|
|
|
7
|
if ($self->{filters}) {
|
100
|
1
|
|
|
|
|
13
|
print $fh "\t" x $level,"\$vars->{\$var$id}=Dotiac::DTL::apply_filters(\$content$id,\$vars,0,\@{\$filters$id},\@_)->string();\n";
|
101
|
|
|
|
|
|
|
}
|
102
|
|
|
|
|
|
|
else {
|
103
|
1
|
|
|
|
|
4
|
print $fh "\t" x $level,"\$vars->{\$var$id}=\$content$id;\n";
|
104
|
|
|
|
|
|
|
}
|
105
|
|
|
|
|
|
|
}
|
106
|
|
|
|
|
|
|
elsif ($self->{filters}) {
|
107
|
1
|
|
|
|
|
5
|
print $fh "\t" x $level,"print Dotiac::DTL::apply_filters(\$content$id,\$vars,0,\@{\$filters$id},\@_)->string();\n";
|
108
|
|
|
|
|
|
|
}
|
109
|
|
|
|
|
|
|
else {
|
110
|
2
|
|
|
|
|
11
|
print $fh "\t" x $level,"print \$content$id;\n";
|
111
|
|
|
|
|
|
|
}
|
112
|
5
|
|
|
|
|
49
|
return $self->{n}->perlprint($fh,$id+1,$level,@_);
|
113
|
|
|
|
|
|
|
}
|
114
|
|
|
|
|
|
|
sub perlstring {
|
115
|
5
|
|
|
5
|
1
|
118
|
my $self=shift;
|
116
|
5
|
|
|
|
|
6
|
my $fh=shift;
|
117
|
5
|
|
|
|
|
5
|
my $id=shift;
|
118
|
5
|
|
|
|
|
6
|
my $level=shift;
|
119
|
5
|
|
|
|
|
20
|
$self->SUPER::perlstring($fh,$id,$level,@_);
|
120
|
5
|
100
|
|
|
|
45
|
if ($self->{var}) {
|
|
|
100
|
|
|
|
|
|
121
|
2
|
100
|
|
|
|
7
|
if ($self->{filters}) {
|
122
|
1
|
|
|
|
|
10
|
print $fh "\t" x $level,"\$vars->{\$var$id}=Dotiac::DTL::apply_filters(\$content$id,\$vars,0,\@{\$filters$id},\@_)->string();\n";
|
123
|
|
|
|
|
|
|
}
|
124
|
|
|
|
|
|
|
else {
|
125
|
1
|
|
|
|
|
5
|
print $fh "\t" x $level,"\$vars->{\$var$id}=\$content$id;\n";
|
126
|
|
|
|
|
|
|
}
|
127
|
|
|
|
|
|
|
}
|
128
|
|
|
|
|
|
|
elsif ($self->{filters}) {
|
129
|
1
|
|
|
|
|
5
|
print $fh "\t" x $level,"\$r.=Dotiac::DTL::apply_filters(\$content$id,\$vars,0,\@{\$filters$id},\@_)->string();\n";
|
130
|
|
|
|
|
|
|
}
|
131
|
|
|
|
|
|
|
else {
|
132
|
2
|
|
|
|
|
7
|
print $fh "\t" x $level,"\$r.=\$content$id;\n";
|
133
|
|
|
|
|
|
|
}
|
134
|
5
|
|
|
|
|
49
|
return $self->{n}->perlstring($fh,$id+1,$level,@_);
|
135
|
|
|
|
|
|
|
}
|
136
|
|
|
|
|
|
|
sub perleval {
|
137
|
5
|
|
|
5
|
1
|
104
|
my $self=shift;
|
138
|
5
|
|
|
|
|
14
|
my $fh=shift;
|
139
|
5
|
|
|
|
|
5
|
my $id=shift;
|
140
|
5
|
|
|
|
|
6
|
my $level=shift;
|
141
|
5
|
100
|
|
|
|
21
|
if ($self->{var}) {
|
142
|
2
|
100
|
|
|
|
8
|
if ($self->{filters}) {
|
143
|
1
|
|
|
|
|
5
|
print $fh "\t" x $level,"\$vars->{\$var$id}=Dotiac::DTL::apply_filters(\$content$id,\$vars,0,\@{\$filters$id},\@_)->string();\n";
|
144
|
|
|
|
|
|
|
}
|
145
|
|
|
|
|
|
|
else {
|
146
|
1
|
|
|
|
|
4
|
print $fh "\t" x $level,"\$vars->{\$var$id}=\$content$id;\n";
|
147
|
|
|
|
|
|
|
}
|
148
|
|
|
|
|
|
|
}
|
149
|
5
|
|
|
|
|
25
|
$self->{n}->perleval($fh,$id+1,$level,@_);
|
150
|
|
|
|
|
|
|
}
|
151
|
|
|
|
|
|
|
sub perlcount {
|
152
|
0
|
|
|
0
|
1
|
0
|
my $self=shift;
|
153
|
0
|
|
|
|
|
0
|
my $id=shift;
|
154
|
0
|
|
|
|
|
0
|
return $self->{n}->perlcount($id+1);
|
155
|
|
|
|
|
|
|
}
|
156
|
|
|
|
|
|
|
sub next {
|
157
|
5
|
|
|
5
|
1
|
265
|
my $self=shift;
|
158
|
5
|
|
|
|
|
16
|
$self->{n}=shift;
|
159
|
|
|
|
|
|
|
}
|
160
|
|
|
|
|
|
|
sub eval {
|
161
|
0
|
|
|
0
|
1
|
|
my $self=shift;
|
162
|
0
|
|
|
|
|
|
my $vars=shift;
|
163
|
0
|
0
|
|
|
|
|
if ($self->{var}) {
|
164
|
0
|
|
|
|
|
|
my $c=$self->{content};
|
165
|
0
|
0
|
|
|
|
|
$c=Dotiac::DTL::apply_filters($c,$vars,0,@{$self->{filters}})->string() if $self->{filters};
|
|
0
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
|
$vars->{$self->{var}}=$c;
|
167
|
|
|
|
|
|
|
}
|
168
|
0
|
|
|
|
|
|
$self->{n}->eval($vars,@_);
|
169
|
|
|
|
|
|
|
}
|
170
|
|
|
|
|
|
|
1;
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
__END__
|