Hello Yves,
Here are some comments.
On Wed, Nov 24, 2004 at 05:37:31PM +0000, Yves Rutschle wrote:
@@ -97,14 +99,36 @@
# $encoded = HTML::Entities::encode($a);
# $decoded = HTML::Entities::decode($a);
#print STDERR $token->[0];
- $self->pushline( " ".$self->translate($text,
+ $self->pushline( $self->translate($text,
"FIXME:0",
(scalar @type ? $type[scalar @type-1]:
"NOTYPE")
- )." " );
+ ),
+ 'wrap' => 1
+ );
I don't know why the string was surrounded by spaces. Do you think it may
be important? Is it related to the correction of the trim function?
(in the later case, just forget about the first question)
next NEXT;
} elsif ($token->[0] eq 'S') {
push @type,$token->[1];
- $self->pushline( get_tag( $token ) );
+ my $text = get_tag( $token );
+ if ( $token->[1] eq 'img' ) {
+ my %foo = %{$token->[2]};
+ my $title = (exists
$foo{"title"}?$foo{"title"}:"")."\n";
+ my $alt = (exists
$foo{"alt"}?$foo{"alt"}:"")."\n";
+ for my $attr ($title, $alt) {
+ if (defined $attr) {
+ $attr = trim($attr),
+ my $translated = $self->translate(
+ $attr,
+ "FIXME:0",
+ (scalar @type?
+ $type[scalar @type-1]:
+ "NOTYPE")
+ );
The type could be set to either "title" or "alt".
+ $attr = quotemeta $attr;
+ $text =~ s/$attr/$translated/;
Is it possible to only
change the attribute?
(change it in the %foo hash, and reconstruct $text afterwards)
I'm worried about something like:
<img
src="http://nekral.homelinux.net/foo" title="home"
alt="nekral">
(and %foo could be renamed %attributes, or something like that)
Regards,
--
Nekral