Skip Menu |
 

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

Report information
The Basics
Id: 69013
Status: new
Priority: 0/
Queue: HTML-Truncate

People
Owner: Nobody in particular
Requestors: msheppard [...] funnelback.com
Cc:
AdminCc:

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



Subject: Addition of support for breaking point characters other than space
Date: Wed, 22 Jun 2011 17:27:24 +1000
To: bug-html-truncate [...] rt.cpan.org
From: Matthew Sheppard <msheppard [...] funnelback.com>
Download (untitled) / with headers
text/plain 1.1k
Hi, I had the need to break on characters other than space, and applied this patch to HTML::Truncate. You probably wouldn't want it in this form in the mainline - I may clean it up and make it configurable at some point and send a clean version through if I get time, but you're welcome to incorporate it as it stands if you wish. Cheers, Matt Sheppard Index: /opt/enterprise-search/funnelback/lib/perl/HTML/Truncate.pm =================================================================== --- /opt/enterprise-search/funnelback/lib/perl/HTML/Truncate.pm (revision 24680) +++ /opt/enterprise-search/funnelback/lib/perl/HTML/Truncate.pm (working copy) @@ -421,7 +421,9 @@ my $keep = ""; if ( $self->on_space ) { - ( $keep ) = $txt =~ /\A(.{0,$chars_to_keep}\s?)(?=\s|\z)/; + # Hacked by MDS to allow dot, slash and hyphen and underscore as boundaries + ( $keep ) = $txt =~ /\A(.{0,$chars_to_keep}[\s\.\/\-_]?)(?=[\s\.\/\-_]|\z)/; + #( $keep ) = $txt =~ /\A(.{0,$chars_to_keep}\s?)(?=\s|\z)/; $keep =~ s/\s+\z//; } else


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.