|
Lines 52-58
sub peep_token {
Link Here
|
| 52 |
#signature build_tokens( self, filename) |
52 |
#signature build_tokens( self, filename) |
| 53 |
sub build_tokens { |
53 |
sub build_tokens { |
| 54 |
my ( $self, $filename ) = @_; |
54 |
my ( $self, $filename ) = @_; |
| 55 |
$self->{filename} = $filename; |
55 |
$self->{filename} = $filename; |
|
|
56 |
$self->{current_tag} = ''; |
| 56 |
$self->handler( start => "start", "self, line, tagname, attr, text" ) |
57 |
$self->handler( start => "start", "self, line, tagname, attr, text" ) |
| 57 |
; #signature is start( self, linenumber, tagname, hash of attributes, original text ) |
58 |
; #signature is start( self, linenumber, tagname, hash of attributes, original text ) |
| 58 |
$self->handler( text => "text", "self, line, text, is_cdata" ) |
59 |
$self->handler( text => "text", "self, line, text, is_cdata" ) |
|
Lines 79-84
sub text {
Link Here
|
| 79 |
my $work = shift; # original text |
80 |
my $work = shift; # original text |
| 80 |
my $is_cdata = shift; |
81 |
my $is_cdata = shift; |
| 81 |
|
82 |
|
|
|
83 |
if ( $self->{current_tag} ne 'script' && $self->{current_tag} ne 'style' && $is_cdata ) { |
| 84 |
$work = "<![CDATA[$work]]>"; |
| 85 |
} |
| 86 |
|
| 82 |
# If there is a split template toolkit tag |
87 |
# If there is a split template toolkit tag |
| 83 |
if ( $work =~ m/^(?:(?!\[%).)*?%\]/s ) { |
88 |
if ( $work =~ m/^(?:(?!\[%).)*?%\]/s ) { |
| 84 |
my @strings = ($&); |
89 |
my @strings = ($&); |
|
Lines 191-196
sub start {
Link Here
|
| 191 |
my $t = C4::TmplToken->new( $text, C4::TmplTokenType::TAG, $line, $self->{filename} ); |
196 |
my $t = C4::TmplToken->new( $text, C4::TmplTokenType::TAG, $line, $self->{filename} ); |
| 192 |
my %attr; |
197 |
my %attr; |
| 193 |
|
198 |
|
|
|
199 |
$self->{current_tag} = $tag; |
| 200 |
|
| 194 |
# tags seem to be uses in an 'interesting' way elsewhere.. |
201 |
# tags seem to be uses in an 'interesting' way elsewhere.. |
| 195 |
for my $key (%$hash) { |
202 |
for my $key (%$hash) { |
| 196 |
next unless defined $hash->{$key}; |
203 |
next unless defined $hash->{$key}; |
|
Lines 216-221
sub end {
Link Here
|
| 216 |
my $t = C4::TmplToken->new( $text, C4::TmplTokenType::TAG, $line, $self->{filename} ); |
223 |
my $t = C4::TmplToken->new( $text, C4::TmplTokenType::TAG, $line, $self->{filename} ); |
| 217 |
my %attr; |
224 |
my %attr; |
| 218 |
|
225 |
|
|
|
226 |
$self->{current_tag} = ''; |
| 227 |
|
| 219 |
# tags seem to be uses in an 'interesting' way elsewhere.. |
228 |
# tags seem to be uses in an 'interesting' way elsewhere.. |
| 220 |
for my $key (%$hash) { |
229 |
for my $key (%$hash) { |
| 221 |
next unless defined $hash->{$key}; |
230 |
next unless defined $hash->{$key}; |
| 222 |
- |
|
|