Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
HTML::TokeParser::Simple 2.1 has just been uploaded to the CPAN. A friend asked why I didn't make one of the private methods public and I couldn't see why not, so I did. The $token->rewrite_tag method automatically lowercases the tag name, attribute names, and properly quotes values. It ignores non tags.
# <body alink=#0000ff
# BGCOLOR=#ffffff class='none'>
$token->rewrite_tag;
print $token->as_is;
# <body alink="#0000ff" bgcolor="#ffffff" class="none">
It will put the entire tag on one line, though.
Thus, to clean up an entire doc:
while (my $token = $parser->get_token) {
$token->rewrite_tag; # no tag testing required
print $token->as_is;
}
Can't stop tweaking 0 Comments More | Login | Reply /