html2text
Replaces HTML newlines and paragraphs with ASCII equivalents.
"<br>",
"<p>" and
"</p>" tags will be replaced with a "\n"" each,
"<br>" being replaced with a line break and
a "</p><p>" pair being replaced with
a blank line.
Also see the text2html filter.
Example
[filter html2text strip]
<p>
Perl is a lot of fun!
</p>
<p>
Interesting tricks with the language can be seen at: <br>
MJD's <a href="http://perl.plover.com/">plover.com</a>.
</p>
<p>
Programming is an art form.
</p>
[/filter]
|
Results in:
Perl is a lot of fun!
Interesting tricks with the language can be seen at:
MJD's <a href="http://perl.plover.com/">plover.com</a>.
Programming is an art form.
|
Source code
sub {
my $val = shift;
$val =~ s%\s*<(?:br\s*/?|/?p)>\s*%\n%gi;
return $val;
}
|