On Sep 6, 7:58 am, Christoph Zwerschke <[EMAIL PROTECTED]> wrote:
> gjhames schrieb:
>
> > I'm using Kid Templates, and my template gets a string with characters
> > and line-breaks. I wish to convert all those line breaks into '<br>'.
> > There's a way?
>
> http://groups.google.de/group/turbogears/browse_thread/thread/5d41fe2...
I had some luck with this function that I just import into my
templates:
def nl2br(value, wraplen=100):
value = escape(value)
value = re.sub(r'\r\n|\r|\n', '\n', value)
value = wrap(value, wraplen)
return value+
-Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---