in reply to Stripping font "face" values from font tags
Fish.
use HTML::TokeParser (); my %verb = ( S => 4, E => 2, T => 1, C => 1, D => 1, PI => 2 ); my $p = HTML::TokeParser->new( "foo.html" ) or die "can't open foo.html: $!\n"; while( my $t = $p->get_token ) { if( $t->[0] eq 'S' and $t->[1] eq 'font' ) { my $attr = $t->[2]; delete $attr->{face}; print "<font ", join( " ", map { qq{$_="$attr->{$_}"} } keys %{$attr} ), ">"; } else { ## print verbatim . . . print $t->[ $verb{ $t->[0] } ] } } exit 0; __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Stripping font "face" values from font tags
by Ovid (Cardinal) on May 28, 2003 at 16:41 UTC |