|
Lines 21-26
use base qw(HTML::Parser);
Link Here
|
| 21 |
use C4::TmplToken; |
21 |
use C4::TmplToken; |
| 22 |
use strict; |
22 |
use strict; |
| 23 |
use warnings; |
23 |
use warnings; |
|
|
24 |
use List::MoreUtils qw( any ); |
| 24 |
|
25 |
|
| 25 |
#seems to be handled post tokenizer |
26 |
#seems to be handled post tokenizer |
| 26 |
##hash where key is tag we are interested in and the value is a hash of the attributes we want |
27 |
##hash where key is tag we are interested in and the value is a hash of the attributes we want |
|
Lines 31-36
use warnings;
Link Here
|
| 31 |
#tokens found so far (used like a stack) |
32 |
#tokens found so far (used like a stack) |
| 32 |
my ( @tokens ); |
33 |
my ( @tokens ); |
| 33 |
|
34 |
|
|
|
35 |
my $do_not_translate; |
| 36 |
my @do_not_translate_tags = qw( xsl:attribute ); |
| 37 |
|
| 34 |
#shiftnext token or undef |
38 |
#shiftnext token or undef |
| 35 |
sub next_token{ |
39 |
sub next_token{ |
| 36 |
return shift @tokens; |
40 |
return shift @tokens; |
|
Lines 72-78
sub text{
Link Here
|
| 72 |
my $self = shift; |
76 |
my $self = shift; |
| 73 |
my $line = shift; |
77 |
my $line = shift; |
| 74 |
my $work = shift; # original text |
78 |
my $work = shift; # original text |
| 75 |
my $is_cdata = shift; |
79 |
my $is_cdata = shift || $do_not_translate; |
| 76 |
while($work){ |
80 |
while($work){ |
| 77 |
# if there is a template_toolkit tag |
81 |
# if there is a template_toolkit tag |
| 78 |
if( $work =~ m/\[%.*?%\]/ ){ |
82 |
if( $work =~ m/\[%.*?%\]/ ){ |
|
Lines 144-149
sub start{
Link Here
|
| 144 |
my $text = shift; #original text |
148 |
my $text = shift; #original text |
| 145 |
my $t = C4::TmplToken->new( $text, C4::TmplTokenType::TAG, $line, $self->{filename}); |
149 |
my $t = C4::TmplToken->new( $text, C4::TmplTokenType::TAG, $line, $self->{filename}); |
| 146 |
my %attr; |
150 |
my %attr; |
|
|
151 |
$do_not_translate += 1 if any { $_ eq $tag } @do_not_translate_tags; |
| 147 |
# tags seem to be uses in an 'interesting' way elsewhere.. |
152 |
# tags seem to be uses in an 'interesting' way elsewhere.. |
| 148 |
for my $key( %$hash ) { |
153 |
for my $key( %$hash ) { |
| 149 |
next unless defined $hash->{$key}; |
154 |
next unless defined $hash->{$key}; |
|
Lines 168-173
sub end{
Link Here
|
| 168 |
# what format should this be in? |
173 |
# what format should this be in? |
| 169 |
my $t = C4::TmplToken->new( $text, C4::TmplTokenType::TAG, $line, $self->{filename} ); |
174 |
my $t = C4::TmplToken->new( $text, C4::TmplTokenType::TAG, $line, $self->{filename} ); |
| 170 |
my %attr; |
175 |
my %attr; |
|
|
176 |
$do_not_translate -= 1 if any { "/$_" eq $tag } @do_not_translate_tags; |
| 171 |
# tags seem to be uses in an 'interesting' way elsewhere.. |
177 |
# tags seem to be uses in an 'interesting' way elsewhere.. |
| 172 |
for my $key( %$hash ) { |
178 |
for my $key( %$hash ) { |
| 173 |
next unless defined $hash->{$key}; |
179 |
next unless defined $hash->{$key}; |
| 174 |
- |
|
|