F
Felix Smith
How would you go about removing all html tags from a Web page's source
code, except for links ? I've been successfully using the function
below to get rid of *all* html tags. But I need to keep links. Any
code you can post to help will be much appreciated.
Felix.
function I've been using:
sub html_to_ascii {
use HTML::TreeBuilder;
use HTML::FormatText;
$document = $_[0];
$html = HTML::TreeBuilder->new();
$html->parse($document);
$formatter = HTML::FormatText->new(leftmargin => 0, rightmargin => 0);
$return = $formatter->format($html);
return $return;
}
code, except for links ? I've been successfully using the function
below to get rid of *all* html tags. But I need to keep links. Any
code you can post to help will be much appreciated.
Felix.
function I've been using:
sub html_to_ascii {
use HTML::TreeBuilder;
use HTML::FormatText;
$document = $_[0];
$html = HTML::TreeBuilder->new();
$html->parse($document);
$formatter = HTML::FormatText->new(leftmargin => 0, rightmargin => 0);
$return = $formatter->format($html);
return $return;
}