Subject: | Example code for TT filter doesn't work correctly |
Date: | Mon, 13 Jul 2009 12:59:28 +0100 |
To: | bug-HTML-Truncate [...] rt.cpan.org |
From: | Tomas Doran <bobtfish [...] bobtfish.net> |
Patch for the docs attached.
Cheers
t0m
diff -ur HTML-Truncate-0.19/lib/HTML/Truncate.pm HTML-Truncate-0.19.t0m/lib/HTML/Truncate.pm
--- HTML-Truncate-0.19/lib/HTML/Truncate.pm 2009-05-13 06:04:07.000000000 +0100
+++ HTML-Truncate-0.19.t0m/lib/HTML/Truncate.pm 2009-07-13 12:58:27.000000000 +0100
@@ -648,10 +648,10 @@
my ( $context, $len, $ellipsis ) = @_;
$len = 32 unless $len;
$ellipsis = chr(8230) unless defined $ellipsis;
- my $html = shift || return '';
my $ht = HTML::Truncate->new();
$ht->add_skip_tags(qw( img ));
return sub {
+ my $html = shift || return '';
return $ht->truncate( $html, $len, $ellipsis );
}
}