Re: bug report to HTML::FormatText

Andreas Koenig (k@anna.mind.de)
Tue, 26 Sep 1995 12:38:10 +0100


>>>>> "Gisle" == Gisle Aas <aas@oslonett.no> writes:

    Gisle> How about changing line 104 to:

    Gisle>     $pre =~ s/\n/\n$indent/g;


Yupp, that's it. Thanks!

    Gisle> This will sometimes add space before \n but this is a less
    Gisle> serious bug I think.  If you set the default left margin to
    Gisle> 0 (instead of 3) then no additional space will be inserted.

I don't quite see, how I can do this without changing the source:

perl -e 'use HTML::Parse;                          
require HTML::FormatText;        
$html = parse_htmlfile($ARGV[0]);
$formatter = new HTML::FormatText;                   
$formatter->{lm}=0;
print $formatter->format($html);
' 00whois.html

still gives me 3 spaces left margin. This would work, if
HTML::Formatter would be changed as in the patch below, but I don't
know what it will break:

--- /usr/sources/perl/module/lwp/libwww-perl-5b5/lib/HTML/Formatter.pm        Sat Sep 16 10:29:12 1995
+++ Formatter.pm        Tue Sep 26 12:31:02 1995
@@ -40,13 +40,16 @@
 sub new
 {
     my $class = shift;
-    bless { }, $class;
+    my $hash = {};
+    bless $hash, $class;
+    $hash->begin();
+    $hash;
 }
 
 sub format
 {
     my($self, $html) = @_;
-    $self->begin();
+#    $self->begin();
     $html->traverse(
        sub {
            my($node, $start, $depth) = @_;


    Gisle> --Gisle


andreas