Skip Menu |
 

This queue is for tickets about the HTML-FormatText-WithLinks CPAN distribution.

Report information
The Basics
Id: 37636
Status: resolved
Priority: 0/
Queue: HTML-FormatText-WithLinks

People
Owner: struan [...] cpan.org
Requestors: janus [...] errornet.de
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.09
Fixed in: (no value)

Attachments
HTML-FormatText-WithLinks-multiparse.diff



Subject: Patch to reset internal links before parsing
Download (untitled) / with headers
text/plain 359b
Hi, if a HTML::FormatText::WithLinks object is used to parse multiple html chunks with links in it, the links from all chunks continuously sum up. The obvious solution is to clear the internal links before starting in the _parse() method. I've attached a fix plus a corresponding test case (shouldn't conflict wit h the previous patch i sent). Regards, Simon
Subject: HTML-FormatText-WithLinks-multiparse.diff
--- lib/HTML/FormatText/WithLinks.pm.orig Sat Jul 12 13:26:33 2008 +++ lib/HTML/FormatText/WithLinks.pm Sat Jul 12 13:28:31 2008 @@ -207,6 +207,9 @@ sub _parse { my $self = shift; my $tree = shift; + $self->{_link_track} = {}; + $self->{_links} = []; + unless ( $tree ) { $self->error( "HTML::TreeBuilder problem" . ( $! ? ": $!" : '' ) ); return undef; --- /dev/null Sat Jul 12 13:34:41 2008 +++ t/16_parse_multiple_times.t Sat Jul 12 13:33:39 2008 @@ -0,0 +1,54 @@ +# $Id$ + +use Test::More tests => 5; +use HTML::FormatText::WithLinks; + +my $html_link = new_html_link(); +my $html = new_html(); +my $f = HTML::FormatText::WithLinks->new( leftmargin => 0 ); + +ok($f, 'object created'); + +my $text = $f->parse($html_link); + +my $correct_text = qq!This is a mail of some sort with a [1]link. + + + +1. http://example.com/ + + +!; + +ok($text, 'html formatted'); +is($text, $correct_text, 'html correctly formatted'); + +$text = $f->parse($html); + +ok($text, 'html formatted'); +is($text, "\n\nThis is a mail of some sort\n\n", + 'html correctly formatted with no left margin'); + +sub new_html_link { +return <<'HTML'; +<html> +<body> +<p> +This is a mail of some sort with a <a href="http://example.com/">link</a>. +</p> +</body> +</html> +HTML +} + +sub new_html { +return <<'HTML'; +<html> +<body> +<p> +This is a mail of some sort +</p> +</body> +</html> +HTML +}
Hi, this is also in the 0.10 release Thanks Struan
From: janus [...] errornet.de
Download (untitled) / with headers
text/plain 237b
On Mon Jul 21 17:10:22 2008, STRUAN wrote: Show quoted text
> Hi, > > this is also in the 0.10 release > > Thanks > > Struan
Hi, it still seems to missing in 0.10. Would be cool if you could check again - the patch should still apply. Regards, Simon
Subject: Re: [rt.cpan.org #37636] Patch to reset internal links before parsing
Date: Fri, 1 Aug 2008 14:41:03 +0100
To: Simon Dassow via RT <bug-HTML-FormatText-WithLinks [...] rt.cpan.org>
From: Struan Donald <struan [...] exo.org.uk>
Download (untitled) / with headers
text/plain 450b
* at 30/07 05:36 -0400 Simon Dassow via RT said: Show quoted text
> Queue: HTML-FormatText-WithLinks > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=37636 > > > On Mon Jul 21 17:10:22 2008, STRUAN wrote:
> > Hi, > > > > this is also in the 0.10 release > > > > Thanks > > > > Struan
> > Hi, > it still seems to missing in 0.10. > Would be cool if you could check again - the patch should still apply.
Yup, this too is actually in 0.11. Struan
Closing bug.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.