in reply to Removing font tags using HTML::TreeBuilder
#!/usr/bin/perl -- use warnings; use strict; use HTML::TreeBuilder; my $html = <<'__HTML__'; <p>and a <font face="Verdana">one <a href="link.html">two</a> three</f +ont> four</p> <p>another |<font name="one">one</font>| and another |<font name="two" +> one </font>|</p> __HTML__ { my $h = HTML::TreeBuilder->new_from_content($html); print $h->as_HTML('<>&',' ',{}), "\n"; $h->look_down(_tag => q{font}, sub{ $_[0]->replace_with_content( $_[0]->content_refs_list ); return; }, ); print $h->as_HTML('<>&',' ',{}), "\n"; } __END__ <html> <head> </head> <body> <p>and a <font face="Verdana">one <a href="link.html">two</a> three< +/font> four</p> <p>another |<font name="one">one</font>| and another |<font name="tw +o"> one </font>|</p> </body> </html> <html> <head> </head> <body> <p>and a one <a href="link.html">two</a> three four</p> <p>another |one| and another | one |</p> </body> </html>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Removing font tags using HTML::TreeBuilder
by Anonymous Monk on Oct 27, 2008 at 10:06 UTC |