|Subject:||leading space when body no <p>|
|Date:||Sat, 07 Sep 2013 11:52:16 +1000|
|To:||bug-HTML-Format [...] rt.cpan.org|
|From:||Kevin Ryde <user42 [...] zip.com.au>|
With recent debian i386 perl 5.14.2 and HTML::FormatText 2.10, the program foo.pl below prints Formatted to: " This is some text. " where I hoped that it would not have the leading space, so instead Formatted to: "This is some text. " The latter is what you get if there's a <p> in the html (with or without whitespace between it and the text). I struck this when applying HTML::FormatText to some sloppy html which lacked proper <p> paragraph around its text. It'd be good if HTML::FormatText was forgiving of that sort of thing.
#!/usr/bin/perl -w use strict; use HTML::FormatText; my $html = " <html> <body> This is some text. </body> </html>"; my $str = HTML::FormatText->format_string ($html, leftmargin => 0, rightmargin => 40); print "Formatted to: \"$str\"\n"; exit 0;