For more information... RTFM!
NAVIGATION
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

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;
}

Category:  Filters
Last modified by: Kevin Walsh
Modification date: Monday 26 February 2007 at 11:45 AM (EST)
Home  |  Legal nonsense  |  Privacy policy  |  Contact us