WOW!
Now I feel real silly. (Usually results in good things)
I'm going to ease everything over to HTML::Truncate now, I believe...

It never ceases to amaze me how often I try to re invent the wheel.
(unknowingly)

Note to self: "Before attempting ANY new project, search CPAN!!!"
Thanks!

:)





On Fri, Apr 10, 2009 at 11:58 AM, Lee.M <[email protected]> wrote:

> Along w/ the problem of unbalancing tags there is also the white space
> issue (e.g. you want 100 characters you could have 'a' .
> $ninety_five_spaces . 'b' . $tons_of_text. and the truncated verbiage
> is essencially 'a b'
>
> length of character entities (e.g &lt; == 1 character not 4)
>
> Fortunately it looks like someone has already addressed all of that
> for us :)
>
> http://search.cpan.org/perldoc?HTML::Truncate
>
> On Apr 10, 2009, at 3:38 AM, Nicolas Ramz wrote:
>
> > Hi,
> >
> > I have a variable which contains some HTML text which may contain
> > some tags, like <strong> or <p> and I'd like to truncate it. The
> > problem is that truncate doesn't preserve the HTML tags, so this can
> > break my page, like in this example:
> >
> > $foo = "<p>blablablabla foooo</p>"
> >
> > in my template:
> >
> > [% FILTER truncate(10, '...') %]
> >    [% foo | html %]
> > [% END%]
> >
> > => the <p> isn't closed anymore.
> >
> > Is there a function that would allow to do that ? Or an easy way to
> > do so ?
> >
> > Thanks!
> >
> > Leo.
> > _______________________________________________
> > templates mailing list
> > [email protected]
> > http://mail.template-toolkit.org/mailman/listinfo/templates
>
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
>



-- 
Kelly Thompson
Vice President
Live Audio Magazine Inc.
www.liveaudiomag.com
(919) 389-5784
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to